Example usage for com.google.gwt.user.client.ui CheckBox setFormValue

List of usage examples for com.google.gwt.user.client.ui CheckBox setFormValue

Introduction

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

Prototype

public void setFormValue(String value) 

Source Link

Document

Set the value property on the input element that backs this widget.

Usage

From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.batch.ExportBatchClassView.java

License:Open Source License

/**
 * To get batch Folder List View.//from   w  w w . ja  v a  2s  .c o m
 * 
 * @param propertyMap Map<String, String>
 */
public void getbatchFolderListView(Map<String, String> propertyMap) {
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.addStyleName("width100");

    CheckBox checkBox = new CheckBox(propertyMap.get(BatchFolderListDTO.FOLDER_NAME));
    checkBox.setName(propertyMap.get(BatchFolderListDTO.FOLDER_NAME));
    checkBox.setFormValue(propertyMap.get(BatchFolderListDTO.FOLDER_NAME));
    checkBox.setEnabled(Boolean.parseBoolean(propertyMap.get(BatchFolderListDTO.ENABLED)));
    checkBox.setChecked(Boolean.parseBoolean(propertyMap.get(BatchFolderListDTO.CHECKED)));
    horizontalPanel.add(checkBox);
    exportBatchClassViewPanel.add(horizontalPanel);
}

From source file:com.google.livingstories.client.contentmanager.ImportManager.java

License:Apache License

private Widget createFileUploadForm() {
    fileUploadForm = new FormPanel();
    fileUploadForm.setAction("/import");
    fileUploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    fileUploadForm.setMethod(FormPanel.METHOD_POST);

    VerticalPanel fileUploadPanel = new VerticalPanel();
    fileUploadForm.setWidget(fileUploadPanel);

    FileUpload upload = new FileUpload();
    upload.setName("data");
    fileUploadPanel.add(upload);//from w  w  w . j  a va2 s  .  c om

    CheckBox override = new CheckBox(
            "Check this box if the previous import attempt resulted in " + "an error.");
    override.setName("override");
    override.setFormValue("true");
    fileUploadPanel.add(override);

    Button submit = new Button("Submit");
    submit.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent e) {
            fileUploadForm.submit();
            statusLabel.setHTML("Uploading...");
            progress = 0;
        }
    });
    fileUploadPanel.add(submit);

    fileUploadForm.addSubmitCompleteHandler(new SubmitCompleteHandler() {
        @Override
        public void onSubmitComplete(SubmitCompleteEvent e) {
            processResult(e.getResults());
        }
    });
    return fileUploadForm;
}

From source file:net.cbtltd.client.field.StackField.java

/**
 * Renders the field from the specified map of available key-option(s) into the field.
 *
 * @param map the map of available key-option(s).
 *//*  w w w  .jav a2  s . c  om*/
private void setItems(HashMap<NameId, ArrayList<NameId>> map) {
    if (map == null) {
        return;
    }
    field.clear();
    ArrayList<NameId> keys = new ArrayList<NameId>(map.keySet());
    Collections.sort(keys);
    for (NameId key : keys) {
        ArrayList<NameId> values = map.get(key);
        VerticalPanel options = new VerticalPanel();
        options.setTitle(key.getId());
        field.add(options,
                "<img src='" + BUNDLE.open().getURL() + "' style='padding: 1px;'</img>" + key.getName(), true);
        //         field.add(options, key.getName());
        for (NameId value : values) {
            CheckBox cb = new CheckBox(value.getName());
            cb.setFormValue(value.getId());
            cb.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    CheckBox cb = (CheckBox) event.getSource();
                    if (isUniquekey(cb.getFormValue())) {
                        deselect(cb.getFormValue());
                        cb.setValue(true);
                    }
                }
            });
            options.add(cb);
        }
    }
}

From source file:net.cbtltd.client.form.OrganizationForm.java

License:Open Source License

private FlowPanel createWorkflow() {
    final FlowPanel panel = new FlowPanel();
    final HTML workflowText = new HTML(CONSTANTS.workflowText());
    panel.add(workflowText);// w w  w.ja  va 2  s .c o m
    final String[] WORKFLOW_DATES = { Reservation.FROMDATE, Reservation.DATE, Reservation.TODATE };
    final ArrayList<NameId> DATENAMES = NameId.getList(CONSTANTS.workflowDates(), WORKFLOW_DATES);

    workflowGrid = new GridField<Workflow>(this, null, CONSTANTS.workflowHeaders(),
            Reservation.WORKFLOW_STATES.length, tab++) {

        @Override
        public void setRowValue(int row, Workflow value) {

            CheckBox enabledField = new CheckBox(getStatename(value.getState()));
            enabledField.setFormValue(value.getState());
            enabledField.setValue(value.getEnabled());
            enabledField.addStyleName(OrganizationForm.CSS.workflowState());
            workflowGrid.setWidget(row, 0, enabledField);

            IntegerField durationField = new IntegerField(this, null, null, 0);
            durationField.setValue(value.getDuration());
            durationField.setFieldStyle(OrganizationForm.CSS.workflowDuration());
            workflowGrid.setWidget(row, 1, durationField);

            workflowGrid.setText(row, 2, value.getUnit().toString());

            ToggleButton priorField = new ToggleButton(OrganizationForm.CONSTANTS.workflowLabelAfter(),
                    OrganizationForm.CONSTANTS.workflowLabelBefore());
            priorField.setDown(value.getPrior());
            priorField.addStyleName(OrganizationForm.CSS.workflowWhen());
            workflowGrid.setWidget(row, 3, priorField);

            ListField datenameField = new ListField(this, null, DATENAMES, null, false, 0);
            datenameField.setValue(value.getDatename());
            datenameField.setFieldStyle(OrganizationForm.CSS.workflowDatename());
            workflowGrid.setWidget(row, 4, datenameField);
        }

        @Override
        public Workflow getRowValue(int row) {
            CheckBox enabledField = (CheckBox) workflowGrid.getWidget(row, 0);
            IntegerField durationField = (IntegerField) workflowGrid.getWidget(row, 1);
            ToggleButton priorField = (ToggleButton) workflowGrid.getWidget(row, 3);
            ListField datenameField = (ListField) workflowGrid.getWidget(row, 4);
            Workflow value = new Workflow(organizationField.getId(), NameId.Type.Reservation.name(),
                    enabledField.getFormValue(), enabledField.getValue(), priorField.isDown(),
                    datenameField.getValue(), Time.DAY.name(), durationField.getValue());
            //Window.alert("getRowValue " + value);
            return value;
        }
    };

    ArrayList<Workflow> defaultValue = new ArrayList<Workflow>();
    defaultValue.add(new Workflow(organizationField.getId(), NameId.Type.Reservation.name(),
            Reservation.WORKFLOW_STATES[0], true, false, Reservation.DATE, Time.DAY.name(), 2));//RESERVED
    defaultValue.add(new Workflow(organizationField.getId(), NameId.Type.Reservation.name(),
            Reservation.WORKFLOW_STATES[1], true, false, Reservation.DATE, Time.DAY.name(), 3));//CONFIRMED
    defaultValue.add(new Workflow(organizationField.getId(), NameId.Type.Reservation.name(),
            Reservation.WORKFLOW_STATES[2], true, true, Reservation.FROMDATE, Time.DAY.name(), 35));//FULLYPAID
    defaultValue.add(new Workflow(organizationField.getId(), NameId.Type.Reservation.name(),
            Reservation.WORKFLOW_STATES[3], true, true, Reservation.FROMDATE, Time.DAY.name(), 7));//BRIEFED
    defaultValue.add(new Workflow(organizationField.getId(), NameId.Type.Reservation.name(),
            Reservation.WORKFLOW_STATES[4], true, true, Reservation.FROMDATE, Time.DAY.name(), 1));//ARRIVED
    defaultValue.add(new Workflow(organizationField.getId(), NameId.Type.Reservation.name(),
            Reservation.WORKFLOW_STATES[5], true, true, Reservation.TODATE, Time.DAY.name(), 2));//PREDEPARTED
    defaultValue.add(new Workflow(organizationField.getId(), NameId.Type.Reservation.name(),
            Reservation.WORKFLOW_STATES[6], true, true, Reservation.TODATE, Time.DAY.name(), 7));//DEPARTED
    //      defaultValue.add(new Workflow(organizationField.getId(), NameId.Type.Reservation.name(), Reservation.WORKFLOW_STATES[7], true, false, Reservation.TODATE, Time.DAY.name(), 7));//DEPARTED
    workflowGrid.setDefaultValue(defaultValue);

    panel.add(workflowGrid);
    return panel;
}

From source file:net.scran24.user.client.surveyscheme.MultipleChoiceCheckboxQuestion.java

@Override
public SimpleSurveyStageInterface getInterface(final Callback1<Survey> onComplete,
        Callback2<Survey, Boolean> onIntermediateStateChange) {
    final FlowPanel content = new FlowPanel();
    content.addStyleName("intake24-multiple-choice-question");
    content.addStyleName("intake24-survey-content-container");

    content.add(WidgetFactory.createPromptPanel(questionText));

    FlowPanel checkboxesDiv = new FlowPanel();
    checkboxesDiv.addStyleName("scran24-ready-meals-checkboxes-block");

    final ArrayList<CheckBox> checkBoxes = new ArrayList<CheckBox>();

    for (String option : options) {
        FlowPanel rowDiv = new FlowPanel();
        CheckBox checkBox = new CheckBox(SafeHtmlUtils.htmlEscape(option));
        checkBox.setFormValue(option);
        checkBox.addStyleName("scran24-ready-meals-checkbox");
        checkBoxes.add(checkBox);/*  w  ww  .  j a  v a 2  s. c o m*/
        rowDiv.add(checkBox);
        checkboxesDiv.add(rowDiv);
    }

    if (!otherOptionName.isEmpty()) {
        FlowPanel otherPanel = new FlowPanel();
        otherOption = new CheckBox(otherOptionName.getOrDie() + ": ");
        otherPanel.add(otherOption);
        otherBox = new TextBox();
        otherPanel.add(otherBox);
        checkboxesDiv.add(otherPanel);

        otherBox.addFocusHandler(new FocusHandler() {
            @Override
            public void onFocus(FocusEvent event) {
                otherOption.setValue(true);
            }
        });
    }

    content.add(checkboxesDiv);

    Button accept = WidgetFactory.createGreenButton(acceptText, new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {

            StringBuilder value = new StringBuilder();
            boolean first = true;

            for (CheckBox checkBox : checkBoxes)
                if (checkBox.getValue()) {
                    if (first)
                        first = false;
                    else
                        value.append(", ");

                    value.append(checkBox.getFormValue());
                }

            if (!otherOptionName.isEmpty()) {
                if (otherOption.getValue()) {
                    if (!first)
                        value.append(", ");
                    value.append(otherBox.getText());
                }
            }

            onComplete.call(state.withData(dataField, value.toString()));
        }
    });

    content.add(checkboxesDiv);
    content.add(accept);

    return new SimpleSurveyStageInterface(content);
}

From source file:org.activityinfo.ui.client.component.form.field.CheckBoxFieldWidget.java

License:Open Source License

private CheckBox createControl(String groupId, FormInstance instance, Cardinality cardinality) {
    final CheckBox checkBox;
    final String label = FormInstanceLabeler.getLabel(instance);
    if (cardinality == Cardinality.SINGLE) {
        checkBox = new RadioButton(groupId, label);
    } else {/*www  .j  a  va  2 s . co m*/
        checkBox = new CheckBox(label);
    }
    checkBox.setFormValue(instance.getId().asString());
    return checkBox;
}

From source file:org.bonitasoft.forms.client.view.widget.CheckboxGroupWidget.java

License:Open Source License

private CheckBox createCheckbox(final boolean allowHTML, final ReducedFormFieldAvailableValue availableValue) {
    final CheckBox checkBox = new CheckBox(availableValue.getLabel(), allowHTML);
    checkBox.addClickHandler(this);
    checkBox.addValueChangeHandler(this);
    checkBox.setFormValue(availableValue.getValue());
    checkBox.setStyleName("bonita_form_radio");
    return checkBox;
}

From source file:org.calontir.marshallate.falcon.client.ui.fighterform.AuthorizationsField.java

public AuthorizationsField(final Fighter fighter, final boolean edit) {
    Panel dataBody = new FlowPanel();
    dataBody.setStyleName("dataBody");
    if (edit) {/*from  www  .  j  av a  2s  . co m*/
        for (AuthType at : lookupController.getAuthType()) {
            final CheckBox cb = new CheckBox(at.getCode());
            cb.setFormValue(at.getCode());
            cb.setName("authorization");
            if (fighter.getAuthorization() != null) {
                for (Authorization a : fighter.getAuthorization()) {
                    if (a.getCode().equals(at.getCode())) {
                        cb.setValue(true);
                        break;
                    }
                }
            }
            cb.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                @Override
                public void onValueChange(ValueChangeEvent<Boolean> event) {
                    List<Authorization> auths = fighter.getAuthorization();
                    if (auths == null) {
                        auths = new ArrayList<Authorization>();
                        fighter.setAuthorization(auths);
                    }
                    Authorization a = new Authorization();
                    a.setCode(cb.getFormValue());
                    if (auths.contains(a)) {
                        if (event.getValue()) {
                            auths.add(a);
                        } else {
                            auths.remove(a);
                        }
                    } else {
                        if (event.getValue()) {
                            auths.add(a);
                        }
                    }
                }
            });
            dataBody.add(cb);
        }
    } else {
        Label auths = new Label();
        auths.setText(getAuthsAsString(fighter.getAuthorization()));
        dataBody.add(auths);
    }
    initWidget(dataBody);
}

From source file:org.daxplore.presenter.client.ui.PerspectiveCheckboxPanel.java

License:Open Source License

private PerspectiveCheckboxPanel(DaxploreConfig config, QuestionMetadata questions, UITexts uiTexts,
        String questionID, List<Integer> checked, boolean checkTotal) {

    Label header = new Label(uiTexts.pickSelectionAlternativesHeader());
    header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    header.addStyleName("daxplore-PerspectiveCheckboxes-header");
    this.add(header);

    List<String> options = questions.getOptionTexts(questionID);

    FlexTable grid = new FlexTable();
    CellFormatter formatter = grid.getCellFormatter();

    for (int i = 0; i < options.size(); i++) {
        CheckBox chkbox = new CheckBox(options.get(i));
        chkbox.addValueChangeHandler(this);
        chkbox.setFormValue(String.valueOf(i));
        chkbox.setValue(checked.contains(i), false);
        if (!checkTotal && checked.size() == 0 && i < config.defaultSelectedPerspectiveOptions()) {
            chkbox.setValue(true, false);
        }/* w ww. ja  v  a 2s .  co m*/
        checkboxList.add(chkbox);
        if (options.size() <= 6) {
            formatter.setWordWrap(i % options.size(), i / options.size(), false);
            grid.setWidget(i % options.size(), i / options.size(), chkbox);
        } else {
            formatter.setWordWrap(i % 7, i / 7, false);
            grid.setWidget(i % 7, i / 7, chkbox);
        }
    }
    this.add(grid);

    total = new CheckBox(uiTexts.compareWithAll());
    total.addValueChangeHandler(this);
    total.setFormValue("all");
    total.setValue(checkTotal, false);
    this.add(total);

}

From source file:org.ebayopensource.turmeric.monitoring.client.view.ErrorFilterWidget.java

License:Open Source License

/**
 * Sets the grid values.//from  www. ja  v a2s .  com
 *
 * @param grid the grid
 * @param names the names
 * @param localizedNameMap the localized name map
 * @param counterpartGrid the counterpart grid
 */
protected void setGridValues(final Grid grid, final List<String> names, final Map localizedNameMap,
        final Grid counterpartGrid) {
    grid.clear();
    grid.resize(names.size(), 1);
    int i = 0;
    for (String name : names) {
        CheckBox cb = new CheckBox((String) localizedNameMap.get(name));
        cb.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                //if a checkbox is selected, the counterpart Grid entries are all disabled
                if (((CheckBox) event.getSource()).getValue())
                    disable(counterpartGrid);
                else {
                    //if no checkboxes are selected, then the counterpart Grid is enabled
                    int checkCount = 0;
                    Iterator<Widget> itor = grid.iterator();
                    while (itor.hasNext()) {
                        Widget w = itor.next();
                        if (w instanceof CheckBox) {
                            if (((CheckBox) w).getValue())
                                checkCount++;
                        }
                    }
                    if (checkCount == 0)
                        enable(counterpartGrid);
                }
            }
        });
        cb.setFormValue(name);
        grid.setWidget(i, 0, cb);
        grid.getCellFormatter().setWordWrap(i, 0, false);
        i++;
    }
}