List of usage examples for com.google.gwt.user.client.ui CheckBox getValue
@Override
public Boolean getValue()
From source file:com.vaadin.client.ui.VOptionGroup.java
License:Apache License
@Override public void onClick(ClickEvent event) { super.onClick(event); if (event.getSource() instanceof CheckBox) { CheckBox source = (CheckBox) event.getSource(); if (!source.isEnabled()) { // Click events on the text are received even though the // checkbox is disabled return; }//from w w w .j av a 2 s.co m if (BrowserInfo.get().isWebkit()) { // Webkit does not focus non-text input elements on click // (#11854) source.setFocus(true); } final boolean selected = source.getValue(); final String key = optionsToKeys.get(source); if (!isMultiselect()) { selectedKeys.clear(); } if (selected) { selectedKeys.add(key); } else { selectedKeys.remove(key); } client.updateVariable(paintableId, "selected", getSelectedItems(), isImmediate()); } }
From source file:com.vaadin.client.VDebugConsole.java
License:Apache License
private void printClientSideDetectedIssues(Set<ComponentConnector> zeroHeightComponents, ApplicationConnection ac) {//ww w . ja v a2 s .c o m for (final ComponentConnector paintable : zeroHeightComponents) { final ServerConnector parent = paintable.getParent(); VerticalPanel errorDetails = new VerticalPanel(); errorDetails .add(new Label("" + Util.getSimpleName(paintable) + " inside " + Util.getSimpleName(parent))); if (parent instanceof ComponentConnector) { ComponentConnector parentComponent = (ComponentConnector) parent; final Widget layout = parentComponent.getWidget(); final CheckBox emphasisInUi = new CheckBox( "Emphasize components parent in UI (the actual component is not visible)"); emphasisInUi.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Element element2 = layout.getElement(); Widget.setStyleName(element2, "invalidlayout", emphasisInUi.getValue().booleanValue()); } }); errorDetails.add(emphasisInUi); } panel.add(errorDetails); } }
From source file:com.vaadin.client.VDebugConsole.java
License:Apache License
private void printLayoutError(ValueMap valueMap, SimpleTree root, final ApplicationConnection ac) { final String pid = valueMap.getString("id"); final ComponentConnector paintable = (ComponentConnector) ConnectorMap.get(ac).getConnector(pid); SimpleTree errorNode = new SimpleTree(); VerticalPanel errorDetails = new VerticalPanel(); errorDetails.add(new Label(Util.getSimpleName(paintable) + " id: " + pid)); if (valueMap.containsKey("heightMsg")) { errorDetails.add(new Label("Height problem: " + valueMap.getString("heightMsg"))); }/* w w w . j a v a2 s. c om*/ if (valueMap.containsKey("widthMsg")) { errorDetails.add(new Label("Width problem: " + valueMap.getString("widthMsg"))); } final CheckBox emphasisInUi = new CheckBox("Emphasize component in UI"); emphasisInUi.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (paintable != null) { Element element2 = paintable.getWidget().getElement(); Widget.setStyleName(element2, "invalidlayout", emphasisInUi.getValue()); } } }); errorDetails.add(emphasisInUi); errorNode.add(errorDetails); if (valueMap.containsKey("subErrors")) { HTML l = new HTML("<em>Expand this node to show problems that may be dependent on this problem.</em>"); errorDetails.add(l); JsArray<ValueMap> suberrors = valueMap.getJSValueMapArray("subErrors"); for (int i = 0; i < suberrors.length(); i++) { ValueMap value = suberrors.get(i); printLayoutError(value, errorNode, ac); } } root.add(errorNode); }
From source file:com.vaadin.terminal.gwt.client.VDebugConsole.java
License:Open Source License
private void printClientSideDetectedIssues(Set<Paintable> zeroHeightComponents, ApplicationConnection ac) { for (final Paintable paintable : zeroHeightComponents) { final Container layout = Util.getLayout((Widget) paintable); VerticalPanel errorDetails = new VerticalPanel(); errorDetails//from w w w .ja va 2 s . com .add(new Label("" + Util.getSimpleName(paintable) + " inside " + Util.getSimpleName(layout))); final CheckBox emphasisInUi = new CheckBox( "Emphasize components parent in UI (the actual component is not visible)"); emphasisInUi.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (paintable != null) { Element element2 = ((Widget) layout).getElement(); Widget.setStyleName(element2, "invalidlayout", emphasisInUi.getValue()); } } }); errorDetails.add(emphasisInUi); panel.add(errorDetails); } }
From source file:com.vaadin.terminal.gwt.client.VDebugConsole.java
License:Open Source License
private void printLayoutError(ValueMap valueMap, SimpleTree root, final ApplicationConnection ac) { final String pid = valueMap.getString("id"); final Paintable paintable = ac.getPaintable(pid); SimpleTree errorNode = new SimpleTree(); VerticalPanel errorDetails = new VerticalPanel(); errorDetails.add(new Label(Util.getSimpleName(paintable) + " id: " + pid)); if (valueMap.containsKey("heightMsg")) { errorDetails.add(new Label("Height problem: " + valueMap.getString("heightMsg"))); }/*from www.j a v a 2s .c o m*/ if (valueMap.containsKey("widthMsg")) { errorDetails.add(new Label("Width problem: " + valueMap.getString("widthMsg"))); } final CheckBox emphasisInUi = new CheckBox("Emphasize component in UI"); emphasisInUi.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (paintable != null) { Element element2 = ((Widget) paintable).getElement(); Widget.setStyleName(element2, "invalidlayout", emphasisInUi.getValue()); } } }); errorDetails.add(emphasisInUi); errorNode.add(errorDetails); if (valueMap.containsKey("subErrors")) { HTML l = new HTML("<em>Expand this node to show problems that may be dependent on this problem.</em>"); errorDetails.add(l); JsArray<ValueMap> suberrors = valueMap.getJSValueMapArray("subErrors"); for (int i = 0; i < suberrors.length(); i++) { ValueMap value = suberrors.get(i); printLayoutError(value, errorNode, ac); } } root.add(errorNode); }
From source file:cz.fi.muni.xkremser.editor.client.view.window.AddAltoOcrWindow.java
License:Open Source License
public AddAltoOcrWindow(final ListGridRecord listGridRecord, final LangConstants lang, final DispatchAsync dispatcher, EventBus eventBus) { super(630, 600, "ALTO", eventBus, 50); this.lang = lang; HLayout mainLayout = new HLayout(2); final VLayout altoLayout = new VLayout(3); VLayout ocrLayout = new VLayout(3); final Label altoLabel = new Label(); altoLabel.setContents(HtmlCode.title(lang.choose() + " ALTO", 3)); altoLabel.setAutoHeight();/*w w w.j av a 2s .com*/ altoLabel.setExtraSpace(8); final Label ocrLabel = new Label(); ocrLabel.setContents(HtmlCode.title(lang.choose() + " OCR", 3)); ocrLabel.setAutoHeight(); ocrLabel.setExtraSpace(8); foundAltoFilesGrid = new ListGrid(); foundAltoFilesGrid.setWidth(270); foundAltoFilesGrid.setHeight(400); foundAltoFilesGrid.setShowSortArrow(SortArrow.CORNER); foundAltoFilesGrid.setShowAllRecords(true); foundAltoFilesGrid.setExtraSpace(10); foundAltoFilesGrid.setSelectionType(SelectionStyle.SINGLE); foundOcrFilesGrid = new ListGrid(); foundOcrFilesGrid.setWidth(270); foundOcrFilesGrid.setHeight(400); foundOcrFilesGrid.setShowSortArrow(SortArrow.CORNER); foundOcrFilesGrid.setShowAllRecords(true); foundOcrFilesGrid.setExtraSpace(10); foundOcrFilesGrid.setSelectionType(SelectionStyle.SINGLE); ModalWindow mw = new ModalWindow(mainLayout); mw.setLoadingIcon("loadingAnimation.gif"); mw.show(true); final CheckBox noAnyALTO = new CheckBox(lang.noAny() + " ALTO"); noAnyALTO.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() { @Override public void onClick(com.google.gwt.event.dom.client.ClickEvent event) { if (noAnyALTO.getValue()) { foundAltoFilesGrid.disable(); foundAltoFilesGrid.setOpacity(60); altoLabel.setOpacity(60); } else { foundAltoFilesGrid.enable(); foundAltoFilesGrid.setOpacity(100); altoLabel.setOpacity(100); } } }); final CheckBox noAnyOCR = new CheckBox(lang.noAny() + " OCR"); noAnyOCR.addClickHandler(new com.google.gwt.event.dom.client.ClickHandler() { @Override public void onClick(com.google.gwt.event.dom.client.ClickEvent event) { if (noAnyOCR.getValue()) { foundAltoFilesGrid.disable(); foundOcrFilesGrid.disable(); foundOcrFilesGrid.setOpacity(60); noAnyALTO.setEnabled(false); altoLayout.setOpacity(60); ocrLabel.setOpacity(60); } else { foundAltoFilesGrid.enable(); foundOcrFilesGrid.enable(); foundOcrFilesGrid.setOpacity(100); noAnyALTO.setEnabled(true); altoLayout.setOpacity(100); ocrLabel.setOpacity(100); } } }); HLayout buttonsLayout = new HLayout(2); buttonsLayout.setAlign(Alignment.RIGHT); buttonsLayout.setWidth100(); Button okButton = new Button("Ok"); okButton.setExtraSpace(8); buttonsLayout.addMember(okButton); okButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!noAnyOCR.getValue()) { if (!noAnyALTO.getValue()) { doSaveAction(listGridRecord, foundAltoFilesGrid.getSelectedRecord(), foundOcrFilesGrid.getSelectedRecord()); } else { doSaveAction(listGridRecord, null, foundOcrFilesGrid.getSelectedRecord()); } } else { doSaveAction(listGridRecord, null, null); } } }); Button closeButton = new Button(lang.close()); closeButton.setExtraSpace(10); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); buttonsLayout.addMember(closeButton); altoLayout.addMember(altoLabel); altoLayout.addMember(foundAltoFilesGrid); altoLayout.addMember(noAnyALTO); ocrLayout.addMember(ocrLabel); ocrLayout.addMember(foundOcrFilesGrid); ocrLayout.addMember(noAnyOCR); mainLayout.addMember(altoLayout); mainLayout.addMember(ocrLayout); addItem(mainLayout); addItem(buttonsLayout); setEdgeOffset(20); findFiles(listGridRecord, dispatcher); centerInPage(); show(); focus(); mw.destroy(); }
From source file:cz.incad.kramerius.editor.client.view.SaveViewImpl.java
License:Open Source License
private boolean isSelected(Widget w) { if (w instanceof CheckBox) { CheckBox checkBox = (CheckBox) w; return checkBox.getValue(); } else if (w instanceof Label && !this.saveables.isEmpty()) { return true; }//from w w w.ja va 2 s . c o m return false; }
From source file:de.swm.commons.mobile.client.widgets.CheckBoxGroup.java
License:Apache License
@Override public void onClick(ClickEvent e) { final EventTarget target = e.getNativeEvent().getEventTarget(); String targetTagName = ((Element) target.cast()).getTagName().toUpperCase(); LOGGER.info("onClick target " + targetTagName); if (targetTagName.equals("LABEL") || targetTagName.equals("IMG")) { return; // if check box label or image is clicked, another (simulated) click event with // check box INPUT as target will fire after this one. So this click event // must be ignored. }//from w w w . j a v a2s . c o m Element div = Element.as(target); while (!div.getNodeName().toUpperCase().equals("SPAN") || div.getParentElement() != this.getElement()) { div = div.getParentElement(); if (div == null) { LOGGER.info("CheckBoxGroup onClick: span not found"); return; } } final int index = DOM.getChildIndex(this.getElement(), (com.google.gwt.user.client.Element) div); com.google.gwt.user.client.ui.CheckBox checkbox = (com.google.gwt.user.client.ui.CheckBox) myFlowPanel .getWidget(index); LOGGER.info("onClick " + checkbox.getValue()); if (targetTagName.equals("INPUT")) { LOGGER.info("onClick value changed"); checkbox.setValue(checkbox.getValue()); // if target is check box INPUT, check box value is // already changed when click event is fired. // just need to set its current value back to the check box // to update style. } else { checkbox.setValue(!checkbox.getValue()); } Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(index, target); fireEvent(selectionChangedEvent); } }); }
From source file:de.swm.commons.mobile.client.widgets.CheckBoxGroup.java
License:Apache License
/** * Returns the checked check box indices. * //from www .ja v a 2 s .c o m * @return the checked check box indices. */ public List<Integer> getCheckedIndices() { ArrayList<Integer> checkedList = new ArrayList<Integer>(myFlowPanel.getWidgetCount()); for (int i = 0; i < myFlowPanel.getWidgetCount(); i++) { com.google.gwt.user.client.ui.CheckBox radio = (com.google.gwt.user.client.ui.CheckBox) myFlowPanel .getWidget(i); if (radio.getValue()) { checkedList.add(i); } } return checkedList; }
From source file:de.swm.commons.mobile.client.widgets.CheckBoxGroup.java
License:Apache License
/** * Returns the checked check box widgets. All widgets are instances of * {@link com.google.gwt.user.client.ui.CheckBox} * /* ww w . j av a 2s . c om*/ * @return the checked check box widgets. */ public List<Widget> getCheckedWidgets() { ArrayList<Widget> checkedList = new ArrayList<Widget>(myFlowPanel.getWidgetCount()); for (int i = 0; i < myFlowPanel.getWidgetCount(); i++) { com.google.gwt.user.client.ui.CheckBox radio = (com.google.gwt.user.client.ui.CheckBox) myFlowPanel .getWidget(i); if (radio.getValue()) { checkedList.add(radio); } } return checkedList; }