use of com.google.gwt.event.dom.client.ChangeEvent in project perun by CESNET.
the class GroupManagersTabItem method draw.
public Widget draw() {
titleWidget.setText(Utils.getStrippedStringWithEllipsis(group.getName()) + ": managers");
VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
final ListBox box = new ListBox();
box.addItem("Users");
box.addItem("Groups");
box.setSelectedIndex(selectedDropDownIndex);
final ScrollPanel sp = new ScrollPanel();
sp.addStyleName("perun-tableScrollPanel");
// menu
final TabMenu menu = new TabMenu();
// group members
final GetRichAdminsWithAttributes admins = new GetRichAdminsWithAttributes(PerunEntity.GROUP, groupId, null);
final GetAdminGroups adminGroups = new GetAdminGroups(PerunEntity.GROUP, groupId);
box.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (box.getSelectedIndex() == 0) {
selectedDropDownIndex = 0;
sp.setWidget(fillContentUsers(admins, menu));
} else {
selectedDropDownIndex = 1;
sp.setWidget(fillContentGroups(adminGroups, menu));
}
}
});
if (selectedDropDownIndex == 0) {
sp.setWidget(fillContentUsers(admins, menu));
} else {
sp.setWidget(fillContentGroups(adminGroups, menu));
}
menu.addWidget(3, new HTML("<strong>Select mode: </strong>"));
menu.addWidget(4, box);
session.getUiElements().resizePerunTable(sp, 350, this);
vp.add(menu);
vp.setCellHeight(menu, "30px");
vp.add(sp);
sp.setStyleName("perun-tableScrollPanel");
this.contentWidget.setWidget(vp);
return getWidget();
}
use of com.google.gwt.event.dom.client.ChangeEvent in project drools-wb by kiegroup.
the class DTCellValueWidgetFactory method makeListBoxForColumn.
private ListBox makeListBoxForColumn(final DropDownData dd, final Pattern52 basePattern, final BaseColumn baseCondition, final DTCellValue52 dcv, final boolean isMultipleSelect) {
final ListBox lb = makeListBox(dd, isMultipleSelect, dcv);
// Wire up update handler
lb.setEnabled(!isReadOnly);
if (!isReadOnly) {
lb.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String value = null;
if (lb.isMultipleSelect()) {
for (int i = 0; i < lb.getItemCount(); i++) {
if (lb.isItemSelected(i)) {
if (value == null) {
value = lb.getValue(i);
} else {
value = value + "," + lb.getValue(i);
}
}
}
} else {
int index = lb.getSelectedIndex();
if (index > -1) {
// Set base column value
value = lb.getValue(index);
}
}
dcv.setStringValue(value);
// Update any dependent enumerations
final LimitedEntryDropDownManager.Context context = new LimitedEntryDropDownManager.Context(basePattern, baseCondition);
Set<Integer> dependentColumnIndexes = dropDownManager.getDependentColumnIndexes(context);
for (Integer iCol : dependentColumnIndexes) {
BaseColumn column = model.getExpandedColumns().get(iCol);
if (column instanceof LimitedEntryCol) {
((LimitedEntryCol) column).setValue(null);
} else if (column instanceof DTColumnConfig52) {
((DTColumnConfig52) column).setDefaultValue(null);
}
}
}
});
}
return lb;
}
use of com.google.gwt.event.dom.client.ChangeEvent in project drools-wb by kiegroup.
the class OperatorPage method cepOperatorsDropdown.
private void cepOperatorsDropdown(final Consumer<IsWidget> widgetSupplier) {
getOperatorCompletions(options -> {
final String[] operatorsArray = filterOptionsForConstraintTypeLiteral(options);
final CEPOperatorsDropdown dropdown = newCepOperatorsDropdown(operatorsArray);
final ListBox box = dropdown.getBox();
final int currentValueIndex = getCurrentIndexFromList(getOperator(), box);
box.addChangeHandler((ChangeEvent valueChangeEvent) -> setOperator(box.getValue(box.getSelectedIndex())));
if (currentValueIndex != box.getSelectedIndex()) {
box.setSelectedIndex(currentValueIndex);
}
widgetSupplier.accept(dropdown);
});
}
use of com.google.gwt.event.dom.client.ChangeEvent in project drools-wb by kiegroup.
the class EditActionInsertPopup method initialiseClassNames.
private void initialiseClassNames() {
// Extract all class names available
final String[] classNames = oracle.getFactTypes();
classNameListBox.setEnabled(!(classNames == null || classNames.length == 0));
if (classNames == null || classNames.length == 0) {
classNameListBox.addItem(GuidedDecisionTreeConstants.INSTANCE.noBindings());
return;
}
// Add them to the ListBox
int selectedIndex = 0;
for (String className : classNames) {
classNameListBox.addItem(className);
if (className.equals(clone.getClassName())) {
selectedIndex = classNameListBox.getItemCount() - 1;
}
}
// Attach event handler before we set the selected index in case we're selecting the first item
classNameListBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(final ChangeEvent event) {
final String className = classNameListBox.getItemText(classNameListBox.getSelectedIndex());
clone.setClassName(className);
clone.getFieldValues().clear();
initialiseFieldValues();
}
});
classNameListBox.setSelectedIndex(selectedIndex);
}
use of com.google.gwt.event.dom.client.ChangeEvent in project drools-wb by kiegroup.
the class EditConstraintPopup method initialiseOperators.
private void initialiseOperators() {
oracle.getOperatorCompletions(clone.getClassName(), clone.getFieldName(), new Callback<String[]>() {
@Override
public void callback(final String[] operators) {
operatorListBox.clear();
operatorListBox.setEnabled(false);
if (operators == null) {
return;
}
int selectedIndex = 0;
operatorListBox.setEnabled(true);
operatorListBox.addItem(GuidedDecisionTreeConstants.INSTANCE.noOperator());
for (int index = 0; index < operators.length; index++) {
final String operator = operators[index];
if (operator.equals(clone.getOperator())) {
selectedIndex = index + 1;
}
operatorListBox.addItem(HumanReadable.getOperatorDisplayName(operator), operator);
}
operatorListBox.setSelectedIndex(selectedIndex);
initialiseValue();
}
});
operatorListBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(final ChangeEvent event) {
final int selectedIndex = operatorListBox.getSelectedIndex();
if (selectedIndex == 0) {
clone.setOperator(null);
} else {
clone.setOperator(operatorListBox.getValue(selectedIndex));
}
initialiseValue();
}
});
}
Aggregations