Example usage for com.google.gwt.user.client.ui RadioButton setHTML

List of usage examples for com.google.gwt.user.client.ui RadioButton setHTML

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui RadioButton setHTML.

Prototype

@Override
    public void setHTML(@IsSafeHtml String html) 

Source Link

Usage

From source file:com.google.sampling.experiential.client.MonthlyPanel.java

License:Open Source License

public MonthlyPanel(final SignalScheduleDAO schedule) {
    myConstants = GWT.create(MyConstants.class);
    this.schedule = schedule;
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(2);/*w w  w. j a  v a 2s .  c om*/
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setSize("290px", "43px");
    initWidget(verticalPanel);

    RepeatEveryNPanel repeatPanel = new RepeatEveryNPanel(myConstants.repeatTypeMonths(), schedule);
    verticalPanel.add(repeatPanel);
    repeatPanel.setWidth("239px");

    VerticalPanel byWhatPanel = new VerticalPanel();
    byWhatPanel.setSpacing(2);
    verticalPanel.add(byWhatPanel);

    HorizontalPanel domPanel = new HorizontalPanel();
    domPanel.setSpacing(2);
    domPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    byWhatPanel.add(domPanel);
    domPanel.setWidth("184px");
    Label by = new Label("By: ");
    by.setStyleName("gwt-Label-Header");
    domPanel.add(by);
    by.setWidth("30px");

    RadioButton domRadio = new RadioButton(myConstants.byGroup(), myConstants.dayOfMonth());
    domRadio.setHTML(myConstants.dayOfMonth());
    domPanel.add(domRadio);

    final ListBox listBox = createDayOfMonthListBox();
    listBox.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            schedule.setDayOfMonth(listBox.getSelectedIndex());
        }
    });

    domPanel.add(listBox);
    if (Boolean.TRUE == schedule.getByDayOfMonth()) {
        listBox.setSelectedIndex(schedule.getDayOfMonth());
    }

    HorizontalPanel dowPanel = new HorizontalPanel();
    dowPanel.setSpacing(2);
    dowPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    byWhatPanel.add(dowPanel);

    Label label = new Label(myConstants.by() + ": ");
    label.setStyleName("gwt-Label-Header");
    dowPanel.add(label);
    label.setWidth("30px");

    RadioButton dowRadio = new RadioButton(myConstants.byGroup(), myConstants.dayOfWeek());

    dowRadio.setHTML(myConstants.dayOfWeek());
    dowPanel.add(dowRadio);

    HorizontalPanel weekdayPanel = new HorizontalPanel();
    weekdayPanel.setSpacing(2);
    weekdayPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    weekdayPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    byWhatPanel.add(weekdayPanel);
    byWhatPanel.setCellHorizontalAlignment(weekdayPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    final ListBox nth = createNthDayListBox(schedule, weekdayPanel);

    weekdayPanel.add(nth);

    nth.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            schedule.setNthOfMonth(nth.getSelectedIndex());
        }
    });

    final WeekDayPanel weekDayPanel = new WeekDayPanel(false, schedule);
    weekdayPanel.add(weekDayPanel);
    weekdayPanel.setCellHorizontalAlignment(weekDayPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    dowRadio.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            toggleDayOfMonthDayOfWeekPanels(schedule, listBox, nth, weekDayPanel, true);
        }
    });

    domRadio.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            toggleDayOfMonthDayOfWeekPanels(schedule, listBox, nth, weekDayPanel, false);
        }
    });
    TimeListPanel timeListPanel = new TimeListPanel(schedule);
    verticalPanel.add(timeListPanel);
    timeListPanel.setWidth("286px");

    if (schedule.getByDayOfMonth()) {
        domRadio.setValue(Boolean.TRUE);
        toggleDayOfMonthDayOfWeekPanels(schedule, listBox, nth, weekDayPanel, false);
    } else {
        dowRadio.setValue(Boolean.TRUE);
        toggleDayOfMonthDayOfWeekPanels(schedule, listBox, nth, weekDayPanel, true);
    }

    TimeoutPanel timeoutPanel = new TimeoutPanel(schedule);
    verticalPanel.add(timeoutPanel);
    timeoutPanel.setWidth("286px");

    SnoozePanel snoozePanel = new SnoozePanel(schedule);
    verticalPanel.add(snoozePanel);
    snoozePanel.setWidth("286px");

}

From source file:com.jwh.gwt.fasttable.sample.client.FastTableSample.java

License:Open Source License

private void buildRowCountButtons(FlexTable flexTable) {
    flexTable.setWidget(0, 0, new Label());
    flexTable.getFlexCellFormatter().setColSpan(0, 0, 2);
    final String rows10 = "10 sample rows";
    final String rows100 = "100 sample rows";
    final String rows500 = "500 sample rows";
    final String rows1000 = "1000 sample rows";
    final String rowsToBuild = "rowsToBuild";
    final ValueChangeHandler<Boolean> handler = new ValueChangeHandler<Boolean>() {
        @Override//from  www  .  j  a v a2 s  . c  om
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            RadioButton selected = (RadioButton) event.getSource();
            if (rows10.equals(selected.getFormValue())) {
                sampleRowCount = 10;
            } else if (rows100.equals(selected.getFormValue())) {
                sampleRowCount = 100;
            } else if (rows500.equals(selected.getFormValue())) {
                sampleRowCount = 500;
            } else {
                sampleRowCount = 1000;
            }
        }
    };
    {
        final RadioButton radio = new RadioButton(rowsToBuild);
        radio.setHTML(rows10);
        radio.setValue(false, false);
        radio.setFormValue(rows10);
        radio.addValueChangeHandler(handler);
        flexTable.setWidget(1, 0, radio);
        flexTable.getFlexCellFormatter().setColSpan(1, 0, 2);
        radio.getElement().getParentElement().addClassName(BORDER_NONE);
    }
    {
        final RadioButton radio = new RadioButton(rowsToBuild);
        radio.setHTML(rows100);
        radio.setValue(true, false);
        radio.setFormValue(rows100);
        radio.addValueChangeHandler(handler);
        flexTable.setWidget(2, 0, radio);
        flexTable.getFlexCellFormatter().setColSpan(2, 0, 2);
        radio.getElement().getParentElement().addClassName(BORDER_NONE);
    }
    {
        final RadioButton radio = new RadioButton(rowsToBuild);
        radio.setHTML(rows500);
        radio.setValue(false, false);
        radio.setFormValue(rows500);
        radio.addValueChangeHandler(handler);
        flexTable.setWidget(3, 0, radio);
        flexTable.getFlexCellFormatter().setColSpan(3, 0, 2);
        radio.getElement().getParentElement().addClassName(BORDER_NONE);
    }
    {
        final RadioButton radio = new RadioButton(rowsToBuild);
        radio.setHTML(rows1000);
        radio.setValue(false, false);
        radio.setFormValue(rows1000);
        radio.addValueChangeHandler(handler);
        flexTable.setWidget(4, 0, radio);
        flexTable.getFlexCellFormatter().setColSpan(4, 0, 2);
        radio.getElement().getParentElement().addClassName(BORDER_NONE);
    }
}

From source file:com.vaadin.client.ui.VRadioButtonGroup.java

License:Apache License

private void updateItem(RadioButton button, JsonObject item, boolean requireInitialization) {
    String itemHtml = item.getString(ListingJsonConstants.JSONKEY_ITEM_VALUE);
    if (!isHtmlContentAllowed()) {
        itemHtml = WidgetUtil.escapeHTML(itemHtml);
    }/*w  ww .  ja  v a  2  s  .  c  o m*/

    String iconUrl = item.getString(ListingJsonConstants.JSONKEY_ITEM_ICON);
    if (iconUrl != null && iconUrl.length() != 0) {
        Icon icon = client.getIcon(iconUrl);
        itemHtml = icon.getElement().getString() + itemHtml;
    }

    button.setHTML(itemHtml);
    button.setValue(item.getBoolean(ListingJsonConstants.JSONKEY_ITEM_SELECTED));
    boolean optionEnabled = !item.getBoolean(ListingJsonConstants.JSONKEY_ITEM_DISABLED);
    boolean enabled = optionEnabled && !isReadonly() && isEnabled();
    button.setEnabled(enabled);
    String key = item.getString(DataCommunicatorConstants.KEY);

    if (requireInitialization) {
        getWidget().add(button);
        button.setStyleName("v-radiobutton");
        button.addStyleName(CLASSNAME_OPTION);
        button.addClickHandler(this);
    }
    optionsToItems.put(button, item);
    keyToOptions.put(key, button);
}