headerLabel = new ContentHeaderLabel("TITLE HERE");
vpanel.add(headerLabel);
vpanel.add(new ContentDescription(description));
vpanel.add(new ContentGroupLabel(getStackName()));
ToolStrip tableTools = new ToolStrip();
addModule = new ToolButton(Console.CONSTANTS.common_label_add());
addModule.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
openWizard(null);
}
});
addModule.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_abstractDomainDetailEditor());
tableTools.addToolButtonRight(addModule);
tableTools.addToolButtonRight(
new ToolButton(Console.CONSTANTS.common_label_remove(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final T policy = getCurrentSelection();
Feedback.confirm(
Console.MESSAGES.deleteTitle(getEntityName()),
Console.MESSAGES.deleteConfirm(policy.getCode()),
new Feedback.ConfirmationHandler() {
@Override
public void onConfirmation(boolean isConfirmed) {
if (isConfirmed) {
attributesProvider.getList().remove(policy);
if(attributesProvider.getList().size() > 0){
saveData();
}
// call remove() on last provider-module instead of save()
else{
removeData();
}
}
}
});
}
})
);
vpanel.add(tableTools);
// -------
Column<T, String> codeColumn = new Column<T, String>(new TextCell()) {
@Override
public String getValue(T record) {
return record.getCode();
}
};
attributesTable.addColumn(codeColumn, Console.CONSTANTS.subsys_security_codeField());
addCustomColumns(attributesTable);
List<HasCell<T, T>> actionCells = new ArrayList<HasCell<T,T>>();
IdentityColumn<T> actionColumn = new IdentityColumn<T>(new CompositeCell(actionCells));
attributesTable.addColumn(actionColumn, "");
vpanel.add(attributesTable);
// -------
DefaultPager pager = new DefaultPager();
pager.setDisplay(attributesTable);
vpanel.add(pager);
// -------
propertyEditor = new PropertyEditor(this, true);
propertyEditor.setHideButtons(false);
final SingleSelectionModel<T> ssm = new SingleSelectionModel<T>();
ssm.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
T policy = ssm.getSelectedObject();
if (policy == null) // Can this actually happen?
{
return;
}
List<PropertyRecord> props = policy.getProperties();
if (props == null) {
props = new ArrayList<PropertyRecord>();
policy.setProperties(props);
}
propertyEditor.setProperties("", policy.getProperties());
wizard.edit(policy);
}
});
attributesTable.setSelectionModel(ssm);
wizard = getWizard();
TabPanel bottomTabs = new TabPanel();
bottomTabs.setStyleName("default-tabpanel");
bottomTabs.add(wizard.asWidget(), "Attributes");
bottomTabs.add(propertyEditor.asWidget(), "Module Options");
propertyEditor.setAllowEditProps(false);
vpanel.add(new ContentGroupLabel("Details"));
vpanel.add(bottomTabs);
bottomTabs.selectTab(0);
// -------