List of usage examples for com.google.gwt.user.client.ui CheckBox CheckBox
protected CheckBox(Element elem)
From source file:com.dingziran.effective.client.content.widgets.CwCheckBox.java
License:Apache License
/** * Constructor.//from ww w .j ava 2s.co m * * @param constants the constants */ public CwCheckBox(CwConstants constants) { super(constants.cwCheckBoxName(), constants.cwCheckBoxDescription()); this.constants = constants; view = new ContentWidgetView(hasMargins(), hasScrollableContent()); view.setName(getName()); view.setDescription(getDescription()); setWidget(view); // Create a vertical panel to align the check boxes VerticalPanel vPanel = new VerticalPanel(); HTML label = new HTML(constants.cwCheckBoxCheckAll()); label.ensureDebugId("cwCheckBox-label"); vPanel.add(label); // Add a checkbox for each day of the week String[] daysOfWeek = constants.cwCheckBoxDays(); for (int i = 0; i < daysOfWeek.length; i++) { String day = daysOfWeek[i]; CheckBox checkBox = new CheckBox(day); checkBox.ensureDebugId("cwCheckBox-" + day); // Disable the weekends if (i >= 5) { checkBox.setEnabled(false); } vPanel.add(checkBox); } view.setExample(vPanel); }
From source file:com.edgenius.wiki.gwt.client.user.ContactPanel.java
License:Open Source License
public void setUser(UserModel model) { //clean table first this.removeAllRows(); int row = 0;/*from w ww . j av a 2 s . c o m*/ this.getColumnFormatter().setStyleName(0, Css.NOWRAP); this.getColumnFormatter().setWidth(0, "1%"); this.getColumnFormatter().setWidth(1, "98%"); this.getColumnFormatter().setWidth(2, "1%"); this.setCellPadding(3); this.setWidth("100%"); if (editing) { textboxList = new ArrayList<FormTextBox>(); checkboxList = new ArrayList<CheckBox>(); userUid = model.getUid(); fullname = new FormTextBox(); fullname.setName("user.fullname"); fullname.valid(Msg.consts.full_name(), true, 0, PersonalProfile.LOGIN_FULLNAME_LEN, null); fullname.setStyleName(Css.FORM_INPUT); fullname.setText(model.getFullname()); Label fullnameLabel = new Label(Msg.consts.full_name()); fullnameLabel.setStyleName(Css.FORM_LABEL); this.setWidget(row, 0, fullnameLabel); this.setWidget(row, 1, fullname); row++; } for (Entry<String, LinkedHashMap<String, String>> entry : model.getContacts().entrySet()) { LinkedHashMap<String, String> values = entry.getValue(); if (values == null || values.size() == 0) { //E.g., if user public profile page, "Contact" group is hidden, so its title won't display as well. continue; } Label cTitle = new Label(entry.getKey()); cTitle.setStyleName(Css.HEADING2); cTitle.addStyleName(Css.UNDERLINE); this.setWidget(row, 0, cTitle); this.getFlexCellFormatter().setColSpan(row, 0, editing ? 2 : 3); row++; //get linked flag - although we know only Twitter has linked attribute so far, we still use this common way for future. //see comments on UserUtil.copyUserContactToModel(); Map<String, Boolean> linked = new HashMap<String, Boolean>(); for (String key : values.keySet()) { if (key.endsWith("_linked")) { String name = key.substring(0, key.length() - 7); linked.put(name, BooleanUtil.toBoolean(values.get(key))); } } for (Entry<String, String> contact : values.entrySet()) { String name = contact.getKey(); if (name.endsWith("_linked")) { continue; } Label lb = new Label(name); lb.setStyleName(Css.FORM_LABEL); this.setWidget(row, 0, lb); if (editing) { //email FormTextBox text = new FormTextBox(); if (SharedConstants.USERSETTING_PROP_NAME_EMAIL.equalsIgnoreCase(name)) { email = text; text.valid(Msg.consts.email(), true, 0, PersonalProfile.LOGIN_EMAIL_LEN, this); } else { textboxList.add(text); } text.setName(name); text.setText(contact.getValue()); text.setStyleName(Css.FORM_INPUT); this.setWidget(row, 1, text); if (linked.containsKey(name)) { row++; CheckBox box = new CheckBox(Msg.consts.linked()); box.setName(name + "_linked"); box.setValue(linked.get(name)); this.setWidget(row, 1, box); checkboxList.add(box); } } else { if (contact.getValue() != null) { Label info = new Label(contact.getValue()); this.setWidget(row, 1, info); } else { //just a placeholder this.setWidget(row, 1, new Label(" ")); } if (linked.containsKey(name) && linked.get(name)) { //show linked image Image linkedImg = new Image(IconBundle.I.get().connect()); linkedImg.setTitle(Msg.consts.linked()); this.setWidget(row, 2, linkedImg); } else { //just a placeholder this.setWidget(row, 2, new Label(" ")); } } row++; } } }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.batch.ExportBatchClassView.java
License:Open Source License
/** * To get batch Folder List View./* w w w .j a v a 2 s.c om*/ * * @param propertyMap Map<String, String> */ public void getbatchFolderListView(Map<String, String> propertyMap) { HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.addStyleName("width100"); CheckBox checkBox = new CheckBox(propertyMap.get(BatchFolderListDTO.FOLDER_NAME)); checkBox.setName(propertyMap.get(BatchFolderListDTO.FOLDER_NAME)); checkBox.setFormValue(propertyMap.get(BatchFolderListDTO.FOLDER_NAME)); checkBox.setEnabled(Boolean.parseBoolean(propertyMap.get(BatchFolderListDTO.ENABLED))); checkBox.setChecked(Boolean.parseBoolean(propertyMap.get(BatchFolderListDTO.CHECKED))); horizontalPanel.add(checkBox); exportBatchClassViewPanel.add(horizontalPanel); }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.file.NewFileDialog.java
License:Open Source License
private HorizontalPanel createGitAddCheclBox() { Label label = new Label(""); CheckBox checkbox = new CheckBox("Add To GIT"); checkbox.setValue(true);//from w w w . j a v a 2 s .co m checkbox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { addToGIT = ((CheckBox) event.getSource()).getValue(); } }); return createHorizontalHolder(checkbox, label); }
From source file:com.google.api.explorer.client.parameter.schema.FieldsEditor.java
License:Apache License
public FieldsEditor(ApiService service, String key) { super(""); this.service = service; this.key = key; root = new CheckBox(key.isEmpty() ? "Select all/none" : key); root.setValue(false);//from www . ja va 2 s. c om root.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { for (HasValue<Boolean> checkBox : children.values()) { checkBox.setValue(event.getValue(), true); } } }); add(root); }
From source file:com.google.api.explorer.client.parameter.schema.FieldsEditor.java
License:Apache License
/** * Sets the properties this field will have, if it is an object. *//*from w w w. j a va2s. co m*/ public void setProperties(Map<String, Schema> properties) { List<String> keys = Lists.newArrayList(properties.keySet()); Collections.sort(keys); HTMLPanel inner = new HTMLPanel(""); inner.getElement().getStyle().setPaddingLeft(20, Unit.PX); for (String childKey : keys) { final Schema property = properties.get(childKey); final Map<String, Schema> childProperties = property.getProperties(); final Schema items = property.getItems(); if (childProperties == null && items == null) { // This is a simple field CheckBox checkBox = new CheckBox(childKey); checkBox.setValue(root.getValue()); checkBox.setTitle(property.getDescription()); children.put(childKey, checkBox); checkBox.getElement().appendChild(Document.get().createBRElement()); inner.add(checkBox); } else { final FieldsEditor editor = new FieldsEditor(service, childKey); children.put(childKey, editor); inner.add(editor); if (childProperties != null) { editor.setProperties(childProperties); } else if (property.getRef() != null) { editor.setRef(property.getRef()); } else if (items != null) { if (items.getProperties() != null) { editor.setProperties(items.getProperties()); } else if (items.getRef() != null) { editor.setRef(items.getRef()); } } } } add(inner); }
From source file:com.google.appinventor.client.editor.simple.SimpleVisibleComponentsPanel.java
License:Open Source License
/** * Creates new component design panel for visible components. * * @param nonVisibleComponentsPanel corresponding panel for non-visible * components *///ww w .ja va 2 s . c o m public SimpleVisibleComponentsPanel(final SimpleEditor editor, SimpleNonVisibleComponentsPanel nonVisibleComponentsPanel) { this.nonVisibleComponentsPanel = nonVisibleComponentsPanel; projectEditor = editor.getProjectEditor(); // Initialize UI phoneScreen = new VerticalPanel(); phoneScreen.setStylePrimaryName("ode-SimpleFormDesigner"); checkboxShowHiddenComponents = new CheckBox(MESSAGES.showHiddenComponentsCheckbox()) { @Override protected void onLoad() { // onLoad is called immediately after a widget becomes attached to the browser's document. boolean showHiddenComponents = Boolean.parseBoolean( projectEditor.getProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_SHOW_HIDDEN_COMPONENTS)); checkboxShowHiddenComponents.setValue(showHiddenComponents); } }; checkboxShowHiddenComponents.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean projectEditor.changeProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_SHOW_HIDDEN_COMPONENTS, isChecked ? "True" : "False"); if (form != null) { form.refresh(); } } }); phoneScreen.add(checkboxShowHiddenComponents); checkboxPhoneTablet = new CheckBox(MESSAGES.previewPhoneSize()) { @Override protected void onLoad() { // onLoad is called immediately after a widget becomes attached to the browser's document. boolean showPhoneTablet = Boolean.parseBoolean( projectEditor.getProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_PHONE_TABLET)); checkboxPhoneTablet.setValue(showPhoneTablet); changeFormPreviewSize(showPhoneTablet); } }; checkboxPhoneTablet.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean isChecked = event.getValue(); // auto-unbox from Boolean to boolean projectEditor.changeProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS, SettingsConstants.YOUNG_ANDROID_SETTINGS_PHONE_TABLET, isChecked ? "True" : "False"); changeFormPreviewSize(isChecked); } }); phoneScreen.add(checkboxPhoneTablet); initWidget(phoneScreen); }
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
/** * Possibly display the MIT App Inventor "Splash Screen" * * @param force Bypass the check to see if they have dimissed this version *///from w w w . j a va2 s.co m private void createWelcomeDialog(boolean force) { if (!shouldShowWelcomeDialog() && !force) { openProjectsTab(); return; } // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.createWelcomeDialogText()); dialogBox.setHeight(splashConfig.height + "px"); dialogBox.setWidth(splashConfig.width + "px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(splashConfig.content); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button ok = new Button(MESSAGES.createWelcomeDialogButton()); final CheckBox noshow = new CheckBox(MESSAGES.doNotShow()); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); if (noshow.getValue()) { // User checked the box userSettings.getSettings(SettingsConstants.SPLASH_SETTINGS).changePropertyValue( SettingsConstants.SPLASH_SETTINGS_VERSION, "" + splashConfig.version); userSettings.saveSettings(null); } openProjectsTab(); } }); holder.add(ok); holder.add(noshow); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
From source file:com.google.caliper.cloud.client.BenchmarkDataViewer.java
License:Apache License
private CheckBox newShownCheckbox(final Value value) { CheckBox isShown = new CheckBox(value.getLabel()); isShown.setValue(value.isShown());// w ww. j a va 2 s .c om isShown.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { value.setShown(!value.isShown()); rebuildIndex(); rebuildValueIndices(); rebuildCValues(); rebuildResultsTable(); if (editable) { Map<String, Map<String, Boolean>> variableValuesShown = variableValuesShown(); BenchmarkServiceAsync benchmarkService = GWT.create(BenchmarkService.class); benchmarkService.setVariableValuesShown(benchmarkOwner, benchmarkName, variableValuesShown, NO_OP_CALLBACK); } } }); return isShown; }
From source file:com.google.gerrit.client.account.MyPreferencesScreen.java
License:Apache License
@Override protected void onInitUI() { super.onInitUI(); showSiteHeader = new CheckBox(Util.C.showSiteHeader()); useFlashClipboard = new CheckBox(Util.C.useFlashClipboard()); copySelfOnEmails = new CheckBox(Util.C.copySelfOnEmails()); reversePatchSetOrder = new CheckBox(Util.C.reversePatchSetOrder()); showUsernameInReviewCategory = new CheckBox(Util.C.showUsernameInReviewCategory()); maximumPageSize = new ListBox(); for (final short v : PAGESIZE_CHOICES) { maximumPageSize.addItem(Util.M.rowsPerPage(v), String.valueOf(v)); }// w w w. jav a 2s.co m commentVisibilityStrategy = new ListBox(); commentVisibilityStrategy.addItem(com.google.gerrit.client.changes.Util.C.messageCollapseAll(), AccountGeneralPreferences.CommentVisibilityStrategy.COLLAPSE_ALL.name()); commentVisibilityStrategy.addItem(com.google.gerrit.client.changes.Util.C.messageExpandMostRecent(), AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_MOST_RECENT.name()); commentVisibilityStrategy.addItem(com.google.gerrit.client.changes.Util.C.messageExpandRecent(), AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT.name()); commentVisibilityStrategy.addItem(com.google.gerrit.client.changes.Util.C.messageExpandAll(), AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_ALL.name()); Date now = new Date(); dateFormat = new ListBox(); for (AccountGeneralPreferences.DateFormat fmt : AccountGeneralPreferences.DateFormat.values()) { StringBuilder r = new StringBuilder(); r.append(DateTimeFormat.getFormat(fmt.getShortFormat()).format(now)); r.append(" ; "); r.append(DateTimeFormat.getFormat(fmt.getLongFormat()).format(now)); dateFormat.addItem(r.toString(), fmt.name()); } timeFormat = new ListBox(); for (AccountGeneralPreferences.TimeFormat fmt : AccountGeneralPreferences.TimeFormat.values()) { StringBuilder r = new StringBuilder(); r.append(DateTimeFormat.getFormat(fmt.getFormat()).format(now)); timeFormat.addItem(r.toString(), fmt.name()); } FlowPanel dateTimePanel = new FlowPanel(); final int labelIdx, fieldIdx; if (LocaleInfo.getCurrentLocale().isRTL()) { labelIdx = 1; fieldIdx = 0; dateTimePanel.add(timeFormat); dateTimePanel.add(dateFormat); } else { labelIdx = 0; fieldIdx = 1; dateTimePanel.add(dateFormat); dateTimePanel.add(timeFormat); } relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable()); final Grid formGrid = new Grid(9, 2); int row = 0; formGrid.setText(row, labelIdx, ""); formGrid.setWidget(row, fieldIdx, showSiteHeader); row++; formGrid.setText(row, labelIdx, ""); formGrid.setWidget(row, fieldIdx, useFlashClipboard); row++; formGrid.setText(row, labelIdx, ""); formGrid.setWidget(row, fieldIdx, copySelfOnEmails); row++; formGrid.setText(row, labelIdx, ""); formGrid.setWidget(row, fieldIdx, reversePatchSetOrder); row++; formGrid.setText(row, labelIdx, ""); formGrid.setWidget(row, fieldIdx, showUsernameInReviewCategory); row++; formGrid.setText(row, labelIdx, Util.C.maximumPageSizeFieldLabel()); formGrid.setWidget(row, fieldIdx, maximumPageSize); row++; formGrid.setText(row, labelIdx, Util.C.dateFormatLabel()); formGrid.setWidget(row, fieldIdx, dateTimePanel); row++; formGrid.setText(row, labelIdx, ""); formGrid.setWidget(row, fieldIdx, relativeDateInChangeTable); row++; formGrid.setText(row, labelIdx, Util.C.commentVisibilityLabel()); formGrid.setWidget(row, fieldIdx, commentVisibilityStrategy); row++; add(formGrid); save = new Button(Util.C.buttonSaveChanges()); save.setEnabled(false); save.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { doSave(); } }); add(save); final OnEditEnabler e = new OnEditEnabler(save); e.listenTo(showSiteHeader); e.listenTo(useFlashClipboard); e.listenTo(copySelfOnEmails); e.listenTo(reversePatchSetOrder); e.listenTo(showUsernameInReviewCategory); e.listenTo(maximumPageSize); e.listenTo(dateFormat); e.listenTo(timeFormat); e.listenTo(relativeDateInChangeTable); e.listenTo(commentVisibilityStrategy); }