use of com.extjs.gxt.ui.client.widget.form.CheckBoxGroup in project geo-platform by geosdi.
the class GPProjectPropertiesBinding method createFormPanel.
@Override
public FormPanel createFormPanel() {
FormPanel fp = new FormPanel();
FormLayout layout = new FormLayout();
layout.setLabelWidth(100);
layout.setLabelPad(5);
fp.setBorders(false);
fp.setHeaderVisible(false);
fp.setBodyBorder(false);
fp.setLayout(layout);
projectNameField = new GPSecureStringTextField();
projectNameField.setId(GPClientProjectKey.PROJECT_NAME.toString());
projectNameField.setName(GPClientProjectKey.PROJECT_NAME.toString());
projectNameField.setFieldLabel(LayerModuleConstants.INSTANCE.GPProjectSearchPanel_listViewNameText());
projectNameField.setReadOnly(true);
fp.add(projectNameField);
projectElementsField = new GPSecureStringTextField();
projectElementsField.setId(GPClientProjectKey.PROJECT_ELEMENTS.toString());
projectElementsField.setName(GPClientProjectKey.PROJECT_ELEMENTS.toString());
projectElementsField.setFieldLabel(LayerModuleConstants.INSTANCE.GPProjectSearchPanel_listViewPropertiesText());
projectElementsField.setReadOnly(true);
fp.add(projectElementsField);
projectVersionField = new GPSecureStringTextField();
projectVersionField.setId(GPClientProjectKey.PROJECT_VERSION.toString());
projectVersionField.setName(GPClientProjectKey.PROJECT_VERSION.toString());
projectVersionField.setFieldLabel(LayerModuleConstants.INSTANCE.GPProjectSearchPanel_listViewVersionText());
projectVersionField.setReadOnly(true);
fp.add(projectVersionField);
creationDateField = new GPSecureStringTextField();
creationDateField.setId(GPClientProjectKey.CREATION_DATE.toString());
creationDateField.setName(GPClientProjectKey.CREATION_DATE.toString());
creationDateField.setFieldLabel(LayerModuleConstants.INSTANCE.GPProjectSearchPanel_listViewCreationDateText());
creationDateField.setEnabled(true);
fp.add(creationDateField);
CheckBoxGroup checkGroupVisibility = new CheckBoxGroup();
checkGroupVisibility.setFieldLabel(LayerModuleConstants.INSTANCE.GPClientProject_checkGroupVisibilityLabelText());
internalPublic = new CheckBox();
internalPublic.setId(PROJECT_INTERNAL_PUBLIC.toString());
internalPublic.setName(PROJECT_INTERNAL_PUBLIC.toString());
internalPublic.setBoxLabel(LayerModuleConstants.INSTANCE.GPClientProject_internalVisibilityLabelText());
internalPublic.setReadOnly(true);
checkGroupVisibility.add(internalPublic);
externalPublic = new CheckBox();
externalPublic.setId(PROJECT_EXTERNAL_PUBLIC.toString());
externalPublic.setName(PROJECT_EXTERNAL_PUBLIC.toString());
externalPublic.setBoxLabel(LayerModuleConstants.INSTANCE.GPClientProject_externalVisibilityLabelText());
externalPublic.setReadOnly(true);
checkGroupVisibility.add(externalPublic);
fp.add(checkGroupVisibility);
sharedCheck = new CheckBox();
sharedCheck.setId(PROJECT_SHARED.toString());
sharedCheck.setName(PROJECT_SHARED.toString());
sharedCheck.setBoxLabel(LayerModuleConstants.INSTANCE.GPClientProject_sharedLabelText());
sharedCheck.setReadOnly(true);
CheckBoxGroup checkGroup = new CheckBoxGroup();
checkGroup.setFieldLabel(LayerModuleConstants.INSTANCE.ProjectBindingWidget_checkBoxGroupLabelText());
checkGroup.add(this.sharedCheck);
fp.add(checkGroup);
return fp;
}
use of com.extjs.gxt.ui.client.widget.form.CheckBoxGroup in project geo-platform by geosdi.
the class ProjectBindingWidget method addComponentToForm.
@Override
public void addComponentToForm() {
fieldSet = new FieldSet();
fieldSet.setHeadingHtml(LayerModuleConstants.INSTANCE.ProjectBindingWidget_fieldSetHeadingText());
FormLayout layout = new FormLayout();
layout.setLabelWidth(120);
layout.setLabelPad(5);
fieldSet.setLayout(layout);
this.projectFieldName = new GPSecureStringTextField();
this.projectFieldName.setAllowBlank(FALSE);
this.projectFieldName.setEmptyText(LayerModuleConstants.INSTANCE.ProjectBindingWidget_projectFieldNameEmptyText());
this.projectFieldName.setName(GPClientProjectKey.PROJECT_NAME.name());
this.projectFieldName.setFieldLabel(LayerModuleConstants.INSTANCE.ProjectBindingWidget_projectFieldNameLabelText());
fieldSet.add(this.projectFieldName);
this.projectDescription = new GPSecureStringTextArea();
this.projectDescription.setAllowBlank(FALSE);
this.projectDescription.setEmptyText(LayerModuleConstants.INSTANCE.ProjectBindingWidget_projectFieldDescriptionEmptyText());
this.projectDescription.setName(GPClientProjectKey.PROJECT_DESCRIPTION.name());
this.projectDescription.setFieldLabel(LayerModuleConstants.INSTANCE.ProjectBindingWidget_projectFielDescriptionLabelText());
fieldSet.add(this.projectDescription);
this.projectPathImage = new GPSecureStringTextField();
this.projectPathImage.setAllowBlank(FALSE);
this.projectPathImage.setEmptyText(LayerModuleConstants.INSTANCE.ProjectBindingWidget_projectFieldPathImageEmptyText());
this.projectPathImage.setName(GPClientProjectKey.PROJECT_PATH_IMAGE.name());
this.projectPathImage.setFieldLabel(LayerModuleConstants.INSTANCE.ProjectBindingWidget_projectFielPathImageLabelText());
fieldSet.add(this.projectPathImage);
CheckBoxGroup checkGroupVisibility = new CheckBoxGroup();
checkGroupVisibility.setFieldLabel(LayerModuleConstants.INSTANCE.GPClientProject_checkGroupVisibilityLabelText());
internalPublic = new CheckBox();
internalPublic.setName(GPClientProjectKey.PROJECT_INTERNAL_PUBLIC.toString());
internalPublic.setBoxLabel(LayerModuleConstants.INSTANCE.GPClientProject_internalVisibilityLabelText());
checkGroupVisibility.add(internalPublic);
externalPublic = new CheckBox();
externalPublic.setName(GPClientProjectKey.PROJECT_EXTERNAL_PUBLIC.toString());
externalPublic.setBoxLabel(LayerModuleConstants.INSTANCE.GPClientProject_externalVisibilityLabelText());
checkGroupVisibility.add(externalPublic);
fieldSet.add(checkGroupVisibility);
this.projectDefaultCheck = new CheckBox();
this.projectDefaultCheck.setBoxLabel(LayerModuleConstants.INSTANCE.ProjectBindingWidget_projectDefaultCheckLabelText());
this.projectDefaultCheck.setName(GPClientProjectKey.DEFAULT_PROJECT.toString());
CheckBoxGroup checkGroup = new CheckBoxGroup();
checkGroup.setFieldLabel(LayerModuleConstants.INSTANCE.ProjectBindingWidget_checkBoxGroupLabelText());
checkGroup.add(this.projectDefaultCheck);
fieldSet.add(checkGroup);
this.getFormPanel().add(fieldSet);
this.addButtons();
}
use of com.extjs.gxt.ui.client.widget.form.CheckBoxGroup in project kapua by eclipse.
the class FailureHandler method handleFormException.
@SuppressWarnings("unchecked")
public static boolean handleFormException(FormPanel form, Throwable caught) {
boolean isWarning = false;
if (caught instanceof GwtKapuaException) {
List<Field<?>> fields = form.getFields();
GwtKapuaException gee = (GwtKapuaException) caught;
GwtKapuaErrorCode code = gee.getCode();
switch(code) {
case INVALID_XSRF_TOKEN:
ConsoleInfo.display(CMSGS.error(), CMSGS.securityInvalidXSRFToken());
Window.Location.reload();
break;
case UNAUTHENTICATED:
ConsoleInfo.display(CMSGS.loggedOut(), caught.getLocalizedMessage());
Window.Location.reload();
break;
case DUPLICATE_NAME:
boolean fieldFound = false;
String duplicateFieldName = gee.getArguments()[0];
for (Field<?> field : fields) {
if (duplicateFieldName.equals(field.getName())) {
TextField<String> textField = (TextField<String>) field;
textField.markInvalid(MSGS.duplicateValue());
fieldFound = true;
break;
}
}
if (!fieldFound) {
ConsoleInfo.display(CMSGS.error(), caught.getLocalizedMessage());
}
break;
case ILLEGAL_NULL_ARGUMENT:
String invalidFieldName = gee.getArguments()[0];
for (Field<?> field : fields) {
if (invalidFieldName.equals(field.getName())) {
TextField<String> textField = (TextField<String>) field;
textField.markInvalid(MSGS.invalidNullValue());
break;
}
}
break;
case ILLEGAL_ARGUMENT:
String invalidFieldName1 = gee.getArguments()[0];
for (Field<?> field : fields) {
if (invalidFieldName1.equals(field.getName())) {
TextField<String> textField = (TextField<String>) field;
textField.markInvalid(gee.getCause().getMessage());
break;
}
}
break;
case CANNOT_REMOVE_LAST_ADMIN:
String adminFieldName = gee.getArguments()[0];
for (Field<?> field : fields) {
if (adminFieldName.equals(field.getName())) {
CheckBoxGroup adminCheckBoxGroup = (CheckBoxGroup) field;
adminCheckBoxGroup.markInvalid(MSGS.lastAdministrator());
break;
}
}
break;
case INVALID_RULE_QUERY:
for (Field<?> field : fields) {
if ("query".equals(field.getName())) {
TextArea statement = (TextArea) field;
statement.markInvalid(caught.getLocalizedMessage());
break;
}
}
break;
case WARNING:
isWarning = true;
ConsoleInfo.display(CMSGS.warning(), caught.getLocalizedMessage());
break;
default:
ConsoleInfo.display(CMSGS.error(), caught.getLocalizedMessage());
caught.printStackTrace();
break;
}
} else {
ConsoleInfo.display(CMSGS.error(), caught.getLocalizedMessage());
caught.printStackTrace();
}
return isWarning;
}
Aggregations