List of usage examples for com.google.gwt.user.client.ui CheckBox addValueChangeHandler
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler)
From source file:com.risevision.ui.client.common.widgets.RiseMultiSelectWidget.java
License:Open Source License
public void addOther() { CheckBox itemCheckBox = new CheckBox(); itemCheckBox.addValueChangeHandler(this); // itemCheckBox.setStyleName("rdn-CheckBox"); Label nameLabel = new Label("Other:"); nameLabel.setStyleName("rva-ShortText"); nameLabel.getElement().getStyle().setProperty("whiteSpace", "nowrap"); otherTextBox = new TextBox(); HorizontalPanel checkBoxPanel = new HorizontalPanel(); checkBoxPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); checkBoxPanel.add(itemCheckBox);/*from ww w . java2 s .com*/ checkBoxPanel.add(new SpacerWidget()); checkBoxPanel.add(nameLabel); checkBoxPanel.add(new SpacerWidget()); checkBoxPanel.add(otherTextBox); listPanel.add(checkBoxPanel); checkBoxList.add(itemCheckBox); valuesList.add(null); }
From source file:com.square.composant.fusion.square.client.composants.BlocChampsPersonneFusion.java
License:Open Source License
/** * Ajoute un champ de la source dans le bloc des proprits fusionner. * @param row la ligne o ajouter le champ. * @param label le label du champ.// w w w .jav a2 s .c o m * @param lChamp la valeur du champ. * @param champ le champ. * @param styleLigne le style de la ligne. * @return le style de la ligne */ private String ajouterChampSourceBlocFusion(int row, Label label, Label lChamp, final ProprieteFusionnableModel champ, String styleLigne) { String style = styleLigne; ftProprietes.setWidget(row, 0, label); ftProprietes.setWidget(row, 1, lChamp); if (champ.getIsSelectionnable() != null && champ.getIsSelectionnable()) { final CheckBox cb = new CheckBox(); cb.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (cb.getValue() != null && cb.getValue()) { champ.setAFusionner(true); nbChampsSelectionnesPourFusion++; if (nbChampsSelectionnesPourFusion == nbChampsFusionnables) { btnSelection.setText(composantConstants.btnRienSelectionner()); } } else { champ.setAFusionner(false); nbChampsSelectionnesPourFusion--; if (nbChampsSelectionnesPourFusion != nbChampsFusionnables) { btnSelection.setText(composantConstants.btnToutSelectionner()); } } } }); ftProprietes.setWidget(row, 2, cb); ftProprietes.getFlexCellFormatter().setHorizontalAlignment(row, 2, ALIGN_CENTER); } // Dfinition du style pour alterner ligne sombre et ligne claire if (ComposantFusionPresenter.RESOURCES.css().cellClair().equals(style)) { style = ComposantFusionPresenter.RESOURCES.css().cellClair(); } else { style = ComposantFusionPresenter.RESOURCES.css().cellSombre(); } ftProprietes.getCellFormatter().addStyleName(row, 0, style); ftProprietes.getCellFormatter().addStyleName(row, 1, style); ftProprietes.getCellFormatter().addStyleName(row, 2, style); ftProprietes.getCellFormatter().setHeight(row, 0, BlocChampsPersonneFusionConstants.HAUTEUR_LIGNES_PROPRIETES); ftProprietes.getCellFormatter().setHeight(row, 1, BlocChampsPersonneFusionConstants.HAUTEUR_LIGNES_PROPRIETES); ftProprietes.getCellFormatter().setHeight(row, 2, BlocChampsPersonneFusionConstants.HAUTEUR_LIGNES_PROPRIETES); nbChampsFusionnables++; return style; }
From source file:com.tasktop.c2c.server.profile.web.ui.client.presenter.components.TeamMemberPresenter.java
License:Open Source License
@Override public void onClick(ClickEvent event) { Object source = event.getSource(); if (source == view.rolesAnchor) { PopupPanel panel = WidgetUtil.createPopupPanel(view.rolesAnchor); panel.addAutoHidePartner(view.rolesAnchor.getElement()); VerticalPanel content = new VerticalPanel(); for (final ProjectRole role : ProjectRole.values()) { CheckBox checkbox = new CheckBox( projectRoleMessageSelector.getInternationalizedMessage(role, commonProfileMessages)); checkbox.setValue(member.getRoles().contains(role)); boolean enableChanges = true; if (role.equals(ProjectRole.MEMBER) || (role.equals(ProjectRole.OWNER) && self)) { enableChanges = false;//from w w w. ja v a 2s.c om } checkbox.setEnabled(enableChanges); if (enableChanges) { checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { member.getRoles().add(role); } else { member.getRoles().remove(role); } updateRoles(); } }); } content.add(checkbox); } panel.add(content); if (panel.isShowing()) { panel.showRelativeTo(view.rolesAnchor); } else { panel.hide(); } } else if (source == view.removeButton) { removeMember(); } }
From source file:com.tasktop.c2c.server.profile.web.ui.client.view.components.AdminProfileView.java
License:Open Source License
public AdminProfileView() { ProfileResources.get.style().ensureInjected(); // FIXME, put in a common place initWidget(uiBinder.createAndBindUi(this)); hideDisabled.setValue(true);/*from ww w . ja va 2s . c o m*/ hideNewsEmailOptOut.setValue(false); hideServiceEmailOptOut.setValue(false); hideUnverified.setValue(false); for (CheckBox box : Arrays.asList(hideDisabled, hideNewsEmailOptOut, hideServiceEmailOptOut, hideUnverified)) { box.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { applyFilters(); } }); } filterText.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { applyFilters(); } }); // HACK. Otherwise the header classname interferes with header styles in main-sb.css emailsPanel.getHeader().getElement().getParentElement().setClassName(""); driver.initialize(this); filterText.getElement().setAttribute("placeholder", "Search"); UIObject.setVisible(editProfileDiv, false); setupList(); }
From source file:com.tractionsoftware.gwt.demo.utcdatebox.client.UTCDateBoxDemo.java
License:Apache License
@Override public void onModuleLoad() { eventListBox = new ListBox(true); eventListBox.setVisibleItemCount(20); eventListBox.setWidth("800px"); RootPanel.get("eventlog").add(eventListBox); datebox = new DateBox(new DatePicker(), null, new DateBox.DefaultFormat(DateTimeFormat.getFormat("MMM dd, yyyy"))); datebox.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override/* ww w . ja va 2s .c om*/ public void onValueChange(ValueChangeEvent<Date> event) { addEvent("DateBox", event.getValue(), event.getValue().getTime()); } }); RootPanel.get("datebox").add(datebox); utcdatebox = new UTCDateBox(); utcdatebox.addValueChangeHandler(new ValueChangeHandler<Long>() { @Override public void onValueChange(ValueChangeEvent<Long> event) { addEvent("UTCDateBox", new Date(event.getValue()), event.getValue()); } }); RootPanel.get("utcdatebox").add(utcdatebox); CheckBox enabled = new CheckBox("Enabled"); enabled.setValue(true); RootPanel.get("utcdatebox-enabled").add(enabled); enabled.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { utcdatebox.setEnabled(event.getValue()); } }); }
From source file:com.tractionsoftware.gwt.demo.utctimebox.client.UTCTimeBoxDemo.java
License:Apache License
@Override public void onModuleLoad() { eventListBox = new ListBox(true); eventListBox.setVisibleItemCount(20); eventListBox.setWidth("800px"); RootPanel.get("eventlog").add(eventListBox); timebox = new UTCTimeBox(DateTimeFormat.getFormat("hh:mm a")); timebox.addValueChangeHandler(new ValueChangeHandler<Long>() { @Override// w ww . j av a2s. c o m public void onValueChange(ValueChangeEvent<Long> event) { addEvent("UTCTimeBox", event.getValue()); } }); timebox.setValue(UTCTimeBox.getValueForNextHour()); RootPanel.get("utctimebox").add(timebox); CheckBox enabled = new CheckBox("Enabled"); enabled.setValue(true); RootPanel.get("utctimebox-enabled").add(enabled); enabled.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { timebox.setEnabled(event.getValue()); } }); }
From source file:de.metanome.frontend.client.datasources.FileInputEditForm.java
License:Apache License
/** * Create the CheckBox that triggers the display/hiding of advanced CSV configuration parameters * * @return the CheckBox with the mentioned behavior *//*from w w w . ja v a2 s .c o m*/ protected CheckBox createAdvancedCheckbox() { CheckBox checkbox = new CheckBox("Use Advanced Configuration"); checkbox.setValue(false); checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { advancedTable.setVisible(advancedCheckbox.getValue()); } }); return checkbox; }
From source file:de.swm.commons.mobile.client.widgets.CheckBoxGroup.java
License:Apache License
@Override public void add(Widget w) { assert w instanceof CheckBox : "Can only contain CheckBox widgets in CheckBoxGroup"; CheckBox checkbox = (CheckBox) w; myFlowPanel.add(checkbox);//from w ww. ja v a2 s .c o m checkbox.addValueChangeHandler(this); }
From source file:edu.caltech.ipac.firefly.visualize.ui.WebLayerControlPopup.java
private void addLayer(final WebLayerItem item) { if (lastBottomWidget != null) { GwtUtil.setStyles(lastBottomWidget, "borderBottom", "1px solid rgba(0,0,0,.3)", "marginBottom", "7px"); }//ww w. j ava 2 s. c o m int activeRow = _layerTable.getRowCount(); _panel.showWidget(LAYERS); String name = _prop.getName("on") + " " + item.getTitle(); String tip = _prop.getTip("on") + " " + item.getTitle(); final CheckBox cb = GwtUtil.makeCheckBox(name, tip, true); DOM.setStyleAttribute(cb.getElement(), "paddingRight", "15px"); cb.setValue(item.isVisible()); cb.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> ev) { item.setVisible(cb.getValue()); } }); item.addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> ev) { cb.setHTML(_prop.getName("on") + " " + item.getTitle()); } }); item.getPlotView().addListener(Name.LAYER_ITEM_VISIBLE, new WebEventListener() { public void eventNotify(WebEvent ev) { if (ev.getSource() == item) { boolean v = (Boolean) ev.getData(); if (v != cb.getValue()) cb.setValue(v); } } }); Label colorFeedback = new Label(); _layerTable.setWidget(activeRow, ON_COL, cb); if (item.getHasColorSetting()) { _layerTable.setWidget(activeRow, COLOR_FEEDBACK, colorFeedback); _layerTable.setWidget(activeRow, COLOR_COL, makeChangeColorLink(colorFeedback, item)); } Widget userDefined = item.makeUserDefinedColUI(); if (userDefined != null) { _layerTable.setWidget(activeRow, USER_DEFINED_COL, userDefined); } if (item.getHasDelete()) { // int column= item.getHasColorSetting() ? DELETE_COL : COLOR_COL; _layerTable.setWidget(activeRow, DELETE_COL, makeDeleteLink(item)); } if (item.getHasDetails()) { _layerTable.setWidget(activeRow, DETAILS_COL, makeDetailsLink(item)); } // _layerTable.setWidget(rowCnt,HELP_COL,makeHelpLink(item)); activeRow++; Widget extra = item.makeExtraUI(); if (extra != null) { SimplePanel panel = new SimplePanel(); panel.setWidget(extra); DOM.setStyleAttribute(panel.getElement(), "padding", "0 0 0 25px"); _layerTable.setWidget(activeRow, 0, panel); _layerTable.getFlexCellFormatter().setColSpan(activeRow, 0, 4); activeRow++; } if (item.isUsingSubgroups()) { SimplePanel panel = new SimplePanel(); DOM.setStyleAttribute(panel.getElement(), "padding", "0 0 0 25px"); _layerTable.setWidget(activeRow, 0, panel); SimpleInputField field = GwtUtil.createRadioBox("Overlay", sgOps, getCheckBoxValue(item.getSubgroupVisibility()), true); panel.setWidget(field); _layerTable.getFlexCellFormatter().setColSpan(activeRow, 0, 4); activeRow++; field.getField().addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> ev) { item.setVisible(getLevel(ev.getValue())); } }); } String helpStr = item.getHelp(); if (helpStr == null) helpStr = ""; // Label help= new Label(); HTML help = new HTML(); help.setHTML(helpStr); DOM.setStyleAttribute(help.getElement(), "padding", "2px 0 2px 25px"); DOM.setStyleAttribute(help.getElement(), "fontSize", "90%"); help.addStyleName(_ffCss.fadedText()); _layerTable.setWidget(activeRow, 0, help); _layerTable.getFlexCellFormatter().setColSpan(activeRow, 0, 3); lastBottomWidget = help; _layerMap.put(cb, item); }
From source file:eml.studio.client.ui.panel.HistoryPopupPanel.java
License:Open Source License
/** * Paging data loading//www . j av a2 s . c om * * @param currentPage current page number */ public void pageLoader(final int currentPage) { logger.info("current page=" + currentPage); final int startIndex = (currentPage - 1) * everyPageSize; int endIndex = startIndex; if (currentPage == totalPage) endIndex = totalRecords; else endIndex = startIndex + everyPageSize; final int size = endIndex - startIndex; pageChkBox = new HashMap<String, CheckBox>(); jobSrv.getRefOozieJobPage(bdaJobId, startIndex, size, startTime, endTime, new AsyncCallback<List<OozieJob>>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub logger.warning( "The paging data of run history records loading failed! Page=" + currentPage); } @Override public void onSuccess(final List<OozieJob> result) { // TODO Auto-generated method stub if (result != null) { curPageRealSize = result.size(); logger.info("start=" + startIndex + ";end=" + (startIndex + size) + ";curSize = " + result.size()); pageGrid.addStyleName("run-history-page"); clearHistoryGridData(); for (int i = 0; i < result.size(); i++) { final OozieJob oozieJob = result.get(i); runHistoryGrid.setText(i + 1, 0, oozieJob.getAppName()); runHistoryGrid.setText(i + 1, 1, oozieJob.getStatus()); runHistoryGrid.setText(i + 1, 2, oozieJob.getAccount()); runHistoryGrid.setText(i + 1, 3, oozieJob.getDescription()); if (oozieJob.getCreatedTime() == null) runHistoryGrid.setText(i + 1, 4, ""); else runHistoryGrid.setText(i + 1, 4, formatter.format(oozieJob.getCreatedTime())); if (oozieJob.getEndTime() == null) runHistoryGrid.setText(i + 1, 5, ""); else runHistoryGrid.setText(i + 1, 5, formatter.format(oozieJob.getEndTime())); final HorizontalPanel optPanel = new HorizontalPanel(); Label historyViewLabel = new Label(); historyViewLabel.setTitle(Constants.studioUIMsg.historyView()); historyViewLabel.addStyleName("run-history-view"); historyViewLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub HistoryPopupPanel.this.hide(); String message = bdaJobId + "&instance=" + oozieJob.getId(); goToOozInstance(oozieJob.getId(), message); } }); Label deleteLabel = new Label(); deleteLabel.setTitle(Constants.studioUIMsg.historyDelete()); deleteLabel.setStyleName("run-history-delete"); deleteLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub if (result.size() == 1 && totalPage == 1) //Only one page and only include one record Window.alert("There has only one record, can't be deleted!"); else { final DeletePanel deletePanel = new DeletePanel(); deletePanel.setContent("Sure to delete this history record?"); deletePanel.show(); deletePanel.getConfirmBtn().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub deleteOozJob(oozieJob.getId()); deletePanel.hide(); } }); } } }); CheckBox delChkBox = null; if (totalViewChkBox.containsKey(oozieJob.getId())) delChkBox = totalViewChkBox.get(oozieJob.getId()); else { delChkBox = new CheckBox(); delChkBox.setStyleName("run-history-record-chk-box"); delChkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { // TODO Auto-generated method stub if (event.getValue()) { delOozieJobs.add(oozieJob.getId()); } else { if (delOozieJobs.contains(oozieJob.getId())) delOozieJobs.remove(oozieJob.getId()); } } }); totalViewChkBox.put(oozieJob.getId(), delChkBox); } pageChkBox.put(oozieJob.getId(), delChkBox); if (selectAllChkBox.isVisible()) delChkBox.setVisible(true); else delChkBox.setVisible(false); optPanel.add(historyViewLabel); if (isExample && !AppController.power.equals("111")) { } else optPanel.add(deleteLabel); optPanel.add(delChkBox); runHistoryGrid.setWidget(i + 1, 6, optPanel); } } } }); }