List of usage examples for com.google.gwt.user.client.ui CheckBox getValue
@Override
public Boolean getValue()
From source file:com.google.sampling.experiential.client.InputsPanel.java
License:Open Source License
private void createRequiredCheckBoxColumn() { VerticalPanel mp = new VerticalPanel(); upperLinePanel.add(mp);//from w w w . j a v a 2 s .c om Label mandatoryLabel = new Label(myConstants.required() + ":"); mandatoryLabel.setStyleName("keyLabel"); mp.add(mandatoryLabel); final CheckBox valueBox = new CheckBox(); valueBox.setValue(input.getMandatory()); mp.add(valueBox); valueBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent arg0) { input.setMandatory(valueBox.getValue()); } }); }
From source file:com.google.sampling.experiential.client.ListChoicesPanel.java
License:Open Source License
/** * @param input/*from w ww. ja va 2 s. co m*/ */ public ListChoicesPanel(final InputDAO input) { this.input = input; mainPanel = new VerticalPanel(); mainPanel.setSpacing(2); initWidget(mainPanel); final CheckBox multiselect = new CheckBox("Multiple selections"); multiselect.setValue(input.getMultiselect()); multiselect.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { input.setMultiselect(multiselect.getValue()); } }); mainPanel.add(multiselect); Label lblSignalTimes = new Label("List Choice (s)"); lblSignalTimes.setStyleName("gwt-Label-Header"); mainPanel.add(lblSignalTimes); choicePanelsList = new LinkedList<ListChoicePanel>(); String[] choices = input.getListChoices(); if (choices == null || choices.length == 0) { ListChoicePanel choicePanel = new ListChoicePanel(this); String choice = choicePanel.getChoice(); choices = new String[] { choice }; mainPanel.add(choicePanel); choicePanelsList.add(choicePanel); input.setListChoices(choices); } else { for (int i = 0; i < choices.length; i++) { ListChoicePanel choicePanel = new ListChoicePanel(this); choicePanel.setChoice(choices[i]); mainPanel.add(choicePanel); choicePanelsList.add(choicePanel); } } }
From source file:com.google.sampling.experiential.client.SchedulePanel.java
License:Open Source License
private Widget createUserEditable(SignalScheduleDAO schedule2) { HorizontalPanel userEditablePanel = new HorizontalPanel(); userEditablePanel.setSpacing(2);/*from w w w.ja v a 2 s . c om*/ userEditablePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); userEditablePanel.setWidth(""); Label lblUserEditable = new Label("User Editable: "); lblUserEditable.setStyleName("gwt-Label-Header"); userEditablePanel.add(lblUserEditable); final CheckBox userEditableCheckBox = new CheckBox(""); userEditablePanel.add(userEditableCheckBox); userEditableCheckBox .setValue(schedule.getUserEditable() != null ? schedule.getUserEditable() : Boolean.TRUE); userEditableCheckBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { schedule.setUserEditable(userEditableCheckBox.getValue()); } }); return userEditablePanel; }
From source file:com.google.sampling.experiential.client.SchedulePanel.java
License:Open Source License
private Widget createUserEditableOnce(SignalScheduleDAO schedule2) { HorizontalPanel userEditablePanel = new HorizontalPanel(); userEditablePanel.setSpacing(2);//from w w w .ja v a2 s . c o m userEditablePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); userEditablePanel.setWidth(""); Label lblUserEditable = new Label("Only Editable on Join: "); lblUserEditable.setStyleName("gwt-Label-Header"); userEditablePanel.add(lblUserEditable); final CheckBox userEditableCheckBox = new CheckBox(""); userEditablePanel.add(userEditableCheckBox); userEditableCheckBox.setValue( schedule.getOnlyEditableOnJoin() != null ? schedule.getOnlyEditableOnJoin() : Boolean.FALSE); userEditableCheckBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { schedule.setOnlyEditableOnJoin(userEditableCheckBox.getValue()); } }); return userEditablePanel; }
From source file:com.google.zxing.web.generator.client.CalendarEventGenerator.java
License:Apache License
@Override public Grid getWidget() { if (table != null) { return table; }/*from w ww . ja va2 s. c om*/ 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; }
From source file:com.gwtm.ui.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(); Utils.Console("onClick target " + targetTagName); if (targetTagName.equals("LABEL")) { return; // if check box label is click, another (simulated) click event with // check box INPUT as target will fire after this one. So this click event // can be safely ignored. }//from www . java2 s.c o m Element div = Element.as(target); while (!div.getNodeName().toUpperCase().equals("SPAN") || div.getParentElement() != this.getElement()) { div = div.getParentElement(); if (div == null) { Utils.Console("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) getWidget(index); Utils.Console("onClick " + checkbox.getValue()); if (targetTagName.equals("INPUT")) { Utils.Console("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); ValueChangeEvent.fire(CheckBoxGroup.this, index); } }); }
From source file:com.gwtm.ui.client.widgets.CheckBoxGroup.java
License:Apache License
public ArrayList<Integer> getCheckedIndices() { ArrayList<Integer> checkedList = new ArrayList<Integer>(getWidgetCount()); for (int i = 0; i < getWidgetCount(); i++) { com.google.gwt.user.client.ui.CheckBox radio = (com.google.gwt.user.client.ui.CheckBox) getWidget(i); if (radio.getValue()) { checkedList.add(i);// www. j a va 2 s .com } } return checkedList; }
From source file:com.gwtm.ui.client.widgets.CheckBoxGroup.java
License:Apache License
public ArrayList<Widget> getCheckedWidgets() { ArrayList<Widget> checkedList = new ArrayList<Widget>(getWidgetCount()); for (int i = 0; i < getWidgetCount(); i++) { com.google.gwt.user.client.ui.CheckBox radio = (com.google.gwt.user.client.ui.CheckBox) getWidget(i); if (radio.getValue()) { checkedList.add(radio);// ww w .ja v a 2s. c o m } } return checkedList; }
From source file:com.gwtmobile.ui.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(); Utils.Console("onClick target " + targetTagName); if (targetTagName.equals("LABEL")) { return; // if check box label is click, another (simulated) click event with // check box INPUT as target will fire after this one. So this click event // can be safely ignored. }//from www.j a va 2 s . c o m Element div = Element.as(target); while (!div.getNodeName().toUpperCase().equals("SPAN") || div.getParentElement() != this.getElement()) { div = div.getParentElement(); if (div == null) { Utils.Console("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) getWidget(index); Utils.Console("onClick " + checkbox.getValue()); if (targetTagName.equals("INPUT")) { Utils.Console("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:com.ikon.frontend.client.widget.filebrowser.ExtendedScrollTable.java
License:Open Source License
/** * Sets the values in specifed row/column * Expects a Comparable Object for sorting * // ww w. jav a 2s .c om * Update indicates should be updated selected row otherside inserts new * * @param rows The actual table row * @param GWTFolder The folder */ public void addRow(GWTFolder folder, boolean update) { int col = 0; final int row = (update) ? getSelectedRow() : dataTable.getRowCount(); if (update) { data.put(new Integer(dataTable.getText(row, colDataIndex)), folder); } else { dataTable.insertRow(row); } // Sets folder object data.put(new Integer(dataIndexValue), folder); // Subscribed is a special case, must add icon with others if (profileFileBrowser.isStatusVisible()) { if (folder.isSubscribed()) { dataTable.setHTML(row, col, Util.imageItemHTML("img/icon/subscribed.gif")); } else { dataTable.setHTML(row, col, " "); } if (folder.isHasNotes()) { dataTable.setHTML(row, col, dataTable.getHTML(row, col) + Util.imageItemHTML("img/icon/note.gif")); } dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_RIGHT); } if (profileFileBrowser.isMassiveVisible()) { // Checkbox final CheckBox checkBox = new CheckBox(); checkBox.setStyleName("okm-CheckBox"); checkBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { oldMassiveSelected = massiveSelected.size(); if (checkBox.getValue()) { massiveSelected.add(new Integer(dataTable.getText(row, colDataIndex))); } else { massiveSelected.remove(new Integer(dataTable.getText(row, colDataIndex))); } } }); dataTable.setWidget(row, col, checkBox); dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER); } if (profileFileBrowser.isIconVisible()) { // Looks if must change icon on parent if now has no childs and properties with user security atention if ((folder.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) { if (folder.isHasChildren()) { dataTable.setHTML(row, col, Util.imageItemHTML("img/menuitem_childs.gif")); } else { dataTable.setHTML(row, col, Util.imageItemHTML("img/menuitem_empty.gif")); } } else { if (folder.isHasChildren()) { dataTable.setHTML(row, col, Util.imageItemHTML("img/menuitem_childs_ro.gif")); } else { dataTable.setHTML(row, col, Util.imageItemHTML("img/menuitem_empty_ro.gif")); } } dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER); } if (profileFileBrowser.isNameVisible()) { dataTable.setHTML(row, col, folder.getName()); dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_LEFT); } if (profileFileBrowser.isSizeVisible()) { dataTable.setHTML(row, col, " "); dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER); } if (profileFileBrowser.isLastModifiedVisible()) { DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern")); dataTable.setHTML(row, col, dtf.format(folder.getCreated())); dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER); } if (profileFileBrowser.isAuthorVisible()) { dataTable.setHTML(row, col, folder.getUser().getUsername()); dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER); } if (profileFileBrowser.isVersionVisible()) { dataTable.setHTML(row, col, " "); dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER); } if (!update) { dataTable.setHTML(row, colDataIndex, "" + (dataIndexValue++)); dataTable.getCellFormatter().setVisible(row, colDataIndex, false); } for (int i = 0; i < colDataIndex; i++) { dataTable.getCellFormatter().addStyleName(row, i, "okm-DisableSelect"); } }