require collection name

pull/53/head
Zlatin Balevsky 2020-11-02 10:43:00 +00:00
parent 45b53cdcaa
commit 9f488a465d
No known key found for this signature in database
GPG Key ID: A72832072D525E41
3 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,11 @@ class CollectionWizardController {
void review() {
model.timestamp = System.currentTimeMillis()
model.root = view.nameTextField.text
if (model.root == null || model.root.trim().length() == 0) {
view.warnMissingName()
return
}
model.root = model.root.trim()
model.comment = view.commentTextArea.text
if (model.comment == null)
model.comment = ""

View File

@ -535,6 +535,8 @@ COLLECTION_DESCRIPTION=Enter description for this collection
COLLECTION_TOTAL_FILES=Number of files
COLLECTION_TOTAL_SIZE=Total size
COLLECTION_REVIEW_TITLE=This is what the collection will look like
COLLECTION_NAME_WARNING=The collection name cannot be blank. Please select a name for this collection.
COLLECTION_NAME_WARNING_TITLE=Missing collection name
## Collections tool
COLLECTION_TOOL_TITLE=Collections in your repository

View File

@ -12,6 +12,7 @@ import griffon.metadata.ArtifactProviderFor
import net.i2p.data.DataHelper
import javax.swing.JDialog
import javax.swing.JOptionPane
import javax.swing.JTree
import javax.swing.SwingConstants
import javax.swing.border.TitledBorder
@ -108,6 +109,11 @@ class CollectionWizardView {
mainPanel.getLayout().show(mainPanel, "configuration")
}
void warnMissingName() {
JOptionPane.showMessageDialog(dialog, trans("COLLECTION_NAME_WARNING"),
trans("COLLECTION_NAME_WARNING_TITLE"), JOptionPane.WARNING_MESSAGE)
}
void mvcGroupInit(Map<String,String> args) {
filesTable.setDefaultRenderer(Long.class, new SizeRenderer())