private TextField<String> addDefinition(String definable, String definition) { TableData deleteColumn = new TableData(); deleteColumn.setWidth("20px"); deleteColumn.setVerticalAlign(VerticalAlignment.TOP); TableData defColumn = new TableData(); defColumn.setWidth(defColumnWidth); defColumn.setVerticalAlign(VerticalAlignment.TOP); TableData definitionsColumn = new TableData(); definitionsColumn.setWidth(definitionsColumnWidth); definitionsColumn.setVerticalAlign(VerticalAlignment.TOP); final TextField<String> defText = new TextField<String>(); defText.setValue(definable); defText.setWidth(defColumnWidth); final TextArea definitionText = new TextArea(); definitionText.setValue(definition); definitionText.setWidth(definitionsColumnWidth); fields.put(defText, definitionText); final Image image = new Image("images/icon-delete.png"); image.addClickListener( new ClickListener() { public void onClick(Widget sender) { WindowUtils.confirmAlert( "Delete?", "Are you sure you want to delete this definition?", new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent be) { if (be.getButtonClicked().getText().equalsIgnoreCase("yes")) { remove(defText); remove(definitionText); remove(image); fields.remove(defText); } }; }); } }); add(image, deleteColumn); add(defText, defColumn); add(definitionText, definitionsColumn); return defText; }
public void set(XObject input) { if (input instanceof XGroup) { XGroup group = (XGroup) input; name.setValue(group.getName()); description.setValue(translateDescription(group.getDescription())); if (group != null && group.getName() != null && (group.getName().equals("admin") || group.getName().equals("editor") || group.getName().equals("creator") || group.getName().equals("viewer") || group.getName().equals("poweruser") || group.getName().equals("publisher"))) { name.setEnabled(false); description.setEnabled(false); } else { name.setEnabled(true); description.setEnabled(true); } } }
@Override public void updateForm(SiteDTO m) { commentField.setValue(m.getComments()); }