private void setChecked(RadioButton button) { button.setValue(true); if (button == domButton) { setNewSelection(Selection.DOM); } else if (button == localXmlButton) { setNewSelection(Selection.LOCAL_XML); } else if (button == persistenDocumentButton){ setNewSelection(Selection.PERSISTENT_DOCUMENT); } else if (button == annotationButton){ setNewSelection(Selection.ANNOTATIONS); } else if (button == logButton){ setNewSelection(Selection.LOG); } else if (button == optionsButton) { setNewSelection(Selection.OPTIONS); } }
private void addSelectionHandler(final RadioButton radioButton) { radioButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { userList.setEnabled(false); moduleSelection.setValue(false); pluginSelection.setValue(false); userSelection.setValue(false); radioButton.setValue(true); if (userSelection.getValue()) { userList.setEnabled(true); } } }); }
@SuppressWarnings("deprecation") public RadioButtonDialogView(List<String> radioButtonText, String title) { super(); setWidget(BINDER.createAndBindUi(this)); setAnimationEnabled(true); setGlassEnabled(true); setText(title); setWidth("100%"); okButton.setText(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.OK_BUTTON)); cancelButton.setText(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.CANCEL_BUTTON)); if (null != radioButtonText && !radioButtonText.isEmpty()) { for (String text : radioButtonText) { RadioButton radioButton = new RadioButton("radioButtonGroup", text); if (radioButtonList == null) { radioButtonList = new ArrayList<RadioButton>(); } radioButtonList.add(radioButton); radioPanel.add(radioButton); } } if (!radioButtonList.isEmpty()) { radioButtonList.get(0).setChecked(true); } radioPanel.setSpacing(5); radioButtonDialogViewPanel.setSpacing(5); }
@UiHandler("okButton") protected void onOk(ClickEvent event) { int radioButtonNumber = -1; if (radioButtonList != null) { int index = 0; for (RadioButton radioButton : radioButtonList) { if (radioButton.isChecked()) { radioButtonNumber = index; break; } index++; } } listener.onOkClick(radioButtonNumber); hide(); }
/** * Inserts an item into the list box. * * @param item the text of the item to be inserted. * @param value the item's value. */ public void insertItem(String item, String value) { // create new widget final RadioButton radioButton = new RadioButton(optionsGroupName, item); // remove the default gwt-RadioButton style radioButton.removeStyleName("gwt-RadioButton"); // set value final InputElement inputElement = (InputElement) radioButton.getElement().getElementsByTagName("input").getItem(0); inputElement.removeAttribute("tabindex"); inputElement.setAttribute("value", value); // set default state if (defaultSelectedIndex > -1 && optionsPanel.getElement().getChildCount() == defaultSelectedIndex) { inputElement.setChecked(true); currentInputElement.setValue(""); } // add to widget optionsPanel.add(radioButton); }
/** * Inserts an item into the list box. * * @param item the text of the item to be inserted. * @param value the item's value. */ public void insertItem(String item, String value) { // create new widget final RadioButton radioButton = new RadioButton(optionsGroupName, item); // remove the default gwt-RadioButton style radioButton.removeStyleName("gwt-RadioButton"); // set value final InputElement inputElement = (InputElement) radioButton.getElement().getElementsByTagName("input").getItem(0); inputElement.removeAttribute("tabindex"); inputElement.setAttribute("value", value); // set default state if (defaultSelectedIndex > -1 && optionsPanel.getElement().getChildCount() == defaultSelectedIndex) { inputElement.setChecked(true); currentItemLabel.setInnerText(item); } // add to widget optionsPanel.add(radioButton); }
/** * Adds the new radio button to the group. * * @param label radio button's label * @param title radio button's tooltip * @param icon radio button's icon * @param clickHandler click handler */ public void addButton( String label, String title, @Nullable SVGResource icon, ClickHandler clickHandler) { final RadioButton radioButton = new RadioButton(GROUP_NAME, label); radioButton.setTitle(title); radioButton.setStyleName(resources.getCSS().button()); radioButton.addClickHandler(clickHandler); final Element radioButtonElement = radioButton.getElement(); final Node labelNode = radioButtonElement.getLastChild(); if (icon != null) { labelNode.insertFirst(new SVGImage(icon).getElement()); } else { radioButtonElement.getStyle().setWidth(90, PX); as(labelNode).getStyle().setWidth(90, PX); } mainPanel.add(radioButton); buttons.add(radioButton); }
public void onClick(ClickEvent event) { // Save current instance - you could just save the text to save // memory, but you might well want to add getters for other // attributes of the current instance if (event.getSource() instanceof RadioButton) { RadioButton rb = (RadioButton) event.getSource(); String key = DOM.getElementAttribute(rb.getElement(), "id"); if(key != null && key.length() > 0) { List<UIObject> components = ComponentRepository.getInstance().getComponent(key); for (UIObject object : components) { if (object == rb) { DOM.setElementAttribute(object.getElement(), "isSelected", "true"); } else { DOM.setElementAttribute(object.getElement(), "isSelected","false"); } } } } }
private void addItem(final int val, String imageSrc, String title, int col,String id) { final RadioButton button = new RadioButton(id); if (col==2) { button.setValue(true); } button.setTitle(title); ClickHandler handler = new ClickHandler() { public void onClick(ClickEvent event) { value = val; button.setValue(true); if (changeHandler != null) { changeHandler.onChange(null); } } }; button.addClickHandler(handler); Image image = new Image(imageSrc); image.setStyleName(PlayerStyles.CLICKABLE); image.setTitle(title); image.addClickHandler(handler); setWidget(0, col, image); getCellFormatter().setHorizontalAlignment(0, col, HasHorizontalAlignment.ALIGN_CENTER); setWidget(1, col, button); getCellFormatter().setHorizontalAlignment(1, col, HasHorizontalAlignment.ALIGN_CENTER); }
NestWidget() { boolean fFirst = true; for( Pair item : items ) { RadioButton radio = new RadioButton( groupName, item.text ); stream.addDown( radio ); radios.put( item.id, radio ); if( fFirst && fSelectFirstByDefault ) { fFirst = false; radio.setValue( true ); } } initWidget( stream ); }
/** * use {@link IneRadioButton#createRadioButtons(String, String...)} to * create objects */ private IneRadioButton(RadioGroup group, String name, String label) { this.group = group; rb = new RadioButton(name, label); initWidget(uiBinder.createAndBindUi(this)); rbIcon.setStyleName(style.rbIconStyle()); }
public KscCustomSelectionView() { m_vertPanel = new VerticalPanel(); m_vertPanel.setStyleName("onms-table-no-borders-margin"); m_submitButton = new Button("Submit"); m_viewRB = new RadioButton("group1", "View"); m_customizeRB = new RadioButton("group1","Customize"); m_createNewRB = new RadioButton("group1","Create New"); m_createNewExistingRB = new RadioButton("group1","Create New from Existing"); m_deleteRB = new RadioButton("group1","Delete"); m_vertPanel.add(m_viewRB); m_vertPanel.add(m_customizeRB); m_vertPanel.add(m_createNewRB); m_vertPanel.add(m_createNewExistingRB); m_vertPanel.add(m_deleteRB); m_vertPanel.add(m_submitButton); }
@Override public void setUserDataList(List<PacketUserData> userDataList) { panelUserCodeList.clear(); radioButtonToUserData = Maps.newHashMap(); for (PacketUserData userData : userDataList) { SafeUri imageUrl = UriUtils.fromString(Constant.ICON_URL_PREFIX + userData.imageFileName); SafeHtml label = TEMPLATE.image(imageUrl, userData.userCode, userData.playerName); RadioButton radioButton = new RadioButton(GROUP_USER_CODE, label); radioButtonToUserData.put(radioButton, userData); panelUserCodeList.add(radioButton); if (this.userData.getUserCode() == userData.userCode) { radioButton.setValue(true); } } }
/** * Create a new instance using a custom resource bundle. * * @param resource The custom resource bundle to use. */ public OptionsPrintPanel(PrintWidgetResource resource) { super(resource); UIBINDER.createAndBindUi(this); printButton.setEnabled(true); titleTextBox.getElement().setAttribute("placeholder", MESSAGES.printPrefsTitlePlaceholder()); // fill the pageSizeListBox for (String pageSizeName : PageSize.getAllNames()) { pageSizeListBox.addItem(pageSizeName); } // fill the postPrintActionRadioButtonMap postPrintActionRadioButtonMap = new HashMap<PrintConfiguration.PostPrintAction, RadioButton>(); for (PrintConfiguration.PostPrintAction postPrintAction : PrintConfiguration.PostPrintAction.values()) { RadioButton radioButton = new RadioButton("postPrintAction", Print.getInstance().getPrintUtil() .toString(postPrintAction)); postPrintActionRadioButtonMap.put(postPrintAction, radioButton); postPrintActionRadioGroup.add(radioButton); } createViewBasedOnConfiguration(); }
private RadioButton getRadioButton(final String name, int chunksToSet) { RadioButton r = new RadioButton("chunks", name); r.getElement().setAttribute("chunks", "" + chunksToSet); r.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Widget w = (Widget) event.getSource(); chunks = Integer.valueOf(w.getElement().getAttribute("chunks")); getMemoryStats(chunks); getCpuStats(chunks); getExtraData(chunks); } }); return r; }
public void addButton(int value, String text) { RadioButton button = new RadioButton(name, text); button.addClickHandler(clickHandler); Choice choice = new Choice(); choice.button = button; choice.text = text; choice.value = value; buttons.add(choice); contentPanel.add(button); Label label = new Label(); label.setWidth(20); contentPanel.add(label); }
/** * Creates a new MockRadioButton component. * * @param editor editor of source file the component belongs to */ public MockRadioButton(SimpleEditor editor) { super(editor, TYPE, images.radiobutton()); // Initialize mock radioButton UI radioButtonWidget = new RadioButton("dummy-group"); radioButtonWidget.setStylePrimaryName("ode-SimpleMockComponent"); initComponent(radioButtonWidget); }
public void init(ERDDAPConstraintGroup constraintGroup) { this.constraintGroup = constraintGroup; radioButtonGroup.clear(); for (Iterator conIt = constraintGroup.getConstraints().iterator(); conIt.hasNext();) { final ERDDAPConstraint constraint = (ERDDAPConstraint) conIt.next(); dsid = constraintGroup.getDsid(); final String key = constraint.getKey(); // There should be only 1. VariableSerializable variable = constraint.getVariables().get(0); final String id = variable.getID(); String type = constraint.getWidget(); if (type.equals("list")) { RadioButton radio = new RadioButton("constraint_type", variable.getName()); radioButtonGroup.add(radio); radio.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { filter.setText(""); RadioButton button = (RadioButton) event.getSource(); valuesList.clear(); valuesList.addItem(Constants.LOADING); currentVariable = button.getText(); // For this part, we do not constrain on anything... Util.getRPCService().getERDDAPOuterSequenceValues(dsid, id, key, constraint, new ArrayList<ConstraintSerializable>(), outerSequenceValuesCallback); } }); } } }
private void setBatchList(List<List<String>> data) { int rowIndex = 0; for (List<String> rowData : data) { if (rowIndex > 0) { final RadioButton radioButton = new RadioButton(new Date().toString()); radioButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { for (RadioButton radio : radioButtonVsRowIdMap.keySet()) { radio.setValue(false); } radioButton.setValue(true); selectedRowId = radioButtonVsRowIdMap.get(radioButton).toString(); } }); radioButtonVsRowIdMap.put(radioButton, rowIndex); if (rowIndex == 1) { radioButton.setValue(true); selectedRowId = "1"; } fuzzyTable.setWidget(rowIndex, 0, radioButton); if (rowIndex % 2 == 0) { fuzzyTable.getRowFormatter().setStyleName(rowIndex, "oddRow"); } else { fuzzyTable.getRowFormatter().setStyleName(rowIndex, "evenRow"); } int columnIndex = 1; for (String columnData : rowData) { fuzzyTable.setWidget(rowIndex, columnIndex, new Label(columnData)); columnIndex++; } } rowIndex++; } fuzzyTable.getRowFormatter().addStyleName(0, "rowHighlighted"); }
public Employee getSelectedEmployee() { int i=0; for(RadioButton rb:radios) { if(rb.getValue()) { return employees.get(i); } i++; } return null; }
private void initComp() { matchAllButton = new RadioButton("matchGroup", "Match All"); matchAllButton.setValue(true); matchAnyButton = new RadioButton("matchGroup", "Match Any"); filterPanel = new VStack(); filterPanel.setWidth100(); filterPanel.addMember(new RowFilter()); addButton = new Anchor(); addButton.setPixelSize(12, 12); addButton.addClickHandler(event -> addRow()); addButton.getElement().appendChild(new Image(ADD_BUTTON_IMAGE).getElement()); updateRemoveButtonStatus(); }
public BallotWidget(BallotSheetView bsv, EasyVoteAsyncCallback<Void> cb) { electionInfo = new VerticalPanel(); this.add(electionInfo); electionIdLabel = new Label("Election id: " + bsv.getElectionId()); electionInfo.add(electionIdLabel); electionQuestion = new Label(bsv.getQuestion()); this.add(electionQuestion); squares = new ArrayList<RadioButton>(); callback = cb; List<CandidateView> candidateList = bsv.getCandidates(); optionsTable = new Grid(candidateList.size()+1, 2); optionsTable.addStyleName("BallotWidget-optionsTable"); for (int i = 0; i < candidateList.size(); i++) { optionsTable.getCellFormatter().addStyleName(i, 0, "BallotWidget-optionsTableCells"); optionsTable.getCellFormatter().addStyleName(i, 1, "BallotWidget-optionsTableCells"); optionsTable.getCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER); optionsTable.setText(i, 0, candidateList.get(i).getName()); RadioButton button = new RadioButton("candidates"); squares.add(button); optionsTable.setWidget(i, 1, button); } this.add(optionsTable); submitVoteButton = new Button("Submit Vote"); submitVoteButton.addStyleName("BallotWidget-submitVoteButton"); submitVoteButton.addClickHandler(new SubmitHandler()); this.add(submitVoteButton); submitBlankVoteButton = new Button("Submit Blank Vote"); submitBlankVoteButton.addStyleName("BallotWidget-submitVoteButton"); submitBlankVoteButton.addClickHandler(new SubmitBlankHandler()); this.add(submitBlankVoteButton); this.addStyleName("easyvote-BallotWidget"); }
public RadioButton getRadioButton(String value) { RadioButton rb= null; for (int idx = 0; idx < _items.size(); idx++) { if (value.equals(_items.get(idx).getName())) { return _rbs.get(idx); } } return rb; }
public void reset() { setValue(false); String key = DOM.getElementAttribute(getElement(), "id"); List<UIObject> components = ComponentRepository.getInstance().getComponent(key); if(components == null) { return; } for (UIObject object : components) { DOM.setElementAttribute(object.getElement(), "isSelected","false"); if (object instanceof RadioButton){ RadioButton rb = (RadioButton)object; rb.setChecked(false); } } }
private void enableOrDisableAllRadioButtons(Panel panel, boolean enable) { for (Widget w : panel) { if (w instanceof RadioButton) { RadioButton b = (RadioButton) w; b.setEnabled(enable); } } }
private String getSelectedOptionInPanel(Panel panel) { for (Widget w : panel) { if (w instanceof RadioButton) { RadioButton b = (RadioButton) w; if (b.getValue()) { return b.getText(); } } } return null; }
public PictureWidget(Picture picture,int type) { this.type = type; if (type==TOP_IMAGES) { selector = new RadioButton(TOP_IMAGES_SELECTOR); selector.addClickHandler(this); add(selector); setCellWidth(selector,"1%"); } else if (type==SPRITE) { up = new Image(Images.UP_GREEN); up.setStyleName(Styles.CLICKABLE); up.addClickHandler(this); up.setTitle(appConstants.paragraphMoveSpriteUp()); add(up); setCellWidth(up,"1%"); down = new Image(Images.DOWN_GREEN); down.setStyleName(Styles.CLICKABLE); down.addClickHandler(this); down.setTitle(appConstants.paragraphMoveSpriteDown()); add(down); setCellWidth(down,"1%"); } name = new Label(); setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); setStyleName("paragraph_edit_content_box"); name.setTitle(appConstants.clickToPreview()); name.setStyleName(Styles.CLICKABLE); name.addStyleName(Styles.BOLD); name.addClickHandler(this); add(name); setCellWidth(name,"99%"); remove = new Image(Images.REMOVE); remove.setStyleName(Styles.CLICKABLE); remove.setTitle(appConstants.buttonRemove()); remove.addClickHandler(this); add(remove); setCellWidth(remove,"1%"); apply(picture); }
void installRealHandler() { ValueChangeHandler<Boolean> changeHandler = new ValueChangeHandler<Boolean>() { @Override public void onValueChange( ValueChangeEvent<Boolean> event ) { if( event.getValue() ) signalChange( NestWidget.this ); } }; for( RadioButton radio : radios.values() ) radio.addValueChangeHandler( changeHandler ); }
void setSelected( int id ) { RadioButton radio = radios.get( id ); if( radio == null ) return; radio.setValue( true ); }
int getSelected() { for( Entry<Integer, RadioButton> e : radios.entrySet() ) { if( e.getValue().getValue() ) return e.getKey(); } return -1; }
/** * Instantiates a new EndpointProfilesViewImpl. */ public EndpointProfilesViewImpl() { super(false); supportPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); supportPanel.setWidth("1000px"); resetButton = new Button(Utils.constants.reset()); supportPanel.add(resetButton); endpointGroupButton = new RadioButton("filter", Utils.constants.endpointGroup()); listBox = new EndpointGroupsInfoListBox(); listBox.getElement().getStyle().setPropertyPx("minWidth", 100); HorizontalPanel groupPanel = new HorizontalPanel(); groupPanel.setSpacing(15); groupPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); groupPanel.add(endpointGroupButton); groupPanel.add(listBox); supportPanel.add(groupPanel); HorizontalPanel keyHashPanel = new HorizontalPanel(); keyHashPanel.setSpacing(15); keyHashPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); endpointKeyHashButton = new RadioButton("filter", Utils.constants.endpointKeyHash()); endpointKeyHash = new TextBox(); endpointKeyHash.setWidth("100%"); findButton = new Button(Utils.constants.find()); findButton.addStyleName(Utils.avroUiStyle.buttonSmall()); keyHashPanel.add(endpointKeyHashButton); keyHashPanel.add(endpointKeyHash); keyHashPanel.add(findButton); supportPanel.add(keyHashPanel); endpointGroupButton.setValue(true); }
@Override public void setCreationLog(List<PacketProblemCreationLog> creationLog) { gridHistory.resize(creationLog.size() + 1, HEADER.length); for (int column = 0; column < HEADER.length; ++column) { gridHistory.setText(0, column, HEADER[column]); } gridHistory.getColumnFormatter().addStyleName(2, "problemChangeHistoryDiffColumn"); gridHistory.getColumnFormatter().addStyleName(3, "problemChangeHistoryDiffColumn"); int row = 0; for (PacketProblemCreationLog change : creationLog) { ++row; gridHistory.setHTML(row, 0, change.getDate()); gridHistory.setHTML(row, 1, change.getPlayer()); if (Strings.isNullOrEmpty(change.summary)) { continue; } RadioButton buttonBefore = new RadioButton(GROUP_BEFORE); buttonBefore.addClickHandler(this); gridHistory.setWidget(row, 2, buttonBefore); buttonToLogBefore.put(buttonBefore, change); RadioButton buttonAfter = new RadioButton(GROUP_AFTER); buttonAfter.addClickHandler(this); gridHistory.setWidget(row, 3, buttonAfter); buttonToLogAfter.put(buttonAfter, change); } htmlDiff.setHTML(""); }
private PacketProblemCreationLog selectedLog( Map<RadioButton, PacketProblemCreationLog> buttonToLog) { for (Entry<RadioButton, PacketProblemCreationLog> entry : buttonToLog.entrySet()) { if (entry.getKey().getValue()) { return entry.getValue(); } } return null; }
@Override public PrintConfiguration.PostPrintAction getPostPrintAction() { if (optionsToShowConfiguration.isShowPostPrintActionOption()) { for (Map.Entry<PrintConfiguration.PostPrintAction, RadioButton> entry : postPrintActionRadioButtonMap .entrySet()) { if (entry.getValue().getValue()) { return entry.getKey(); } } return null; } return super.getPostPrintAction(); }
private LayerPresenter(MapEventBus eventBus, final WmsLayer layer) { setStyleName(ExampleBase.getShowcaseResource().css().sampleRow()); setWidth("100%"); add(new Label(layer.getTitle())); WmsLayerInfo capabilities = layer.getCapabilities(); boolean first = true; if (capabilities != null) { for (final WmsLayerStyleInfo styleInfo : capabilities.getStyleInfo()) { final RadioButton styleWidget = new RadioButton(layer.getId() + "Radio", styleInfo.getTitle()); styleWidget.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { layer.getConfiguration().setStyles(styleInfo.getName()); layer.refresh(); } } }); if (first) { styleWidget.setValue(true); first = false; } add(styleWidget); } WmsLayerLegend legend = new WmsLayerLegend(eventBus, layer); if (scaleBox.getValue() != null) { if (scaleBox.getValue() > 0.2 && scaleBox.getValue() < 5) { legend.scale(scaleBox.getValue()); } else { Window.alert("Choose a scale between 0.2 and 5"); } } add(legend); } }
private LayerPresenter(final WmsLayer layer) { setStyleName(ExampleBase.getShowcaseResource().css().sampleRow()); setWidth("100%"); add(new Label(layer.getTitle())); WmsLayerInfo capabilities = layer.getCapabilities(); boolean first = true; if (capabilities != null) { for (final WmsLayerStyleInfo styleInfo : capabilities.getStyleInfo()) { final RadioButton styleWidget = new RadioButton(layer.getId() + "Radio", styleInfo.getTitle()); styleWidget.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) { layer.getConfiguration().setStyles(styleInfo.getName()); layer.refresh(); } } }); if (first) { styleWidget.setValue(true); first = false; } add(styleWidget); } } }
private void addRadioButtons(HorizontalPanel hp) { RadioButton r30m = getRadioButton("m30", 30); r30m.setValue(true); hp.add(r30m); hp.add(getRadioButton("1h", 60)); hp.add(getRadioButton("2h", 120)); hp.add(getRadioButton("6h", 360)); hp.add(getRadioButton("12h", 720)); hp.add(getRadioButton("1d", 1440)); }