use of com.extjs.gxt.ui.client.widget.layout.FormLayout 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.layout.FormLayout in project geo-platform by geosdi.
the class AddFolderWidget method addComponentToForm.
@Override
public void addComponentToForm() {
this.fieldSet = new FieldSet();
this.fieldSet.setHeadingHtml(LayerModuleConstants.INSTANCE.AddFolderWidget_fieldSetHeadingText());
FormLayout layout = new FormLayout();
layout.setLabelWidth(40);
fieldSet.setLayout(layout);
this.folderText = new GPSecureStringTextField();
this.folderText.setFieldLabel(LayerModuleConstants.INSTANCE.AddFolderWidget_folderLabelText());
this.folderText.addKeyListener(new KeyListener() {
@Override
public void componentKeyUp(ComponentEvent event) {
if (folderText.getValue() == null) {
if ((event.getKeyCode() == KeyCodes.KEY_BACKSPACE) || (event.getKeyCode() == KeyCodes.KEY_DELETE)) {
reset();
}
} else {
if (folderText.getValue().length() > 0) {
save.enable();
} else {
save.disable();
}
}
}
@Override
public void componentKeyPress(ComponentEvent event) {
if ((event.getKeyCode() == KeyCodes.KEY_ENTER) && (folderText.getValue() != null) && (folderText.getValue().length() > 0)) {
execute();
}
}
});
this.fieldSet.add(this.folderText);
this.getFormPanel().add(this.fieldSet);
this.saveStatus = new SaveStatus();
this.saveStatus.setAutoWidth(true);
this.getFormPanel().getButtonBar().add(this.saveStatus);
getFormPanel().setButtonAlign(HorizontalAlignment.RIGHT);
save = new Button(ButtonsConstants.INSTANCE.createText(), AbstractImagePrototype.create(LayerResources.ICONS.addFolder()), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
execute();
}
});
save.setEnabled(false);
this.getFormPanel().addButton(save);
this.cancel = new Button(ButtonsConstants.INSTANCE.cancelText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.cancel()), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
clearComponents();
}
});
this.getFormPanel().addButton(cancel);
setFocusWidget(this.folderText);
}
use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.
the class ViewportGridFieldSet method setWidgetProperties.
@Override
public void setWidgetProperties() {
this.setWidth(ViewportWidget.VIEWPORT_WIDGET_WIDTH - 30);
this.setHeight(ViewportWidget.VIEWPORT_WIDGET_HEIGHT - 40);
this.setLayout(new FormLayout());
}
use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.
the class AddWorkspaceWidget method addComponentToForm.
@Override
public void addComponentToForm() {
this.fieldSet = new FieldSet();
this.fieldSet.setHeadingHtml(PublisherWidgetConstants.INSTANCE.AddWorkspaceWidget_fieldSetHeadingText());
FormLayout layout = new FormLayout();
layout.setLabelWidth(40);
fieldSet.setLayout(layout);
this.workspaceNameTextField = new GPSecureStringTextField();
this.workspaceNameTextField.setFieldLabel(PublisherWidgetConstants.INSTANCE.AddWorkspaceWidget_nameText());
this.workspaceNameTextField.addKeyListener(new KeyListener() {
@Override
public void componentKeyUp(ComponentEvent event) {
if (workspaceNameTextField.getValue() == null) {
if ((event.getKeyCode() == KeyCodes.KEY_BACKSPACE) || (event.getKeyCode() == KeyCodes.KEY_DELETE)) {
reset();
}
} else {
if (workspaceNameTextField.getValue().length() > 0) {
save.enable();
} else {
save.disable();
}
}
}
@Override
public void componentKeyPress(ComponentEvent event) {
if ((event.getKeyCode() == KeyCodes.KEY_ENTER) && (workspaceNameTextField.getValue() != null) && (workspaceNameTextField.getValue().length() > 0)) {
execute();
}
}
});
this.fieldSet.add(this.workspaceNameTextField);
this.getFormPanel().add(this.fieldSet);
this.saveStatus = new SaveStatus();
this.saveStatus.setAutoWidth(true);
this.getFormPanel().getButtonBar().add(this.saveStatus);
getFormPanel().setButtonAlign(HorizontalAlignment.RIGHT);
save = new Button(ButtonsConstants.INSTANCE.createText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.done()), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
execute();
}
});
save.setEnabled(false);
this.getFormPanel().addButton(save);
this.cancel = new Button(ButtonsConstants.INSTANCE.cancelText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.cancel()), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
clearComponents();
}
});
this.getFormPanel().addButton(cancel);
setFocusWidget(this.workspaceNameTextField);
}
use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.
the class ManageServerWidget method addComponentToForm.
private void addComponentToForm() {
super.setIcon(AbstractImagePrototype.create(ServerWidgetResources.ICONS.addServer()));
super.setLayout(new FormLayout());
List<ColumnConfig> configs = Lists.<ColumnConfig>newArrayList();
ColumnConfig aliasColumn = new ColumnConfig();
aliasColumn.setId(ALIAS.getValue());
aliasColumn.setHeaderHtml(ServerModuleConstants.INSTANCE.serverAliasText());
aliasColumn.setWidth(100);
GPSecureStringTextField aliasTextfield = new GPSecureStringTextField();
aliasTextfield.setAllowBlank(false);
aliasColumn.setEditor(new CellEditor(aliasTextfield));
configs.add(aliasColumn);
ColumnConfig urlColumn = new ColumnConfig();
urlColumn.setId(URL_SERVER.getValue());
urlColumn.setHeaderHtml(ServerModuleConstants.INSTANCE.serverURLText());
urlColumn.setWidth(300);
GPSecureStringTextField urlTextfield = new GPSecureStringTextField();
urlTextfield.setAllowBlank(false);
// urlTextfield.setEmptyText("http://");
urlColumn.setEditor(new CellEditor(urlTextfield));
configs.add(urlColumn);
checkColumn = new GPCheckColumnConfig("delete", ButtonsConstants.INSTANCE.deleteText(), 55, store, this.deleteServerButton);
CellEditor checkBoxEditor = new CellEditor(new CheckBox());
checkColumn.setEditor(checkBoxEditor);
// PROXY
CheckColumnConfig checkBoxProxyColumn = new CheckColumnConfig(PROXY.getValue(), ServerModuleConstants.INSTANCE.proxyText(), 55);
final CheckBox checkBoxProxy = new CheckBox();
checkBoxProxyColumn.setEditor(new CellEditor(checkBoxProxy));
// SECURE
final GPSecureStringTextField passwordTextfield = new GPSecureStringTextField();
final GPSecureStringTextField usernameTextfield = new GPSecureStringTextField();
usernameTextfield.setAllowBlank(true);
usernameTextfield.setAutoValidate(true);
usernameTextfield.disable();
passwordTextfield.setAutoValidate(true);
passwordTextfield.setAllowBlank(true);
passwordTextfield.disable();
this.checkBoxSecureColumn = new CheckColumnConfig(SERVER_PROTECTED.getValue(), ServerModuleConstants.INSTANCE.secureText(), 55);
ColumnConfig usernameColumn = new ColumnConfig();
usernameColumn.setId(USERNAME.getValue());
usernameColumn.setHeaderHtml(ServerModuleConstants.INSTANCE.usernameText());
usernameColumn.setWidth(100);
usernameColumn.setEditor(new CellEditor(usernameTextfield));
configs.add(usernameColumn);
ColumnConfig passowrdColumn = new ColumnConfig();
passowrdColumn.setId(PASSWORD.getValue());
passowrdColumn.setHeaderHtml(ServerModuleConstants.INSTANCE.passwordText());
passowrdColumn.setWidth(100);
GridCellRenderer<GPServerBeanModel> buttonRendered = new GridCellRenderer<GPServerBeanModel>() {
private String convertPassword(String password) {
return password != null ? password.replaceAll(".", "*") : "";
}
public Object render(final GPServerBeanModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<GPServerBeanModel> store, Grid<GPServerBeanModel> grid) {
return "<span>" + convertPassword(model.getPassword()) + "</span>";
}
};
passowrdColumn.setRenderer(buttonRendered);
passowrdColumn.setEditor(new CellEditor(passwordTextfield));
configs.add(passowrdColumn);
final CheckBox checkBoxSecure = new CheckBox();
checkBoxSecure.addListener(Events.Change, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
Boolean checked = (Boolean) be.getValue();
if (checked) {
checkBoxProxy.setValue(true);
checkBoxProxy.disable();
usernameTextfield.enable();
usernameTextfield.setAllowBlank(false);
passwordTextfield.enable();
passwordTextfield.setAllowBlank(false);
} else {
checkBoxProxy.setValue(false);
usernameTextfield.setValue(null);
usernameTextfield.disable();
checkBoxProxy.enable();
usernameTextfield.setAllowBlank(true);
passwordTextfield.setValue(null);
passwordTextfield.disable();
passwordTextfield.setAllowBlank(true);
usernameTextfield.clearInvalid();
passwordTextfield.clearInvalid();
}
}
});
CellEditor cellEditorSecure = new CellEditor(checkBoxSecure);
this.checkBoxSecureColumn.setEditor(cellEditorSecure);
// This is very important: add checkColumn to the zero position!
configs.add(0, checkColumn);
configs.add(3, checkBoxProxyColumn);
configs.add(4, this.checkBoxSecureColumn);
final ColumnModel columnModel = new ColumnModel(configs);
final Grid<GPServerBeanModel> grid = new Grid<GPServerBeanModel>(store, columnModel);
RowEditor<GPServerBeanModel> rowEditor = new RowEditor<GPServerBeanModel>() {
int currentRowIndex;
@Override
public void startEditing(int rowIndex, boolean doFocus) {
super.startEditing(rowIndex, doFocus);
this.currentRowIndex = rowIndex;
}
@Override
protected void onEnter(ComponentEvent ce) {
System.out.println("Selected null: ");
System.out.println(grid.getSelectionModel().getSelectedItem());
Record record = store.getRecord(grid.getSelectionModel().getSelectedItem());
record.reject(true);
super.onEnter(ce);
}
@Override
protected void onHide() {
super.onHide();
GPServerBeanModel currentBean = store.getModels().get(currentRowIndex);
if (currentBean.get(ALIAS.getValue()) == null || currentBean.get(ALIAS.getValue()).toString().isEmpty() || currentBean.get(URL_SERVER.getValue()) == null || currentBean.get(URL_SERVER.getValue()).toString().isEmpty()) {
store.remove(currentBean);
}
// System.out.println("Hiding row editor and verifing the check status");
checkColumn.manageDeleteButton();
}
};
rowEditor.setClicksToEdit(ClicksToEdit.TWO);
grid.setAutoExpandColumn(URL_SERVER.getValue());
grid.setBorders(true);
grid.addPlugin(checkColumn);
// grid.addPlugin(this.checkBoxSecureColumn);
grid.addPlugin(rowEditor);
grid.getAriaSupport().setLabelledBy(super.getHeader().getId() + "-label");
grid.setHeight(200);
super.add(grid);
super.add(this.createServerFilter());
this.addButtonsToTheWindow(rowEditor);
}
Aggregations