use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.
the class FromCompositeFactPatternWidget method getCompositeLabel.
protected Widget getCompositeLabel() {
ClickHandler click = new ClickHandler() {
public void onClick(ClickEvent event) {
showFactTypeSelector();
}
};
String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName("from") + " </div>";
FlexTable panel = new FlexTable();
int r = 0;
if (pattern.getFactPattern() == null) {
panel.setWidget(r, 0, new ClickableLabel("<br> <font color='red'>" + GuidedRuleEditorResources.CONSTANTS.clickToAddPatterns() + "</font>", click, !this.readOnly));
r++;
}
panel.setWidget(r, 0, new HTML(lbl));
ExpressionBuilder expressionBuilder = new ExpressionBuilder(this.getModeller(), this.getEventBus(), this.pattern.getExpression(), this.readOnly);
expressionBuilder.addOnModifiedCommand(new Command() {
public void execute() {
setModified(true);
}
});
panel.setWidget(r, 1, expressionBuilder);
return panel;
}
use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.
the class GuidedScoreCardEditor method getCharacteristics.
private Widget getCharacteristics() {
characteristicsPanel = new VerticalPanel();
characteristicsTables = new ArrayList<FlexTable>();
final HorizontalPanel toolbar = new HorizontalPanel();
btnAddCharacteristic = new Button(GuidedScoreCardConstants.INSTANCE.addCharacteristic(), new ClickHandler() {
public void onClick(ClickEvent event) {
addCharacteristic(null);
}
});
toolbar.add(btnAddCharacteristic);
toolbar.setHeight("24");
characteristicsPanel.add(toolbar);
final SimplePanel gapPanel = new SimplePanel();
gapPanel.add(new HTML("<br/>"));
characteristicsPanel.add(gapPanel);
return characteristicsPanel;
}
use of com.google.gwt.user.client.ui.FlexTable in project drools-wb by kiegroup.
the class GuidedScoreCardEditor method getModel.
public ScoreCardModel getModel() {
// ScoreCardModel could be null if the ScoreCard failed to load (e.g. the file was not found in VFS)
if (model == null) {
return null;
}
// Otherwise populate model from UI...
model.setBaselineScore(Double.parseDouble(tbBaselineScore.getValue()));
model.setInitialScore(Double.parseDouble(tbInitialScore.getValue()));
model.setUseReasonCodes(ddUseReasonCode.getSelectedIndex() == 1);
if (ddReasonCodeAlgorithm.getSelectedIndex() > 0) {
model.setReasonCodesAlgorithm(ddReasonCodeAlgorithm.getValue(ddReasonCodeAlgorithm.getSelectedIndex()));
} else {
model.setReasonCodesAlgorithm("");
}
ListBox enumDropDown = (ListBox) scorecardPropertiesGrid.getWidget(1, 0);
if (enumDropDown.getSelectedIndex() > 0) {
final String simpleFactName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
model.setFactName(simpleFactName);
oracle.getFieldCompletions(simpleFactName, new Callback<ModelField[]>() {
@Override
public void callback(final ModelField[] fields) {
if (fields != null) {
for (final ModelField mf : fields) {
if (mf.getType().equals(simpleFactName)) {
model.setFactName(mf.getClassName());
break;
}
}
}
}
});
} else {
model.setFactName("");
}
enumDropDown = (ListBox) scorecardPropertiesGrid.getWidget(1, 1);
if (enumDropDown.getSelectedIndex() > 0) {
String fieldName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
fieldName = fieldName.substring(0, fieldName.indexOf(":")).trim();
model.setFieldName(fieldName);
} else {
model.setFieldName("");
}
if (ddReasonCodeField.getSelectedIndex() > 0) {
String rcField = ddReasonCodeField.getValue(ddReasonCodeField.getSelectedIndex());
rcField = rcField.substring(0, rcField.indexOf(":")).trim();
model.setReasonCodeField(rcField);
} else {
model.setReasonCodeField("");
}
model.getCharacteristics().clear();
for (final FlexTable flexTable : characteristicsTables) {
final Characteristic characteristic = getCharacteristicFromTable(flexTable);
// Characteristic Attributes
characteristic.getAttributes().clear();
characteristic.getAttributes().addAll(characteristicsAttrMap.get(flexTable).getList());
model.getCharacteristics().add(characteristic);
}
model.setAgendaGroup(tbAgendaGroup.getValue());
model.setRuleFlowGroup(tbRuleFlowGroup.getValue());
return model;
}
use of com.google.gwt.user.client.ui.FlexTable in project perun by CESNET.
the class GetGroupByName method getDecoratedFlexTable.
/**
* Returns decorator panel with group info
*
* @return widget with group info
*/
public DecoratorPanel getDecoratedFlexTable() {
this.retrieveData();
// The table
FlexTable layout = new FlexTable();
layout.setCellSpacing(6);
// Add group information
layout.setHTML(0, 0, "ID:");
layout.setWidget(0, 1, this.groupIdLabel);
layout.setHTML(1, 0, "Name:");
layout.setWidget(1, 1, this.groupNameLabel);
layout.setHTML(2, 0, "Description:");
layout.setWidget(2, 1, this.groupDescriptionLabel);
// Wrap the content in a DecoratorPanel
DecoratorPanel decPanel = new DecoratorPanel();
decPanel.setWidget(layout);
return decPanel;
}
use of com.google.gwt.user.client.ui.FlexTable in project perun by CESNET.
the class GetGroupRichMembers method getTable.
/**
* Returns the table with rich members of group
*
* @return table widget
*/
public CellTable<RichMember> getTable() {
// retrieves data
retrieveData();
// Table data provider.
dataProvider = new ListDataProvider<RichMember>(list);
// Cell table
table = new PerunTable<RichMember>(list);
// Connect the table to the data provider.
dataProvider.addDataDisplay(table);
// Sorting
ListHandler<RichMember> columnSortHandler = new ListHandler<RichMember>(dataProvider.getList());
table.addColumnSortHandler(columnSortHandler);
// Table selection
table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<RichMember>createCheckboxManager());
// Set empty content & loader
table.setEmptyTableWidget(loaderImage);
// Checkbox column column
table.addCheckBoxColumn();
// Status column
Column<RichMember, String> statusColumn = new Column<RichMember, String>(new PerunStatusCell()) {
@Override
public String getValue(RichMember object) {
return object.getStatus();
}
};
// own onClick tab for changing member's status
statusColumn.setFieldUpdater(new FieldUpdater<RichMember, String>() {
public void update(int index, final RichMember object, String value) {
FlexTable widget = new FlexTable();
final ListBox lb = new ListBox(false);
lb.addItem("VALID", "VALID");
lb.addItem("INVALID", "INVALID");
lb.addItem("SUSPENDED", "SUSPENDED");
lb.addItem("EXPIRED", "EXPIRED");
lb.addItem("DISABLED", "DISABLED");
widget.setHTML(0, 0, "<strong>Status: </strong>");
widget.setWidget(0, 1, lb);
// pick which one is already set
for (int i = 0; i < lb.getItemCount(); i++) {
if (lb.getItemText(i).equalsIgnoreCase(object.getStatus())) {
lb.setSelectedIndex(i);
}
}
Confirm conf = new Confirm("Change member's status: " + object.getUser().getFullName(), widget, true);
conf.setCancelButtonText("Cancel");
conf.setOkButtonText("Change status");
conf.setOkClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SetStatus call = new SetStatus(object.getId(), new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
clearTable();
retrieveData();
}
public void onError(PerunError error) {
clearTable();
retrieveData();
}
});
call.setStatus(lb.getValue(lb.getSelectedIndex()));
}
});
conf.show();
}
});
// status column sortable
statusColumn.setSortable(true);
columnSortHandler.setComparator(statusColumn, new GeneralComparator<RichMember>(GeneralComparator.Column.STATUS));
table.addColumn(statusColumn, "Status");
table.setColumnWidth(statusColumn, 20, Unit.PX);
// Create member ID column.
Column<RichMember, String> memberIdColumn = JsonUtils.addColumn(new JsonUtils.GetValue<RichMember, String>() {
public String getValue(RichMember object) {
return String.valueOf(object.getId());
}
}, this.tableFieldUpdater);
// Create User ID column.
Column<RichMember, String> userIdColumn = JsonUtils.addColumn(new JsonUtils.GetValue<RichMember, String>() {
public String getValue(RichMember object) {
return String.valueOf(object.getUser().getId());
}
}, this.tableFieldUpdater);
columnSortHandler.setComparator(memberIdColumn, new RichMemberComparator(RichMemberComparator.Column.MEMBER_ID));
memberIdColumn.setSortable(true);
userIdColumn.setSortable(true);
columnSortHandler.setComparator(userIdColumn, new RichMemberComparator(RichMemberComparator.Column.USER_ID));
table.setColumnWidth(memberIdColumn, 110.0, Unit.PX);
table.setColumnWidth(userIdColumn, 110.0, Unit.PX);
// headers
if (JsonUtils.isExtendedInfoVisible()) {
table.addColumn(memberIdColumn, "Member ID");
table.addColumn(userIdColumn, "User ID");
}
table.addNameColumn(tableFieldUpdater);
return table;
}
Aggregations