Added regex in order to remove list of chars when renaming or creating new item. It is different for folder and item name
Updated pom version at 6.17.1 git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@150974 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3a8697659e
commit
ac1e018c9a
|
@ -1,4 +1,8 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-1"
|
||||||
|
date="2017-07-10">
|
||||||
|
<Change>Added regex in order to remove list of chars when renaming or creating new item. It is different for folder and item name</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-0"
|
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-0"
|
||||||
date="2017-05-22">
|
date="2017-05-22">
|
||||||
<Change>[Feature #5207] Integrate Image Preview Widget</Change>
|
<Change>[Feature #5207] Integrate Image Preview Widget</Change>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>workspace-tree-widget</artifactId>
|
<artifactId>workspace-tree-widget</artifactId>
|
||||||
<version>6.17.0-SNAPSHOT</version>
|
<version>6.17.1-SNAPSHOT</version>
|
||||||
<name>gCube Workspace Tree Widget</name>
|
<name>gCube Workspace Tree Widget</name>
|
||||||
<description>
|
<description>
|
||||||
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
private void doRenameItem(final RenameItemEvent event) {
|
private void doRenameItem(final RenameItemEvent event) {
|
||||||
|
|
||||||
final FileModel target = event.getFileTarget();
|
final FileModel target = event.getFileTarget();
|
||||||
final DialogText dgt = new DialogText(ConstantsExplorer.MESSAGE_RENAME, ConstantsExplorer.MESSAGE_ITEM_NAME, event.getFileTarget().getName());
|
final DialogText dgt = new DialogText(ConstantsExplorer.MESSAGE_RENAME, ConstantsExplorer.MESSAGE_ITEM_NAME, event.getFileTarget().getName(), target.isDirectory());
|
||||||
|
|
||||||
dgt.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
|
dgt.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class ConstantsExplorer {
|
||||||
public static final String NUMREQUESTS = "numrequests";
|
public static final String NUMREQUESTS = "numrequests";
|
||||||
public static final String MESSAGE_WEBDAV_URL = "View Url WebDAV ";
|
public static final String MESSAGE_WEBDAV_URL = "View Url WebDAV ";
|
||||||
public static final String URL_WEBDAV = "WebDAV URL";
|
public static final String URL_WEBDAV = "WebDAV URL";
|
||||||
public static final String REGEX_FOLDER_NAME = "Field name must not begin with one of the following characters";
|
|
||||||
public static final String MESSAGE_SEARCH_FORCE_APHANUMERIC = "Field search must be alphanumeric and not contain special chars!";
|
public static final String MESSAGE_SEARCH_FORCE_APHANUMERIC = "Field search must be alphanumeric and not contain special chars!";
|
||||||
public static final String MESSAGE_CREATE_NEW_MESSAGE = "Create New Message";
|
public static final String MESSAGE_CREATE_NEW_MESSAGE = "Create New Message";
|
||||||
|
|
||||||
|
@ -106,6 +106,12 @@ public class ConstantsExplorer {
|
||||||
protected static final String UNSHARING = "Unsharing...";
|
protected static final String UNSHARING = "Unsharing...";
|
||||||
|
|
||||||
public static final String FILEUPLOADHEADER = "File upload in: ";
|
public static final String FILEUPLOADHEADER = "File upload in: ";
|
||||||
|
|
||||||
|
public static final String REGEX_TO_WSITEM_NAME = "[^\\[\\]<>\\|?/*%$\\\\:]*$";
|
||||||
|
public static final String REGEX_TO_WSFOLDER_NAME = "[^.\\[\\]<>\\|?/*%$\\\\:]*$";
|
||||||
|
public static final String REGEX_WSITEM_NAME_ALERT_MSG = "Field name must not contain: <>[]:\\|?/*%$ or contains / or \\";
|
||||||
|
public static final String REGEX_WSFOLDER_NAME_ALERT_MSG = "Folder name must not contain: .<>[]:\\|?/*%$ or contains / or \\";
|
||||||
|
|
||||||
// public static final String FILE = "File";
|
// public static final String FILE = "File";
|
||||||
// public static final String ARCHIVE = "Archive";
|
// public static final String ARCHIVE = "Archive";
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,12 @@ import com.google.gwt.user.client.ui.Label;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class DialogShareFolder.
|
* The Class DialogShareFolder.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Jun 6, 2017
|
* Jul 10, 2017
|
||||||
*/
|
*/
|
||||||
public class DialogShareFolder extends Dialog {
|
public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
|
@ -81,6 +82,8 @@ public class DialogShareFolder extends Dialog {
|
||||||
txtName.setReadOnly(true);
|
txtName.setReadOnly(true);
|
||||||
txtName.setAutoValidate(true);
|
txtName.setAutoValidate(true);
|
||||||
txtName.setFieldLabel("Folder Name");
|
txtName.setFieldLabel("Folder Name");
|
||||||
|
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
||||||
|
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
||||||
|
|
||||||
txtOwner = new TextField<String>();
|
txtOwner = new TextField<String>();
|
||||||
txtOwner.setAllowBlank(true);
|
txtOwner.setAllowBlank(true);
|
||||||
|
@ -335,8 +338,9 @@ public class DialogShareFolder extends Dialog {
|
||||||
txtName.setAllowBlank(false);
|
txtName.setAllowBlank(false);
|
||||||
txtName.setAutoValidate(true);
|
txtName.setAutoValidate(true);
|
||||||
txtName.setFieldLabel("Folder Name");
|
txtName.setFieldLabel("Folder Name");
|
||||||
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_FOLDER_NAME+": .<>\\|?/*%$ or contains / or \\");
|
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
||||||
txtName.setRegex("^[^.<>\\|?/*%$]+[^\\/]*$");
|
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
||||||
|
// txtName.setRegex("^[^.<>\\|?/*%$]+[^\\/]*$");
|
||||||
|
|
||||||
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
||||||
textAreaDescription.setHeight(heightTextArea);
|
textAreaDescription.setHeight(heightTextArea);
|
||||||
|
@ -533,7 +537,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
* @return the name
|
* @return the name
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return txtName.getValue();
|
return txtName.getValue().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
package org.gcube.portlets.user.workspace.client.view.windows;
|
package org.gcube.portlets.user.workspace.client.view.windows;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
|
@ -15,144 +16,148 @@ import com.extjs.gxt.ui.client.widget.form.TextArea;
|
||||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* The Class DialogAddFolderAndSmart.
|
||||||
*
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 10, 2017
|
||||||
*/
|
*/
|
||||||
public class DialogAddFolderAndSmart extends Dialog {
|
public class DialogAddFolderAndSmart extends Dialog {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
private int widthDialog = 500;
|
private int widthDialog = 500;
|
||||||
private int heightTextArea = 150;
|
private int heightTextArea = 150;
|
||||||
private TextField<String> txtName;
|
private TextField<String> txtName;
|
||||||
private TextArea textAreaDescription = new TextArea();
|
private TextArea textAreaDescription = new TextArea();
|
||||||
public enum AddType {FOLDER, SMARTFOLDER};
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum AddType.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 10,
|
||||||
|
* 2017
|
||||||
|
*/
|
||||||
|
public enum AddType {
|
||||||
|
FOLDER, SMARTFOLDER
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new dialog add folder and smart.
|
||||||
|
*
|
||||||
|
* @param headerTitle
|
||||||
|
* the header title
|
||||||
|
* @param type
|
||||||
|
* the type
|
||||||
|
*/
|
||||||
public DialogAddFolderAndSmart(String headerTitle, AddType type) {
|
public DialogAddFolderAndSmart(String headerTitle, AddType type) {
|
||||||
|
|
||||||
FormLayout layout = new FormLayout();
|
FormLayout layout = new FormLayout();
|
||||||
layout.setLabelWidth(90);
|
layout.setLabelWidth(90);
|
||||||
layout.setDefaultWidth(300);
|
layout.setDefaultWidth(300);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
// setHideOnButtonClick(true);
|
||||||
// setHideOnButtonClick(true);
|
// setIcon(IconHelper.createStyle("user"));
|
||||||
// setIcon(IconHelper.createStyle("user"));
|
if (type.equals(AddType.FOLDER)) {
|
||||||
if(type.equals(AddType.FOLDER)){
|
setHeading(ConstantsExplorer.MESSAGE_ADD_FOLDER_IN + " " +
|
||||||
setHeading(ConstantsExplorer.MESSAGE_ADD_FOLDER_IN + " "+ headerTitle);
|
headerTitle);
|
||||||
setIcon(Resources.getIconAddFolder());
|
setIcon(Resources.getIconAddFolder());
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
setHeading(ConstantsExplorer.MESSAGE_ADD_SMART_FOLDER + " "+ headerTitle);
|
setHeading(ConstantsExplorer.MESSAGE_ADD_SMART_FOLDER + " " +
|
||||||
setIcon(Resources.getIconStar());
|
headerTitle);
|
||||||
}
|
setIcon(Resources.getIconStar());
|
||||||
setModal(true);
|
}
|
||||||
// setBodyBorder(true);
|
setModal(true);
|
||||||
setBodyStyle("padding: 9px; background: none");
|
// setBodyBorder(true);
|
||||||
setWidth(widthDialog);
|
setBodyStyle("padding: 9px; background: none");
|
||||||
setResizable(false);
|
setWidth(widthDialog);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setResizable(false);
|
||||||
// this.getButtonById(Dialog.CANCEL).setText("Reset");
|
setButtons(Dialog.OKCANCEL);
|
||||||
|
// this.getButtonById(Dialog.CANCEL).setText("Reset");
|
||||||
txtName = new TextField<String>();
|
txtName = new TextField<String>();
|
||||||
txtName.setAllowBlank(false);
|
txtName.setAllowBlank(false);
|
||||||
// txtName.setRegex("^[a-zA-Z0-9]+[ ]*[a-zA-Z0-9_-]+$");
|
// txtName.setRegex("^[a-zA-Z0-9]+[ ]*[a-zA-Z0-9_-]+$");
|
||||||
// txtName.setRegex("^[a-zA-Z0-9_]+[-]*[a-zA-Z0-9_\\s]*$");
|
// txtName.setRegex("^[a-zA-Z0-9_]+[-]*[a-zA-Z0-9_\\s]*$");
|
||||||
|
// txtName.setRegex("^[a-zA-Z0-9]+[^.<>\\|?/*%$]*$");
|
||||||
// txtName.setRegex("^[a-zA-Z0-9]+[^.<>\\|?/*%$]*$");
|
txtName.setAutoValidate(true);
|
||||||
|
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
||||||
txtName.setAutoValidate(true);
|
txtName.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
||||||
txtName.getMessages().setRegexText(ConstantsExplorer.REGEX_FOLDER_NAME+": .<>\\|?/*%$ or contains / or \\");
|
// txt.setMinLength(2);
|
||||||
txtName.setRegex("^[^.<>\\|?/*%$]+[^\\/]*$");
|
txtName.setFieldLabel(ConstantsExplorer.DIALOG_NAME);
|
||||||
|
// txtName.setValue(msgTxt);
|
||||||
// txt.setMinLength(2);
|
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
||||||
txtName.setFieldLabel(ConstantsExplorer.DIALOG_NAME);
|
textAreaDescription.setHeight(heightTextArea);
|
||||||
// txtName.setValue(msgTxt);
|
// textAreaDescription.setAllowBlank(false);
|
||||||
|
// formData = new FormData("-20");
|
||||||
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
// vp = new VerticalPanel();
|
||||||
textAreaDescription.setHeight(heightTextArea);
|
// vp.setSpacing(10);
|
||||||
// textAreaDescription.setAllowBlank(false);
|
txtName.addKeyListener(new KeyListener() { // KEY ENTER
|
||||||
|
|
||||||
// formData = new FormData("-20");
|
|
||||||
// vp = new VerticalPanel();
|
|
||||||
// vp.setSpacing(10);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
txtName.addKeyListener(new KeyListener() { // KEY ENTER
|
|
||||||
|
|
||||||
public void componentKeyPress(ComponentEvent event) {
|
public void componentKeyPress(ComponentEvent event) {
|
||||||
|
|
||||||
if (event.getKeyCode() == KeyboardEvents.Enter.getEventCode())
|
if (event.getKeyCode() == KeyboardEvents.Enter.getEventCode())
|
||||||
getButtonById(Dialog.OK).fireEvent(Events.Select);
|
getButtonById(Dialog.OK).fireEvent(Events.Select);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.getButtonById(Dialog.CANCEL).addSelectionListener(
|
||||||
|
new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
// txtName.reset();
|
||||||
|
// textAreaDescription.reset();
|
||||||
@Override
|
|
||||||
public void componentSelected(ButtonEvent ce) {
|
|
||||||
// txtName.reset();
|
|
||||||
// textAreaDescription.reset();
|
|
||||||
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentSelected(ButtonEvent ce) {
|
|
||||||
if(isValidForm())
|
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.getButtonById(Dialog.OK).addSelectionListener(
|
||||||
|
new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
setFocusWidget(txtName);
|
@Override
|
||||||
add(txtName);
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
if (isValidForm())
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setFocusWidget(txtName);
|
||||||
|
add(txtName);
|
||||||
add(textAreaDescription);
|
add(textAreaDescription);
|
||||||
|
this.show();
|
||||||
this.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name.
|
||||||
|
*
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return txtName.getValue();
|
|
||||||
|
return txtName.getValue().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the description.
|
||||||
|
*
|
||||||
|
* @return the description
|
||||||
|
*/
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
if(textAreaDescription.getValue()==null)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
|
if (textAreaDescription.getValue() == null)
|
||||||
|
return "";
|
||||||
return textAreaDescription.getValue();
|
return textAreaDescription.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private boolean isValidUrl(){
|
/**
|
||||||
//
|
* Checks if is valid form.
|
||||||
// try {
|
*
|
||||||
// URL url = new URL(txtUrl.getValue());
|
* @return true, if is valid form
|
||||||
// URLConnection conn = url.openConnection();
|
*/
|
||||||
// conn.connect();
|
public boolean isValidForm() {
|
||||||
// } catch (MalformedURLException e) {
|
|
||||||
// System.out.println(ConstantsExplorer.ERRORURLNOTREACHABLE);
|
|
||||||
// return false;
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// System.out.println(ConstantsExplorer.ERRORURLNOTREACHABLE);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean isValidForm(){
|
if (txtName.isValid() && txtName.getValue() != null)
|
||||||
|
|
||||||
if(txtName.isValid() && txtName.getValue() != null)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,27 @@ import com.extjs.gxt.ui.client.widget.Dialog;
|
||||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* The Class DialogText.
|
||||||
*
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jul 10, 2017
|
||||||
*/
|
*/
|
||||||
public class DialogText extends Dialog {
|
public class DialogText extends Dialog {
|
||||||
|
|
||||||
private TextField<String> txt;
|
private TextField<String> txt;
|
||||||
|
|
||||||
public DialogText(String headingTxt, String msgTitle, String msgTxt) {
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new dialog text.
|
||||||
|
*
|
||||||
|
* @param headingTxt the heading txt
|
||||||
|
* @param msgTitle the msg title
|
||||||
|
* @param msgTxt the msg txt
|
||||||
|
* @param isFolder the is folder
|
||||||
|
*/
|
||||||
|
public DialogText(String headingTxt, String msgTitle, String msgTxt, boolean isFolder) {
|
||||||
|
|
||||||
FormLayout layout = new FormLayout();
|
FormLayout layout = new FormLayout();
|
||||||
layout.setLabelWidth(90);
|
layout.setLabelWidth(90);
|
||||||
|
@ -43,8 +55,15 @@ public class DialogText extends Dialog {
|
||||||
txt.setValue(msgTxt);
|
txt.setValue(msgTxt);
|
||||||
// txt.setRegex("^[a-zA-Z0-9]+[ a-zA-Z0-9_()-]*");
|
// txt.setRegex("^[a-zA-Z0-9]+[ a-zA-Z0-9_()-]*");
|
||||||
// txt.setRegex("^[a-zA-Z0-9]+[^.<>\\|?/*%$]*$");
|
// txt.setRegex("^[a-zA-Z0-9]+[^.<>\\|?/*%$]*$");
|
||||||
txt.getMessages().setRegexText(ConstantsExplorer.REGEX_FOLDER_NAME+": .<>\\|?/*%$ or contains / or \\");
|
|
||||||
txt.setRegex("^[^.<>\\|?/*%$]+[^\\/]*$");
|
if(isFolder){
|
||||||
|
txt.getMessages().setRegexText(ConstantsExplorer.REGEX_WSFOLDER_NAME_ALERT_MSG);
|
||||||
|
txt.setRegex(ConstantsExplorer.REGEX_TO_WSFOLDER_NAME);
|
||||||
|
}else{
|
||||||
|
txt.getMessages().setRegexText(ConstantsExplorer.REGEX_WSITEM_NAME_ALERT_MSG);
|
||||||
|
txt.setRegex(ConstantsExplorer.REGEX_TO_WSITEM_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
txt.setAutoValidate(true);
|
txt.setAutoValidate(true);
|
||||||
txt.setAllowBlank(false);
|
txt.setAllowBlank(false);
|
||||||
|
|
||||||
|
@ -80,16 +99,33 @@ public class DialogText extends Dialog {
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the txt value.
|
||||||
|
*
|
||||||
|
* @return the txt value
|
||||||
|
*/
|
||||||
public String getTxtValue() {
|
public String getTxtValue() {
|
||||||
|
|
||||||
return txt.getValue();
|
return txt.getValue().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for value.
|
||||||
|
*
|
||||||
|
* @param field the field
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
protected boolean hasValue(TextField<String> field) {
|
protected boolean hasValue(TextField<String> field) {
|
||||||
return field.getValue() != null && field.getValue().length() > 0;
|
return field.getValue() != null && field.getValue().length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is valid form.
|
||||||
|
*
|
||||||
|
* @return true, if is valid form
|
||||||
|
*/
|
||||||
public boolean isValidForm() {
|
public boolean isValidForm() {
|
||||||
if(txt.isValid())
|
if(txt.isValid())
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue