if (container != null) {
container.removeFromParent();
container.removeAll();
}
if (container == null) {
container = new LayoutContainer(new BorderLayout());
}
tab.add(container);
tab.setProcessed(true);
final LayoutContainer layoutContainer = new LayoutContainer(new BorderLayout());
container.add(layoutContainer, new BorderLayoutData(Style.LayoutRegion.NORTH, 150));
WorkflowHistoryPanel next = getPanel(locale, engine);
if (activePanel != null) {
if (activePanel != next) {
activePanel.removeFromParent();
}
}
container.add(next, new BorderLayoutData(Style.LayoutRegion.CENTER));
activePanel = next;
JahiaContentManagementService.App.getInstance().getWorkflowRules(engine.getNode().getPath(),
new BaseAsyncCallback<Map<GWTJahiaWorkflowType,List<GWTJahiaWorkflowDefinition>>>() {
public void onSuccess(final Map<GWTJahiaWorkflowType,List<GWTJahiaWorkflowDefinition>> result) {
workflowRules = result;
for (List<GWTJahiaWorkflowDefinition> list : workflowRules.values()) {
for (GWTJahiaWorkflowDefinition definition : list) {
if (Boolean.TRUE.equals(definition.get("active")) && engine.getNode().getPath().equals(definition.get("definitionPath"))) {
definition.set("set", Boolean.TRUE);
}
}
}
final ListStore<GWTJahiaWorkflowType> types = new ListStore<GWTJahiaWorkflowType>();
types.add(new ArrayList<GWTJahiaWorkflowType>(workflowRules.keySet()));
types.sort("displayName", Style.SortDir.ASC);
ColumnModel header = new ColumnModel(Arrays.asList(new ColumnConfig("displayName", "displayName", 300)));
final Grid<GWTJahiaWorkflowType> grid = new Grid<GWTJahiaWorkflowType>(types, header);
grid.setWidth(250);
grid.setHideHeaders(true);
grid.setHeight(150);
grid.setAutoExpandColumn("displayName");
grid.setAutoExpandMax(1200);
BorderLayoutData data = new BorderLayoutData(Style.LayoutRegion.WEST, 250);
layoutContainer.add(grid, data);
FormPanel form = new FormPanel();
form.setHeaderVisible(false);
form.setLabelWidth(200);
form.setFieldWidth(300);
final CheckBox box = new CheckBox();
box.setFieldLabel(Messages.get("label.workflow.inherited","Same workflow as parent"));
form.add(box);
final ListStore<GWTJahiaWorkflowDefinition> states = new ListStore<GWTJahiaWorkflowDefinition>();
final ComboBox<GWTJahiaWorkflowDefinition> combo = new ComboBox<GWTJahiaWorkflowDefinition>();
combo.setFieldLabel(Messages.get("label.workflow","Workflow"));
combo.setForceSelection(true);
combo.setDisplayField("displayName");
combo.setWidth(400);
combo.setStore(states);
combo.setTypeAhead(true);
combo.setTriggerAction(ComboBox.TriggerAction.ALL);
form.add(combo);
data = new BorderLayoutData(Style.LayoutRegion.CENTER);
layoutContainer.add(form, data);
grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<GWTJahiaWorkflowType>() {
@Override
public void selectionChanged(SelectionChangedEvent<GWTJahiaWorkflowType> se) {