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

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

Introduction

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

Prototype

@Override
    public void setEnabled(boolean enabled) 

Source Link

Usage

From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.documenttype.DocumentTypeView.java

License:Open Source License

/**
 * To set Fields List.//  w ww .j a  v  a  2 s.c om
 * 
 * @param fields Collection<FieldTypeDTO>
 * @return List<Record>
 */
public List<Record> setFieldsList(Collection<FieldTypeDTO> fields) {

    List<Record> recordList = new LinkedList<Record>();
    for (final FieldTypeDTO fieldTypeDTO : fields) {
        CheckBox isHidden = new CheckBox();
        CheckBox isMultiLine = new CheckBox();
        CheckBox isReadOnly = new CheckBox();
        isHidden.setValue(fieldTypeDTO.isHidden());
        isHidden.setEnabled(false);
        isMultiLine.setValue(fieldTypeDTO.isMultiLine());
        isMultiLine.setEnabled(false);
        isReadOnly.setValue(fieldTypeDTO.getIsReadOnly());
        isReadOnly.setEnabled(false);
        Record record = new Record(fieldTypeDTO.getIdentifier());
        record.addWidget(fieldTypeListView.name, new Label(fieldTypeDTO.getName()));
        record.addWidget(fieldTypeListView.description, new Label(fieldTypeDTO.getDescription()));
        record.addWidget(fieldTypeListView.type, new Label(fieldTypeDTO.getDataType().name()));
        record.addWidget(fieldTypeListView.fdOrder, new Label(fieldTypeDTO.getFieldOrderNumber()));
        record.addWidget(fieldTypeListView.sampleValue, new Label(fieldTypeDTO.getSampleValue()));
        record.addWidget(fieldTypeListView.barcode, new Label(fieldTypeDTO.getBarcodeType()));
        record.addWidget(fieldTypeListView.isHidden, isHidden);
        record.addWidget(fieldTypeListView.isMultiLine, isMultiLine);
        record.addWidget(fieldTypeListView.isReadOnly, isReadOnly);
        recordList.add(record);
    }

    return recordList;
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.tableinfo.TableInfoView.java

License:Open Source License

private List<Record> setFieldsList(List<TableColumnInfoDTO> fields) {

    List<Record> recordList = new LinkedList<Record>();
    for (final TableColumnInfoDTO tcInfoDTO : fields) {
        Record record = new Record(tcInfoDTO.getIdentifier());
        CheckBox isRequired = new CheckBox();
        CheckBox isMandatory = new CheckBox();
        isRequired.setValue(tcInfoDTO.isRequired());
        isRequired.setEnabled(false);
        isMandatory.setValue(tcInfoDTO.isMandatory());
        isMandatory.setEnabled(false);/*from www.ja va 2  s.  com*/
        record.addWidget(tableColumnInfoListView.betweenLeft, new Label(tcInfoDTO.getBetweenLeft()));
        record.addWidget(tableColumnInfoListView.betweenRight, new Label(tcInfoDTO.getBetweenRight()));
        record.addWidget(tableColumnInfoListView.columnName, new Label(tcInfoDTO.getColumnName()));
        record.addWidget(tableColumnInfoListView.columnHeaderPattern,
                new Label(tcInfoDTO.getColumnHeaderPattern()));
        record.addWidget(tableColumnInfoListView.columnStartCoord,
                new Label(tcInfoDTO.getColumnStartCoordinate()));
        record.addWidget(tableColumnInfoListView.columnEndCoord, new Label(tcInfoDTO.getColumnEndCoordinate()));
        record.addWidget(tableColumnInfoListView.columnPattern, new Label(tcInfoDTO.getColumnPattern()));
        record.addWidget(tableColumnInfoListView.isRequired, isRequired);
        record.addWidget(tableColumnInfoListView.isMandatory, isMandatory);
        recordList.add(record);
    }

    return recordList;
}

From source file:com.ephesoft.dcma.gwt.batchinstance.client.view.BatchInstanceView.java

License:Open Source License

private List<Record> createRecords(Collection<BatchInstanceDTO> batchInstanceDTOs) {
    List<Record> recordList = new LinkedList<Record>();
    batchInstanceDTOMap.clear();//ww w.j av a2  s  .co m
    for (final BatchInstanceDTO batchInstanceDTO : batchInstanceDTOs) {
        CheckBox checkBox = new CheckBox();
        checkBox.setValue(batchInstanceDTO.isRemote());
        checkBox.setEnabled(false);
        Record record = new Record(batchInstanceDTO.getBatchIdentifier());
        String[] priority = convertPriority(batchInstanceDTO.getPriority());
        Label property = new Label(priority[0]);
        record.addWidget(batchInstanceListView.priority, property);
        property.setStyleName(priority[1]);
        record.addWidget(batchInstanceListView.batchId, new Label(batchInstanceDTO.getBatchIdentifier()));
        record.addWidget(batchInstanceListView.batchClassName, new Label(batchInstanceDTO.getBatchClassName()));
        record.addWidget(batchInstanceListView.batchName, new Label(batchInstanceDTO.getBatchName()));
        record.addWidget(batchInstanceListView.batchCreatedOn, new Label(batchInstanceDTO.getCreatedOn()));
        record.addWidget(batchInstanceListView.batchUpdatedOn, new Label(batchInstanceDTO.getUploadedOn()));
        record.addWidget(batchInstanceListView.currentUser, new Label(batchInstanceDTO.getCurrentUser()));
        record.addWidget(batchInstanceListView.status, new Label(batchInstanceDTO.getStatus()));
        record.addWidget(batchInstanceListView.isRemote, checkBox);
        recordList.add(record);
        batchInstanceDTOMap.put(batchInstanceDTO.getBatchIdentifier(), batchInstanceDTO);
    }
    if (recordList.isEmpty()) {
        disableButtons();
    }

    return recordList;
}

From source file:com.ephesoft.gxt.admin.client.view.regexbuilder.RegexFieldDetailView.java

License:Open Source License

/**
 * Enables or diables all the checkboxes boxes in range section based on the value passed. If <code>isEnabled</code> is true then
 * it will enable all the check boxes otherwise disables all the check boxes.
 * // ww  w  .  ja  v  a 2s .  c o m
 * @param isEnabled <code>true</code> value enables the check boxes in range and false value will disables the check boxes.
 */
public void setEnableTextRangeCheckBoxes(final boolean isEnabled) {
    if (!CollectionUtil.isEmpty(textRangeCheckBoxes)) {
        for (CheckBox checkBox : textRangeCheckBoxes) {
            checkBox.setEnabled(isEnabled);
        }
    }
}

From source file:com.eternach.client.RichOptionGroupWidget.java

License:Apache License

@Override
public void buildOptions(final UIDL uidl) {
    panel.clear();/*  ww w  .ja v a  2  s  .  com*/
    optionsEnabled.clear();
    for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
        boolean iconDisplayed = false;
        final UIDL opUidl = (UIDL) it.next();
        CheckBox op;

        String itemHtml = opUidl.getStringAttribute("caption");
        if (!htmlContentAllowed) {
            itemHtml = Util.escapeHTML(itemHtml);
        }

        final String icon = opUidl.getStringAttribute("icon");
        if (icon != null && icon.length() != 0) {
            final String iconUrl = client.translateVaadinUri(icon);
            itemHtml = "<span style=\"white-space: normal;\">" + itemHtml + "</span><br/><img src=\"" + iconUrl
                    + "\" class=\"" + Icon.CLASSNAME + "\" alt=\"\" />";
            iconDisplayed = true;
        }

        if (isMultiselect()) {
            op = new VCheckBox();
        } else {
            op = new RadioButton(paintableId, null, true);
            op.setStyleName("v-radiobutton");
        }

        op.addStyleName(CLASSNAME_OPTION);
        op.setValue(opUidl.getBooleanAttribute("selected"));
        final boolean optionEnabled = !opUidl
                .getBooleanAttribute(OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED);
        final boolean enabled = optionEnabled && !isReadonly() && isEnabled();
        op.setEnabled(enabled);
        optionsEnabled.add(optionEnabled);
        setStyleName(op.getElement(), ApplicationConnection.DISABLED_CLASSNAME,
                !(optionEnabled && isEnabled()));
        op.addClickHandler(this);
        optionsToKeys.put(op, opUidl.getStringAttribute("key"));
        String description = opUidl.getStringAttribute("description-text");
        if (description == null) {
            description = "";
        }
        if (opUidl.getStringAttribute("description-icon") != null) {
            description += "<br/><img src=\""
                    + client.translateVaadinUri(opUidl.getStringAttribute("description-icon")) + "\"\\>";
        }

        final FocusableFlexTable table = new FocusableFlexTable();
        table.setWidget(0, 0, op);
        table.setHTML(0, 1, itemHtml);
        table.setCellPadding(0);
        table.setCellSpacing(0);
        panel.add(table);

        if (description != null && description.length() != 0) {
            elementsToDescription.put(table.getElement(), description);
        }
        if (iconDisplayed) {
            Util.sinkOnloadForImages(table.getElement());
            table.addHandler(iconLoadHandler, LoadEvent.getType());
        }
    }

}

From source file:com.google.gerrit.client.account.MyWatchesTable.java

License:Apache License

protected void addNotifyButton(final AccountProjectWatch.NotifyType type, final AccountProjectWatchInfo info,
        final int row, final int col) {
    final CheckBox cbox = new CheckBox();

    cbox.addClickHandler(new ClickHandler() {
        @Override/* www  .j a v  a 2 s  . co  m*/
        public void onClick(final ClickEvent event) {
            final boolean oldVal = info.getWatch().isNotify(type);
            info.getWatch().setNotify(type, cbox.getValue());
            cbox.setEnabled(false);
            Util.ACCOUNT_SVC.updateProjectWatch(info.getWatch(), new GerritCallback<VoidResult>() {
                public void onSuccess(final VoidResult result) {
                    cbox.setEnabled(true);
                }

                @Override
                public void onFailure(final Throwable caught) {
                    cbox.setEnabled(true);
                    info.getWatch().setNotify(type, oldVal);
                    cbox.setValue(oldVal);
                    super.onFailure(caught);
                }
            });
        }
    });

    cbox.setValue(info.getWatch().isNotify(type));
    table.setWidget(row, col, cbox);
}

From source file:com.google.gerrit.client.change.ReplyBox.java

License:Apache License

private void renderCheckBox(int row, LabelAndValues lv) {
    ApprovalInfo self = Gerrit.isSignedIn() ? lv.info.forUser(Gerrit.getUserAccount().getId().get()) : null;

    final String id = lv.info.name();
    final CheckBox b = new CheckBox();
    b.setText(id);/*from  w  w w  . ja v  a 2 s . c  om*/
    b.setEnabled(lv.permitted.contains((short) 1));
    if (self != null && self.value() == 1) {
        b.setValue(true);
    }
    b.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            in.label(id, event.getValue() ? (short) 1 : (short) 0);
        }
    });
    b.setStyleName(style.label_name());
    labelsTable.setWidget(row, 0, b);

    CellFormatter fmt = labelsTable.getCellFormatter();
    fmt.setStyleName(row, labelHelpColumn, style.label_help());
    labelsTable.setText(row, labelHelpColumn, lv.info.valueText("+1"));
}

From source file:com.google.gwt.sample.logexample.client.HandlerController.java

License:Apache License

void setupHandler(Class clazz, CheckBox checkbox) {
    Handler h = handlers.get(clazz.getName());
    if (h == null) {
        checkbox.setEnabled(false);
    } else {/*  ww w.  jav a 2  s  .  com*/
        checkbox.setValue(true);
        checkbox.addValueChangeHandler(new CheckboxHandler(checkbox, h));
    }
}

From source file:com.google.gwt.sample.showcase.client.content.widgets.CwCheckBox.java

License:Apache License

/**
 * Initialize this example./*from  ww  w.  j  a v  a2  s.co  m*/
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a vertical panel to align the check boxes
    VerticalPanel vPanel = new VerticalPanel();
    HTML label = new HTML(constants.cwCheckBoxCheckAll());
    label.ensureDebugId("cwCheckBox-label");
    vPanel.add(label);

    // Add a checkbox for each day of the week
    String[] daysOfWeek = constants.cwCheckBoxDays();
    for (int i = 0; i < daysOfWeek.length; i++) {
        String day = daysOfWeek[i];
        CheckBox checkBox = new CheckBox(day);
        checkBox.ensureDebugId("cwCheckBox-" + day);

        // Disable the weekends
        if (i >= 5) {
            checkBox.setEnabled(false);
        }

        vPanel.add(checkBox);
    }

    // Return the panel of checkboxes
    return vPanel;
}

From source file:com.gwtmodel.table.view.ewidget.gwt.RadioBoxString.java

License:Apache License

private void setRadio(List<String> sList, boolean enable) {
    for (String s : sList) {
        CheckBox c = new CheckBox(s);
        c.setEnabled(enable);
        CC cc = new CC(s, c);
        aL.add(cc);/*ww  w  .j  a v a 2 s. c om*/
        vP.add(c);
    }
    sync.signalDone();
}