use of com.google.gwt.user.client.ui.CheckBox in project rstudio by rstudio.
the class UnsavedChangesDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
// create cell table
targetsCellTable_ = new CellTable<UnsavedChangesTarget>(15, UnsavedChangesCellTableResources.INSTANCE, KEY_PROVIDER);
selectionModel_ = new MultiSelectionModel<UnsavedChangesTarget>(KEY_PROVIDER);
targetsCellTable_.setSelectionModel(selectionModel_, DefaultSelectionEventManager.<UnsavedChangesTarget>createCheckboxManager());
targetsCellTable_.setWidth("100%", true);
// add columns
addSelectionColumn();
addIconColumn();
addNameAndPathColumn();
// hook-up data provider
dataProvider_ = new ListDataProvider<UnsavedChangesTarget>();
dataProvider_.setList(targets_);
dataProvider_.addDataDisplay(targetsCellTable_);
targetsCellTable_.setPageSize(targets_.size());
// select all by default
for (UnsavedChangesTarget editingTarget : dataProvider_.getList()) selectionModel_.setSelected(editingTarget, true);
// enclose cell table in scroll panel
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.setStylePrimaryName(RESOURCES.styles().targetScrollPanel());
scrollPanel.setWidget(targetsCellTable_);
if (dataProvider_.getList().size() > 4)
scrollPanel.setHeight("280px");
// always save check box (may not be shown)
chkAlwaysSave_ = new CheckBox(alwaysSaveOption_);
// main widget
VerticalPanel panel = new VerticalPanel();
Label captionLabel = new Label("The following files have unsaved changes:");
captionLabel.setStylePrimaryName(RESOURCES.styles().captionLabel());
panel.add(captionLabel);
panel.add(scrollPanel);
if (!StringUtil.isNullOrEmpty(alwaysSaveOption_)) {
panel.add(chkAlwaysSave_);
panel.setCellHeight(chkAlwaysSave_, "30px");
panel.setCellVerticalAlignment(chkAlwaysSave_, HasVerticalAlignment.ALIGN_MIDDLE);
}
return panel;
}
use of com.google.gwt.user.client.ui.CheckBox in project perun by CESNET.
the class GroupRelationsTabItem method draw.
@Override
public Widget draw() {
titleWidget.setText(Utils.getStrippedStringWithEllipsis(group.getName()) + ": unions");
// main panel
VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
// if members group, hide
if (group.isCoreGroup()) {
vp.add(new HTML("<h2>Members group cannot have unions.</h2>"));
this.contentWidget.setWidget(vp);
return getWidget();
}
final GetGroupUnions unions = new GetGroupUnions(group, false);
// Events for reloading when group is created
final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(unions);
// menu
TabMenu menu = new TabMenu();
final CheckBox subGroupsCheckBox = new CheckBox("Show sub-groups");
final ListBox reverseDropdown = new ListBox();
reverseDropdown.addItem("Normal");
reverseDropdown.addItem("Reverse");
reverseDropdown.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
switch(reverseDropdown.getSelectedIndex()) {
case 1:
unions.setReverseAndRefresh(true);
subGroupsCheckBox.setVisible(false);
break;
default:
unions.setReverseAndRefresh(false);
subGroupsCheckBox.setVisible(true);
}
}
});
menu.addWidget(UiElements.getRefreshButton(this));
CustomButton createButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addGroupUnion(), new ClickHandler() {
public void onClick(ClickEvent event) {
// creates a new form
session.getTabManager().addTabToCurrentTab(new AddGroupUnionTabItem(group), true);
}
});
if (!session.isGroupAdmin(groupId) && !session.isVoAdmin(group.getVoId())) {
createButton.setEnabled(false);
unions.setCheckable(false);
}
menu.addWidget(createButton);
final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeGroupUnion());
removeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final ArrayList<Group> itemsToRemove = unions.getTableSelectedList();
String text = "Following group unions will be deleted.";
UiElements.showDeleteConfirm(itemsToRemove, text, new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
RemoveGroupUnions request = new RemoveGroupUnions(JsonCallbackEvents.disableButtonEvents(removeButton, events));
if (unions.isReverse()) {
request.deleteGroupUnions(itemsToRemove, group);
} else {
request.deleteGroupUnions(group, itemsToRemove);
}
}
});
}
});
menu.addWidget(removeButton);
// filter box
final ExtendedSuggestBox box = new ExtendedSuggestBox(unions.getOracle());
menu.addFilterWidget(box, new PerunSearchEvent() {
public void searchFor(String text) {
unions.filterTable(text);
}
}, ButtonTranslation.INSTANCE.filterGroup());
subGroupsCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
unions.setShowSubgroupsAndRefresh(valueChangeEvent.getValue(), box.getSuggestBox().getText());
}
});
menu.addWidget(new HTML("<strong>Direction: </strong>"));
menu.addWidget(reverseDropdown);
menu.addWidget(subGroupsCheckBox);
// add menu to the main panel
vp.add(menu);
vp.setCellHeight(menu, "30px");
CellTable<Group> table = unions.getTable(new FieldUpdater<Group, String>() {
@Override
public void update(int arg0, Group group, String arg2) {
if (session.isGroupAdmin(group.getId()) || session.isVoAdmin(group.getId())) {
session.getTabManager().addTab(new GroupDetailTabItem(group.getId()));
} else {
UiElements.generateInfo("Not privileged", "You are not manager of selected group or its VO.");
}
}
});
removeButton.setEnabled(false);
if (session.isGroupAdmin(groupId) || session.isVoAdmin(group.getVoId()))
JsonUtils.addTableManagedButton(unions, table, removeButton);
// adds the table into the panel
table.addStyleName("perun-table");
ScrollPanel sp = new ScrollPanel(table);
sp.addStyleName("perun-tableScrollPanel");
vp.add(sp);
session.getUiElements().resizePerunTable(sp, 350, this);
this.contentWidget.setWidget(vp);
return getWidget();
}
use of com.google.gwt.user.client.ui.CheckBox in project zxing by zxing.
the class CalendarEventGenerator method getWidget.
@Override
public Grid getWidget() {
if (table != null) {
return table;
}
datePicker1.setValue(new Date());
datePicker2.setValue(new Date());
table = new Grid(10, 2);
table.setText(0, 0, "All day event");
table.setWidget(0, 1, fullDay);
table.setText(1, 0, "Event title");
table.setWidget(1, 1, eventName);
table.setText(2, 0, "Start date");
table.setWidget(2, 1, datePicker1);
table.setText(3, 0, "Time");
table.setWidget(3, 1, timePicker1);
table.setText(4, 0, "End date");
table.setWidget(4, 1, datePicker2);
table.setText(5, 0, "Time");
table.setWidget(5, 1, timePicker2);
table.setText(6, 0, "Time zone");
table.setWidget(6, 1, timeZones);
table.setText(7, 0, "Daylight savings");
table.setWidget(7, 1, summerTime);
table.setText(8, 0, "Location");
table.setWidget(8, 1, location);
table.setText(9, 0, "Description");
table.setWidget(9, 1, description);
table.getRowFormatter().getElement(3).setId(FULL_DAY_ONLY_IDS[0]);
table.getRowFormatter().getElement(5).setId(FULL_DAY_ONLY_IDS[1]);
table.getRowFormatter().getElement(6).setId(FULL_DAY_ONLY_IDS[2]);
table.getRowFormatter().getElement(7).setId(FULL_DAY_ONLY_IDS[3]);
fullDay.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
CheckBox cb = (CheckBox) event.getSource();
for (String s : FULL_DAY_ONLY_IDS) {
Element element = DOM.getElementById(s);
String style = cb.getValue() ? "none" : "";
element.getStyle().setProperty("display", style);
}
}
});
return table;
}
use of com.google.gwt.user.client.ui.CheckBox in project opentsdb by OpenTSDB.
the class MetricForm method addTag.
private void addTag(final String default_tagname, final String default_value, final boolean is_groupby) {
final int row = tagtable.getRowCount();
final ValidatedTextBox tagname = new ValidatedTextBox();
final SuggestBox suggesttagk = RemoteOracle.newSuggestBox("tagk", tagname);
final ValidatedTextBox tagvalue = new ValidatedTextBox();
final SuggestBox suggesttagv = RemoteOracle.newSuggestBox("tagv", tagvalue);
final CheckBox groupby = new CheckBox();
groupby.setValue(is_groupby);
groupby.setTitle("Group by");
groupby.addClickHandler(events_handler);
tagname.setValidationRegexp(TSDB_ID_RE);
tagvalue.setValidationRegexp(TSDB_TAGVALUE_RE);
tagname.setWidth("100%");
tagvalue.setWidth("100%");
tagname.addBlurHandler(recompact_tagtable);
tagname.addBlurHandler(events_handler);
tagname.addKeyPressHandler(events_handler);
tagvalue.addBlurHandler(recompact_tagtable);
tagvalue.addBlurHandler(events_handler);
tagvalue.addKeyPressHandler(events_handler);
tagtable.setWidget(row, 1, suggesttagk);
tagtable.setWidget(row, 2, suggesttagv);
tagtable.setWidget(row, 3, groupby);
if (row > 2) {
final Button remove = new Button("x");
remove.addClickHandler(removetag);
tagtable.setWidget(row - 1, 0, remove);
}
if (default_tagname != null) {
tagname.setText(default_tagname);
if (default_value == null) {
tagvalue.setFocus(true);
}
}
if (default_value != null) {
tagvalue.setText(default_value);
}
}
use of com.google.gwt.user.client.ui.CheckBox in project gerrit by GerritCodeReview.
the class ProjectInfoScreen method getPluginConfigValues.
private Map<String, Map<String, ConfigParameterValue>> getPluginConfigValues() {
Map<String, Map<String, ConfigParameterValue>> pluginConfigValues = new HashMap<>(pluginConfigWidgets.size());
for (Entry<String, Map<String, HasEnabled>> e : pluginConfigWidgets.entrySet()) {
Map<String, ConfigParameterValue> values = new HashMap<>(e.getValue().size());
pluginConfigValues.put(e.getKey(), values);
for (Entry<String, HasEnabled> e2 : e.getValue().entrySet()) {
HasEnabled widget = e2.getValue();
if (widget instanceof TextBox) {
values.put(e2.getKey(), ConfigParameterValue.create().value(((TextBox) widget).getValue().trim()));
} else if (widget instanceof CheckBox) {
values.put(e2.getKey(), ConfigParameterValue.create().value(Boolean.toString(((CheckBox) widget).getValue())));
} else if (widget instanceof ListBox) {
ListBox listBox = (ListBox) widget;
// the inherited value is at index 0,
// if it is selected no value should be set on this project
String value = listBox.getSelectedIndex() > 0 ? listBox.getValue(listBox.getSelectedIndex()) : null;
values.put(e2.getKey(), ConfigParameterValue.create().value(value));
} else if (widget instanceof StringListPanel) {
values.put(e2.getKey(), ConfigParameterValue.create().values(((StringListPanel) widget).getValues(0).toArray(new String[] {})));
} else {
throw new UnsupportedOperationException("unsupported widget type");
}
}
}
return pluginConfigValues;
}
Aggregations