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

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

Introduction

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

Prototype

@Override
    public boolean isEnabled() 

Source Link

Usage

From source file:com.alkacon.geranium.client.ui.input.MultiCheckBox.java

License:Open Source License

/**
 * @see com.alkacon.geranium.client.ui.input.I_FormWidget#isEnabled()
 *//*  w  ww.  j  av a  2 s .  com*/
public boolean isEnabled() {

    boolean result = true;
    for (CheckBox checkbox : m_checkboxes) {
        if (!checkbox.isEnabled()) {
            result = false;
        }
    }
    return result;
}

From source file:com.dimdim.conference.ui.dialogues.client.common.PermissionsControlDialog.java

License:Open Source License

public void onClick(Widget w) {
    if (w == applyButton) {
        if (this.chatCheckBoxes != null) {
            RosterModel rosterModel = ClientModel.getClientModel().getRosterModel();
            ArrayList users = rosterModel.getRoster();
            int size = users.size();
            for (int i = 0; i < size; i++) {
                UIRosterEntry user = (UIRosterEntry) users.get(i);
                CheckBox cb1 = (CheckBox) this.chatCheckBoxes.get(user.getUserId());
                if (cb1 != null) {
                    if (cb1.isChecked() && !user.isChatOn()) {
                        this.userManager.enableChatFor(user.getUserId());
                    } else if (!cb1.isChecked() && user.isChatOn()) {
                        this.userManager.disableChatFor(user.getUserId());
                    }/*w  w w.  ja va 2  s  .co m*/
                }
                if (!ConferenceGlobals.isPresenterAVAudioDisabled() && ConferenceGlobals.partListEnabled) {
                    CheckBox cb2 = (CheckBox) this.audioCheckBoxes.get(user.getUserId());
                    if (cb2 != null) {
                        if (ConferenceGlobals.isPresenterAVVideoOnly()) {
                            if (cb2.isChecked() && !user.isVideoOn()) {
                                this.userManager.enableVideoFor(user.getUserId());
                            } else if (!cb2.isChecked() && user.isVideoOn()) {
                                this.userManager.disableVideoFor(user.getUserId());
                            }
                        } else {
                            if (cb2.isChecked() && !user.isAudioOn()) {
                                this.userManager.enableAudioFor(user.getUserId());
                            } else if (!cb2.isChecked() && user.isAudioOn()) {
                                this.userManager.disableAudioFor(user.getUserId());
                            }
                        }
                    }
                }
                /*
                CheckBox cb3 = (CheckBox)this.videoCheckBoxes.get(user.getUserId());
                if (cb3 != null)
                {
                   if (cb3.isChecked() && !user.isVideoOn())
                   {
                      this.userManager.enableVideoFor(user.getUserId());
                   }
                   else if (!cb3.isChecked() && user.isVideoOn())
                   {
                      this.userManager.disableVideoFor(user.getUserId());
                   }
                }
                */
            }
            hide();
        }
    } else if (w == this.chatHeaderLabel) {
        allChatEnabled = !allChatEnabled;
        //         Window.alert("Chat Permission:"+allChatEnabled);
        Iterator iter = this.chatCheckBoxes.values().iterator();
        while (iter.hasNext()) {
            CheckBox cb = (CheckBox) iter.next();
            cb.setChecked(allChatEnabled);
            if (cb.isEnabled()) {
                /*
                if (allDeleteChecked)
                {
                   this.checkedCount++;
                }
                else
                {
                   this.checkedCount--;
                }
                */
            }
        }
    }
}

From source file:com.dimdim.conference.ui.resources.client.ResourceControlDialog.java

License:Open Source License

public void onClick(Widget w) {
    if (w == deleteButton) {
        //         this.disableAllButtons();
        this.resourceManager.setProgressListener(this);

        ResourceModel rm = ClientModel.getClientModel().getResourceModel();
        ArrayList resources = rm.getResourceList();
        int size = resources.size();
        for (int i = 0; i < size; i++) {
            UIResourceObject res = (UIResourceObject) resources.get(i);
            CheckBox cb = (CheckBox) this.checkBoxes.get(res.getResourceId());
            if (cb != null && cb.isChecked()) {
                this.resourceManager.deleteResource(res);
                //               resourceRemoved(res);
            }/*from ww w .j  a va 2s .  c  o  m*/
        }
        this.checkedCount = 0;
        hide();
    } else if (w == deleteHeader) {
        allDeleteChecked = !allDeleteChecked;
        Iterator iter = this.checkBoxes.values().iterator();
        while (iter.hasNext()) {
            CheckBox cb = (CheckBox) iter.next();
            if (cb.isEnabled()) {
                cb.setChecked(allDeleteChecked);
                if (allDeleteChecked) {
                    this.checkedCount++;
                } else {
                    this.checkedCount--;
                }
            }
        }
    } else {
        CheckBox cb = (CheckBox) (this.checkBoxes2.get(w));
        if (cb.isChecked()) {
            this.checkedCount++;
        } else {
            this.checkedCount--;
        }
    }
    if (this.checkedCount > 0) {
        //         this.deleteButton.setEnabled(true);
    } else {
        //         this.deleteButton.setEnabled(false);
    }
}

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

License:Open Source License

private void createUI(final boolean isMandatory, final CheckBox checkBox, final Node newNode,
        final TreeItem childTree) {
    if (newNode.getParent().getLabel().getKey().equals("BatchClassModules")
            || newNode.getLabel().getKey().equals("BatchClassModules")) {
        checkBox.setEnabled(Boolean.FALSE);
        checkBox.setValue(Boolean.TRUE);
        newNode.getLabel().setMandatory(Boolean.TRUE);
    } else {/*from   w w  w.  j  a  va  2s.  com*/
        if (isMandatory) {
            checkBox.setEnabled(Boolean.TRUE);
            checkBox.setValue(Boolean.FALSE);
        } else {
            if (importExisting.getValue().equalsIgnoreCase(TRUE)) {
                checkBox.setEnabled(Boolean.TRUE);
                checkBox.setValue(Boolean.FALSE);
                newNode.getLabel().setMandatory(Boolean.FALSE);
            } else if (importExisting.getValue().equalsIgnoreCase(FALSE)) {
                checkBox.setEnabled(Boolean.FALSE);
                checkBox.setValue(Boolean.TRUE);
                newNode.getLabel().setMandatory(Boolean.TRUE);
            }
        }

        if (checkBox != null && checkBox.isEnabled()) {
            checkBox.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    boolean checked = ((CheckBox) event.getSource()).getValue();
                    newNode.getLabel().setMandatory(checked);
                    setParentItemsUI(childTree.getParentItem(), checked, newNode);
                    setChildItemsUI(childTree, checked, newNode);
                }

            });
        }
    }

}

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

License:Open Source License

private void setParentItemsUI(TreeItem parentItem, boolean checked, Node childNode) {
    Node parentNode = childNode.getParent();
    if (!checked && parentNode.getParent() != null) {
        CheckBox checkBox = (CheckBox) parentItem.getWidget();
        if (checkBox.isEnabled()) {
            checkBox.setValue(checked);/*from   w  w  w.j av a  2 s.  co m*/
            parentNode.getLabel().setMandatory(checked);
        }
        setParentItemsUI(parentItem.getParentItem(), checked, parentNode);
    }
}

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

License:Open Source License

private void setChildItemsUI(final TreeItem childTree, final boolean checked, final Node parentNode) {
    List<Node> childList = parentNode.getChildren();
    if (childTree.getChildCount() > 0) {
        for (int index = 0; index < childTree.getChildCount(); index++) {
            CheckBox checkBox = (CheckBox) childTree.getChild(index).getWidget();
            if (checkBox.isEnabled()) {
                checkBox.setValue(checked);
                childList.get(index).getLabel().setMandatory(checked);
            }/*from   w  ww.j a  va2s.c  o m*/
            setChildItemsUI(childTree.getChild(index), checked, childList.get(index));
        }
    }
}

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

License:Apache License

@Override
public void onClick(ClickEvent event) {
    super.onClick(event);
    if (event.getSource() instanceof CheckBox) {
        CheckBox source = (CheckBox) event.getSource();
        if (!source.isEnabled()) {
            // Click events on the text are received even though the
            // checkbox is disabled
            return;
        }/*from   w  ww.  j a  va 2 s  . c om*/
        if (BrowserInfo.get().isWebkit()) {
            // Webkit does not focus non-text input elements on click
            // (#11854)
            source.setFocus(true);
        }

        final boolean selected = source.getValue();
        final String key = optionsToKeys.get(source);
        if (!isMultiselect()) {
            selectedKeys.clear();
        }
        if (selected) {
            selectedKeys.add(key);
        } else {
            selectedKeys.remove(key);
        }
        client.updateVariable(paintableId, "selected", getSelectedItems(), isImmediate());
    }
}

From source file:org.drools.guvnor.client.admin.RepoConfigManager.java

License:Apache License

public DecoratorPanel getDbTypePanel() {
    FlexTable layoutA = new FlexTable();
    layoutA.setCellSpacing(6);//from  w  ww  .ja  va 2s.  c  o  m
    FlexCellFormatter cellFormatter = layoutA.getFlexCellFormatter();

    // Add a title to the form
    layoutA.setHTML(0, 0, "RDBMS Info");
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    layoutA.setHTML(1, 0, constants.SelectRdbmsType());
    final ListBox databaseList = getDatabaseList();
    databaseList.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            ListBox listBox = (ListBox) event.getSource();
            int index = listBox.getSelectedIndex();
            rdbmsConf.setDbType(listBox.getItemText(index));
            layoutB.setHTML(0, 0, listBox.getItemText(index) + " Info");
            layoutC.setHTML(0, 0, listBox.getItemText(index) + " Info");
            repoDisplayArea.setVisible(false);
            saveRepoConfigForm.setVisible(false);
        }
    });
    if (rdbmsConf.getDbType() == null || rdbmsConf.getDbType().length() < 1) {
        databaseList.setSelectedIndex(0);
    } else {
        for (int i = 0; i < databaseList.getItemCount(); i++) {
            if (rdbmsConf.getDbType().equals(databaseList.getItemText(i))) {
                databaseList.setSelectedIndex(i);
                break;
            }
        }
    }
    databaseList.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            rdbmsConf.setDbType(databaseList.getValue(databaseList.getSelectedIndex()));
        }
    });
    layoutA.setWidget(1, 1, databaseList);

    layoutA.setHTML(2, 0, constants.UseJndi());

    final CheckBox useJndi = new CheckBox();
    useJndi.setValue(rdbmsConf.isJndi());
    useJndi.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent w) {
            rdbmsConf.setJndi(useJndi.isEnabled());
            if (useJndi.isEnabled()) {
                noJndiInfo.setVisible(false);
                jndiInfo.setVisible(true);
            } else {
                noJndiInfo.setVisible(true);
                jndiInfo.setVisible(false);
            }
            repoDisplayArea.setVisible(false);
            saveRepoConfigForm.setVisible(false);
        }
    });
    layoutA.setWidget(2, 1, useJndi);

    Button continueButton = new Button("Continue");
    continueButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent w) {
            if (databaseList.getSelectedIndex() == 0) {
                Window.alert(constants.PleaseSelectRdbmsType());
                return;
            }
            if (!useJndi.isEnabled()) {
                jndiInfo.setVisible(false);
            }
            vPanel2.setVisible(true);
        }
    });

    layoutA.setWidget(3, 1, continueButton);
    DecoratorPanel decPanel = new DecoratorPanel();
    decPanel.setWidget(layoutA);
    return decPanel;
}

From source file:org.unitime.timetable.gwt.client.widgets.CourseFinderMultipleCourses.java

License:Apache License

@Override
public void setValue(RequestedCourse value, final boolean fireEvents) {
    iCheckedCourses.clear();//  ww  w.  j av  a 2  s .c om
    for (int r = 0; r < iCourses.getRowCount(); r++) {
        CourseAssignment ca = iCourses.getData(r);
        if (iCourses.getWidget(r, 0) instanceof CheckBox && ca != null) {
            CheckBox c = (CheckBox) iCourses.getWidget(r, 0);
            c.setValue(false);
            c.setText("");
        }
    }
    String query = (value == null || !value.isCourse() ? "" : value.getCourseName());
    iSelectedMethods.clear();
    if (iRequired != null)
        iRequired.setValue(false);
    for (CheckBox ch : iInstructionalMethods.values())
        if (ch.isEnabled())
            ch.setValue(false);
    if (value != null && value.hasSelectedIntructionalMethods())
        for (Preference id : value.getSelectedIntructionalMethods()) {
            iSelectedMethods.add(id);
            if (id.isRequired() && iRequired != null)
                iRequired.setValue(true);
            CheckBox ch = iInstructionalMethods.get(id);
            if (ch != null && ch.isEnabled())
                ch.setValue(true);
        }
    if (iDetails != null)
        for (CourseFinderCourseDetails d : iDetails)
            d.onSetValue(value);
    if (query.isEmpty() && !iShowDefaultSuggestions) {
        iLastQuery = null;
        iCourses.clearTable(1);
        iCourses.setEmptyMessage(MESSAGES.courseSelectionNoCourseFilter());
        updateCourseDetails();
    } else if (!query.equals(iLastQuery)) {
        iLastQuery = query;
        iDataProvider.getData(query, new AsyncCallback<Collection<CourseAssignment>>() {
            public void onFailure(Throwable caught) {
                iCourses.clearTable(1);
                iCourses.setEmptyMessage(caught.getMessage());
                if (isVisible())
                    AriaStatus.getInstance().setText(caught.getMessage());
                updateCourseDetails();
                ResponseEvent.fire(CourseFinderMultipleCourses.this, false);
            }

            public void onSuccess(Collection<CourseAssignment> result) {
                iCourses.clearTable(1);
                boolean hasCredit = false, hasNote = false;
                for (final CourseAssignment record : result) {
                    List<Widget> line = new ArrayList<Widget>();
                    CheckBox ch = new CheckBox();
                    ch.setValue(
                            iCheckedCourses.contains(new RequestedCourse(record, CONSTANTS.showCourseTitle())));
                    ch.setText(ch.getValue()
                            ? String.valueOf(iCheckedCourses
                                    .indexOf(new RequestedCourse(record, CONSTANTS.showCourseTitle())) + 1)
                            : "");
                    ch.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
                        @Override
                        public void onValueChange(ValueChangeEvent<Boolean> event) {
                            RequestedCourse rc = new RequestedCourse();
                            rc.setCourseId(record.getCourseId());
                            rc.setCourseName(MESSAGES.courseName(record.getSubject(), record.getCourseNbr()));
                            if (record.hasTitle() && (!record.hasUniqueName() || iShowCourseTitles))
                                rc.setCourseName(MESSAGES.courseNameWithTitle(record.getSubject(),
                                        record.getCourseNbr(), record.getTitle()));
                            rc.setCourseTitle(record.getTitle());
                            rc.setCredit(record.guessCreditRange());
                            if (event.getValue()) {
                                iCheckedCourses.add(rc);
                            } else {
                                iCheckedCourses.remove(rc);
                            }
                            for (int r = 0; r < iCourses.getRowCount(); r++) {
                                CourseAssignment ca = iCourses.getData(r);
                                if (iCourses.getWidget(r, 0) instanceof CheckBox && ca != null) {
                                    CheckBox c = (CheckBox) iCourses.getWidget(r, 0);
                                    c.setText(c.getValue()
                                            ? String.valueOf(iCheckedCourses.indexOf(
                                                    new RequestedCourse(ca, CONSTANTS.showCourseTitle())) + 1)
                                            : "");
                                }
                            }
                        }
                    });
                    line.add(ch);
                    line.add(new Label(record.getSubject(), false));
                    line.add(new Label(record.getCourseNbr(), false));
                    line.add(new HTML(record.getLimit() == null || record.getLimit() == 0
                            || record.getEnrollment() == null
                                    ? ""
                                    : record.getLimit() < 0 ? "&infin;"
                                            : (record.getLimit() - record.getEnrollment()) + " / "
                                                    + record.getLimit(),
                            false));
                    line.add(new Label(record.getTitle() == null ? "" : record.getTitle(), false));
                    if (record.hasCredit()) {
                        Label credit = new Label(record.getCreditAbbv(), false);
                        if (record.hasCredit())
                            credit.setTitle(record.getCreditText());
                        line.add(credit);
                        hasCredit = true;
                    } else {
                        line.add(new Label());
                    }
                    line.add(new Label(record.getNote() == null ? "" : record.getNote()));
                    if (record.hasNote())
                        hasNote = true;
                    if (record.hasTitle()) {
                        if (record.hasNote()) {
                            line.add(new AriaHiddenLabel(
                                    ARIA.courseFinderCourseWithTitleAndNote(record.getSubject(),
                                            record.getCourseNbr(), record.getTitle(), record.getNote())));
                        } else {
                            line.add(new AriaHiddenLabel(ARIA.courseFinderCourseWithTitle(record.getSubject(),
                                    record.getCourseNbr(), record.getTitle())));
                        }
                    } else {
                        if (record.hasNote()) {
                            line.add(new AriaHiddenLabel(ARIA.courseFinderCourseWithNote(record.getSubject(),
                                    record.getCourseNbr(), record.getNote())));
                        } else {
                            line.add(new AriaHiddenLabel(
                                    ARIA.courseFinderCourse(record.getSubject(), record.getCourseNbr())));
                        }
                    }
                    int row = iCourses.addRow(record, line);
                    if (iLastQuery
                            .equalsIgnoreCase(MESSAGES.courseName(record.getSubject(), record.getCourseNbr()))
                            || (record.getTitle() != null
                                    && iLastQuery.equalsIgnoreCase(MESSAGES.courseNameWithTitle(
                                            record.getSubject(), record.getCourseNbr(), record.getTitle()))))
                        iCourses.setSelected(row, true);
                }
                iCourses.setColumnVisible(4, hasCredit);
                iCourses.setColumnVisible(5, hasNote);
                if (result.size() == 1)
                    iCourses.setSelected(1, true);
                if (iCourses.getSelectedRow() >= 0) {
                    scrollToSelectedRow();
                    if (fireEvents)
                        ValueChangeEvent.fire(CourseFinderMultipleCourses.this, getValue());
                }
                updateCourseDetails();
                ResponseEvent.fire(CourseFinderMultipleCourses.this, !result.isEmpty());
            }
        });
    }
    if (iRequired != null) {
        iRequired.setEnabled(isEnabled() && (iSpecReg == null || iSpecReg.isCanRequire()));
        iRequired.setVisible(iSpecReg == null || iSpecReg.isCanRequire());
    }
}