this(presenter, reference, false);
}
public Widget asWidget() {
DockLayoutPanel wrapper = new DockLayoutPanel(Style.Unit.PX);
VerticalPanel panel = new VerticalPanel();
panel.setStyleName("window-content");
final Form<PropertyRecord> form = new Form<PropertyRecord>(PropertyRecord.class);
TextBoxItem nameItem = new TextBoxItem("key", "Name") {
@Override
public void setFiltered(boolean filtered) {
// cannot be filtered (workaround)
}
};
TextAreaItem valueItem = new TextAreaItem("value", "Value") {
@Override
public void setFiltered(boolean filtered) {
// cannot be filtered (workaround)
}
};
valueItem.setVisibleLines(2);
CheckBoxItem bootItem = new CheckBoxItem("bootTime", "Boot-Time");
if(Console.getBootstrapContext().isStandalone() || !includeBootTime)
form.setFields(nameItem, valueItem);
else
form.setFields(nameItem, valueItem, bootItem);
DialogueOptions options = new DialogueOptions(
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// save
PropertyRecord property = form.getUpdatedEntity();
if(!form.validate().hasErrors())
presenter.onCreateProperty(reference, property);
}
},
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// cancel
presenter.closePropertyDialoge();
}
}
);
panel.add(form.asWidget());
wrapper.addSouth(options, 35);
wrapper.add(panel);
return wrapper;
}