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:ca.upei.ic.timetable.client.CourseModelView.java

License:Apache License

public void addCourse(final int id, final JSONObject value, boolean selected) {
    final CheckBox box = new CheckBox();
    String name = ((JSONString) value.get("name")).stringValue();
    String title = ((JSONString) value.get("title")).stringValue();
    String time = ((JSONString) value.get("time")).stringValue();
    box.setText(name + " " + title);
    box.setName(Integer.toString(id));
    box.setChecked(selected);/* w  w  w . ja v  a 2s . c o  m*/
    box.setEnabled(time.matches(".*\\d{1,2}:\\d{2,2}\\s*-\\s*\\d{1,2}:\\d{2,2}.*"));

    // add click listener
    box.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            final CheckBox box = (CheckBox) sender;
            if (box.isChecked()) {
                controller_.select(id, value);
            } else {
                controller_.unselect(id);
            }
        }

    });

    FocusPanel focus = PanelUtils.focusPanel(box, null, null, null, new MouseListener() {

        public void onMouseDown(Widget sender, int x, int y) {
        }

        public void onMouseEnter(Widget sender) {
            controller_.showCourseDetail(id);
        }

        public void onMouseLeave(Widget sender) {
            controller_.hideCourseDetail();
        }

        public void onMouseMove(Widget sender, int x, int y) {
        }

        public void onMouseUp(Widget sender, int x, int y) {
            //                  box.setChecked( !box.isChecked() );
        }
    });
    panel_.add(focus);
}

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

License:Open Source License

/**
 * @see com.alkacon.geranium.client.ui.input.I_FormWidget#setEnabled(boolean)
 *///from  ww w  .  j a  v a  2 s.  c  o m
public void setEnabled(boolean enabled) {

    for (CheckBox checkbox : m_checkboxes) {
        checkbox.setEnabled(enabled);
    }
}

From source file:com.anzsoft.client.ui.LoginForm.java

License:Open Source License

private Widget createAdvancedForm() {
    iJabConstants constants = (iJabConstants) GWT.create(iJabConstants.class);
    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);/* w ww.  j  av  a  2s . co  m*/
    layout.setWidth("300px");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add a title to the form
    /*
    layout.setHTML(0, 0,constants.iJabLogin());
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0,
        HasHorizontalAlignment.ALIGN_CENTER);
    */
    // Add some standard form options
    final TextBox userBox = new TextBox();
    userBox.setText("imdev");
    layout.setHTML(0, 0, constants.user());
    layout.setWidget(0, 1, userBox);
    final PasswordTextBox passBox = new PasswordTextBox();
    passBox.setText("imdev631");

    layout.setHTML(1, 0, constants.password());
    layout.setWidget(1, 1, passBox);

    // Create some advanced options
    Grid advancedOptions = new Grid(5, 2);
    advancedOptions.setCellSpacing(6);

    final TextBox hostBox = new TextBox();
    final TextBox portBox = new TextBox();
    final TextBox domainBox = new TextBox();
    final CheckBox authCheck = new CheckBox("SASL");
    authCheck.setChecked(false);

    hostBox.setEnabled(false);
    portBox.setEnabled(false);
    domainBox.setEnabled(false);
    authCheck.setEnabled(false);

    final CheckBox serverConfig = new CheckBox(constants.defineServerConfig());
    advancedOptions.setWidget(0, 0, serverConfig);
    serverConfig.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (serverConfig.isChecked()) {
                hostBox.setEnabled(true);
                portBox.setEnabled(true);
                domainBox.setEnabled(true);
                authCheck.setEnabled(true);
            } else {
                hostBox.setEnabled(false);
                portBox.setEnabled(false);
                domainBox.setEnabled(false);
                authCheck.setEnabled(false);
            }

        }

    });

    serverConfig.setChecked(false);

    advancedOptions.setHTML(1, 0, constants.domain());
    advancedOptions.setWidget(1, 1, hostBox);

    advancedOptions.setHTML(2, 0, constants.host());
    advancedOptions.setWidget(2, 1, portBox);

    advancedOptions.setHTML(3, 0, constants.port());
    advancedOptions.setWidget(3, 1, domainBox);

    advancedOptions.setWidget(4, 0, authCheck);

    // Add advanced options to form in a disclosure panel
    DisclosurePanel advancedDisclosure = new DisclosurePanel(constants.moreOptions());
    advancedDisclosure.setAnimationEnabled(true);
    advancedDisclosure.ensureDebugId("cwDisclosurePanel");
    advancedDisclosure.setContent(advancedOptions);
    layout.setWidget(2, 0, advancedDisclosure);

    Button loginButton = new Button(constants.login());

    layout.setWidget(3, 0, loginButton);
    loginButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
        public void componentSelected(ButtonEvent ce) {
            String user = userBox.getText();
            String pass = passBox.getText();
            String domain = domainBox.getText();
            String host = domainBox.getText();
            boolean sasl = authCheck.isChecked();
            if (serverConfig.isChecked()) {
                int port = Integer.parseInt(portBox.getText());
                //JabberApp.instance().onLogin(host, port, domain, sasl, user, pass);
            } else {
                //JabberApp.instance().onLogin(user, pass);
            }
        }

    });

    cellFormatter.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER);

    cellFormatter.setColSpan(3, 0, 2);

    return layout;
}

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

License:Open Source License

protected void setAllEnabled(boolean b) {
    int sz = this.boxes.size();
    for (int i = 0; i < sz; i++) {
        CheckBox cb = (CheckBox) this.boxes.elementAt(i);
        if (!cb.isChecked()) {
            cb.setEnabled(b);
        }// w  w w .  j av  a2 s. c o m
    }
}

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

License:Open Source License

protected Widget getContent() {
    ScrollPanel scroller = new ScrollPanel();
    scroller.setStyleName("list-popup-scroll-panel");
    VerticalPanel table = new VerticalPanel();
    VerticalPanel scrolledTable = new VerticalPanel();
    scroller.add(scrolledTable);/*w w w . j a va  2s .co  m*/
    //      table.setStyleName("list-control-table");

    /*
    HorizontalPanel header1 = new HorizontalPanel();
    header1.add(createLabel("Conference Permissions","conference-permissions-header"));
            
    Label chat1 = createLabel("Chat","conference-chat-button-header");
    header1.add(chat1);
    Label audio1 = createLabel("Audio","conference-chat-button-header");
    header1.add(audio1);
    Label video1 = createLabel("Video","conference-chat-button-header");
    header1.add(video1);
            
    header1.addStyleName("common-dialog-row");
    table.add(header1);
            
    HorizontalPanel defaultsRow = new HorizontalPanel();
    defaultsRow.addStyleName("common-dialog-row");
    Label text1 = createTextHTML("Let all attendees to:",
       "conference-permissions-comment-1");
    defaultsRow.add(text1);
            
    HorizontalPanel hp21 = new HorizontalPanel();
    CheckBox cb11 = new CheckBox();
    hp21.add(cb11);
    hp21.setStyleName("user-chat-button");
    hp21.setCellHorizontalAlignment(cb11,HorizontalPanel.ALIGN_LEFT);
    hp21.setCellVerticalAlignment(cb11,VerticalPanel.ALIGN_MIDDLE);
    defaultsRow.add(hp21);
    defaultsRow.setCellHorizontalAlignment(hp21,HorizontalPanel.ALIGN_LEFT);
    defaultsRow.setCellVerticalAlignment(hp21,VerticalPanel.ALIGN_MIDDLE);
            
    HorizontalPanel hp31 = new HorizontalPanel();
    CheckBox cb21 = new CheckBox();
    hp31.add(cb21);
    hp31.setStyleName("user-chat-button");
    hp31.setCellHorizontalAlignment(cb21,HorizontalPanel.ALIGN_LEFT);
    hp31.setCellVerticalAlignment(cb21,VerticalPanel.ALIGN_MIDDLE);
    defaultsRow.add(hp31);
    defaultsRow.setCellHorizontalAlignment(hp31,HorizontalPanel.ALIGN_LEFT);
    defaultsRow.setCellVerticalAlignment(hp31,VerticalPanel.ALIGN_MIDDLE);
            
    HorizontalPanel hp41 = new HorizontalPanel();
    CheckBox cb31 = new CheckBox();
    hp41.add(cb31);
    hp41.setStyleName("user-chat-button");
    hp41.setCellHorizontalAlignment(cb31,HorizontalPanel.ALIGN_LEFT);
    hp41.setCellVerticalAlignment(cb31,VerticalPanel.ALIGN_MIDDLE);
    defaultsRow.add(hp41);
    defaultsRow.setCellHorizontalAlignment(hp41,HorizontalPanel.ALIGN_LEFT);
    defaultsRow.setCellVerticalAlignment(hp41,VerticalPanel.ALIGN_MIDDLE);
            
    table.add(defaultsRow);
            
    HTML line1 = new HTML("&nbsp;");
    line1.setStyleName("section-break");
    table.add(line1);
            
    HorizontalPanel header2 = new HorizontalPanel();
    header2.add(createLabel("Enable Meeting Lobby","conference-permissions-header"));
            
    HorizontalPanel hp22 = new HorizontalPanel();
    CheckBox cb12 = new CheckBox();
    hp22.add(cb12);
    hp22.setStyleName("user-chat-button");
    hp22.setCellHorizontalAlignment(cb12,HorizontalPanel.ALIGN_LEFT);
    hp22.setCellVerticalAlignment(cb12,VerticalPanel.ALIGN_MIDDLE);
    header2.add(hp22);
    header2.setCellHorizontalAlignment(hp22,HorizontalPanel.ALIGN_LEFT);
    header2.setCellVerticalAlignment(hp22,VerticalPanel.ALIGN_MIDDLE);
            
    HTML filler1 = new HTML(".");
    filler1.setStyleName("conference-button-filler");
    header2.setCellHorizontalAlignment(filler1,HorizontalPanel.ALIGN_LEFT);
    header2.setCellVerticalAlignment(filler1,VerticalPanel.ALIGN_MIDDLE);
    header2.add(filler1);
            
    HTML filler2 = new HTML(".");
    filler2.setStyleName("conference-button-filler");
    header2.setCellHorizontalAlignment(filler2,HorizontalPanel.ALIGN_LEFT);
    header2.setCellVerticalAlignment(filler2,VerticalPanel.ALIGN_MIDDLE);
    header2.add(filler2);
            
    header2.addStyleName("common-dialog-row");
    table.add(header2);
            
    HTML line2 = new HTML("&nbsp;");
    line2.setStyleName("section-break");
    table.add(line2);
            
    */

    int size = this.listModel.getListSize();
    //   Now all the users if any are available.
    if (size > 0) {
        UIResources uiResources = UIResources.getUIResources();
        HorizontalPanel header = new HorizontalPanel();
        header.add(createLabel(ConferenceGlobals.getDisplayString("console.moodlabel", "Mood"),
                "user-image-header"));
        header.add(createLabel(UIStrings.getNameLabel(), "user-name-header"));
        //header.add(createLabel(UIStrings.getEmailLabel(),"user-email-header"));

        //if private chat is disbaled as feature 
        if (ConferenceGlobals.privateChatEnabled) {
            chatHeaderLabel = createLabel(UIStrings.getChatLabel(), "user-chat-button-header");
            chatHeaderLabel.addStyleName("common-anchor-default-color");
            header.add(chatHeaderLabel);
            chatHeaderLabel.addClickListener(this);
        }
        if (!ConferenceGlobals.isPresenterAVAudioDisabled() && ConferenceGlobals.partListEnabled) {
            String label = UIStrings.getAudioLabel();
            if (ConferenceGlobals.isPresenterAVVideoOnly()) {
                label = UIStrings.getVideoLabel();
                audioCheckBoxSet.setMaxChecked(userManager.getMaximumAttendeeVideos());
            }
            Label audio = createLabel(label, "user-chat-button-header");
            header.add(audio);
        }
        //         Label video = createLabel("Video","user-chat-button-header");
        //         header.add(video);

        header.addStyleName("common-dialog-row");
        table.add(header);
        table.add(scroller);
        table.setCellWidth(scroller, "100%");
        int i = 0;
        for (i = 0; i < size; i++) {
            UserListEntry ule = (UserListEntry) this.listModel.getListEntryAt(i);
            final UIRosterEntry user = ule.getUser();
            if (user.isHost()) {
                continue;
            }
            HorizontalPanel row = new HorizontalPanel();

            HorizontalPanel hp1 = new HorizontalPanel();
            Image image = UserGlobals.getUserGlobals().getMoodImageUrl(user.getMood());
            hp1.add(image);
            hp1.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_CENTER);
            hp1.setCellVerticalAlignment(image, VerticalPanel.ALIGN_MIDDLE);
            hp1.setStyleName("user-image");

            row.add(hp1);
            row.setCellHorizontalAlignment(hp1, HorizontalPanel.ALIGN_CENTER);
            row.setCellVerticalAlignment(hp1, VerticalPanel.ALIGN_MIDDLE);

            Label nameLabel = createTextHTML(user.getDisplayName(), "user-name");
            if (ConferenceGlobals.privateChatEnabled) {
                nameLabel.addClickListener(new ClickListener() {
                    public void onClick(Widget sender) {
                        NewChatController.getController().showChatPopupIfPossible(user);
                        hide();
                    }
                });
                nameLabel.addStyleName("common-anchor-default-color");
            }
            row.add(nameLabel);

            if (ConferenceGlobals.privateChatEnabled) {
                HorizontalPanel hp2 = new HorizontalPanel();
                CheckBox cb1 = new CheckBox();
                hp2.add(cb1);
                hp2.setStyleName("user-chat-button");
                hp2.setCellHorizontalAlignment(cb1, HorizontalPanel.ALIGN_LEFT);
                hp2.setCellVerticalAlignment(cb1, VerticalPanel.ALIGN_MIDDLE);
                row.add(hp2);
                row.setCellHorizontalAlignment(hp2, HorizontalPanel.ALIGN_LEFT);
                row.setCellVerticalAlignment(hp2, VerticalPanel.ALIGN_MIDDLE);
                cb1.setChecked(user.isChatOn());
                this.chatCheckBoxes.put(user.getUserId(), cb1);
            }

            if (!ConferenceGlobals.isPresenterAVAudioDisabled() && ConferenceGlobals.partListEnabled) {
                HorizontalPanel hp3 = new HorizontalPanel();
                CheckBox cb2 = new CheckBox();
                hp3.add(cb2);
                hp3.setStyleName("user-chat-button");
                hp3.setCellHorizontalAlignment(cb2, HorizontalPanel.ALIGN_LEFT);
                hp3.setCellVerticalAlignment(cb2, VerticalPanel.ALIGN_MIDDLE);
                row.add(hp3);
                row.setCellHorizontalAlignment(hp3, HorizontalPanel.ALIGN_LEFT);
                row.setCellVerticalAlignment(hp3, VerticalPanel.ALIGN_MIDDLE);
                if (user.isVideoOn() && !ConferenceGlobals.isPresenterAVVideoOnly()) {
                    cb2.setChecked(user.isVideoOn());
                    cb2.setEnabled(false);
                } else {
                    cb2.setChecked(user.isAudioOn());
                    if (ConferenceGlobals.isPresenterAVVideoOnly()) {
                        cb2.setChecked(user.isVideoOn());
                    }
                    this.audioCheckBoxes.put(user.getUserId(), cb2);
                    this.audioCheckBoxSet.addCheckBox(cb2);
                }
            }
            /*
            HorizontalPanel hp4 = new HorizontalPanel();
            CheckBox cb3 = new CheckBox();
            hp4.add(cb3);
            hp4.setStyleName("user-chat-button");
            hp4.setCellHorizontalAlignment(cb3,HorizontalPanel.ALIGN_LEFT);
            hp4.setCellVerticalAlignment(cb3,VerticalPanel.ALIGN_MIDDLE);
            row.add(hp4);
            row.setCellHorizontalAlignment(hp4,HorizontalPanel.ALIGN_LEFT);
            row.setCellVerticalAlignment(hp4,VerticalPanel.ALIGN_MIDDLE);
            cb3.setChecked(user.isVideoOn());
            this.videoCheckBoxes.put(user.getUserId(),cb3);
            */

            row.addStyleName("common-dialog-row");
            scrolledTable.add(row);
        }
    } else {
        HorizontalPanel header2 = new HorizontalPanel();
        header2.add(createLabel(UIStrings.getNoParticipantsMessage(), "conference-permissions-header"));

        table.add(header2);
    }
    return table;
}

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

License:Open Source License

protected Widget getContent() {
    table = new VerticalPanel();
    Widget content = table;/*from   ww w. jav a2 s.  c om*/
    //      table.setStyleName("list-control-table");
    UIResourceObject currentActiveResource = ConferenceGlobals.getCurrentSharedResource();

    HorizontalPanel header = new HorizontalPanel();
    header.add(createLabel(".", "resource-image-header"));
    header.add(createLabel(UIStrings.getNameLabel(), "resource-name-header"));
    header.add(createLabel(UIStrings.getTypeLabel(), "resource-type-header"));
    if (this.allowResourceControl) {
        deleteHeader = createLabel(UIStrings.getDeleteLabel(), "resource-delete-button-header");
        deleteHeader.addStyleName("common-anchor-default-color");
        deleteHeader.addClickListener(this);
        header.add(deleteHeader);
    }
    header.addStyleName("common-dialog-row");
    table.add(header);

    int size = this.listModel.getListSize();
    if (size > 5) {
        VerticalPanel vp = new VerticalPanel();
        ScrollPanel scroller = new ScrollPanel();
        scroller.setStyleName("resource-control-dialog-height");
        scroller.add(table);
        vp.add(scroller);
        content = vp;
    }
    int i = 0;

    Vector sortedList = getSortedList(listModel);
    for (i = 0; i < size; i++) {
        ResourceListEntry rle = (ResourceListEntry) sortedList.get(i);
        UIResourceObject res = rle.getResource();
        if (this.typeName != null && !res.getResourceType().equals(this.typeName)) {
            continue;
        }
        //         UIListEntryPanelMouseAndClickListener mcl = new UIListEntryPanelMouseAndClickListener(
        //               rle,this.resourceListAndEntryProperties,this.listEntryManager);
        //         mcl.setSecondLevelPopup(true);

        HorizontalPanel row = new HorizontalPanel();

        HorizontalPanel hp1 = new HorizontalPanel();
        Image image = getImage(res);
        hp1.add(image);
        hp1.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_CENTER);
        hp1.setCellVerticalAlignment(image, VerticalPanel.ALIGN_MIDDLE);
        hp1.addStyleName("resource-image");
        row.add(hp1);
        row.setCellHorizontalAlignment(hp1, HorizontalPanel.ALIGN_CENTER);
        row.setCellVerticalAlignment(hp1, VerticalPanel.ALIGN_MIDDLE);

        //         table.setWidget((i+1), 0, image);
        Label nameLabel = createTextHTML(res.getResourceName(), "resource-name", 23);
        //         nameLabel.addStyleName("common-anchor");
        //         nameLabel.addClickListener(mcl);
        //         nameLabel.addMouseListener(mcl);
        row.add(nameLabel);

        row.add(createTextHTML(ResourceGlobals.getResourceGlobals().getResourceTypeNiceName(res),
                "resource-type"));

        if (this.allowResourceControl) {
            HorizontalPanel hp2 = new HorizontalPanel();
            CheckBox cb = new CheckBox();
            hp2.add(cb);
            hp2.setStyleName("resource-delete-button");
            hp2.setCellHorizontalAlignment(cb, HorizontalPanel.ALIGN_LEFT);
            hp2.setCellVerticalAlignment(cb, VerticalPanel.ALIGN_MIDDLE);
            row.add(hp2);
            row.setCellHorizontalAlignment(hp2, HorizontalPanel.ALIGN_LEFT);
            row.setCellVerticalAlignment(hp2, VerticalPanel.ALIGN_MIDDLE);
            cb.addClickListener(this);
            this.checkBoxes.put(res.getResourceId(), cb);
            this.checkBoxes2.put(cb, cb);
            if (!ResourceGlobals.allowDelete(res) || (currentActiveResource != null
                    && currentActiveResource.getResourceId().equals(res.getResourceId()))) {
                cb.setEnabled(false);
            }
        }
        row.addStyleName("common-dialog-row");
        table.add(row);
        this.rows.put(res.getResourceId(), row);
    }
    return content;
}

From source file:com.dingziran.effective.client.content.widgets.CwCheckBox.java

License:Apache License

/**
 * Constructor.// w  w w  .j av  a2s.co  m
 *
 * @param constants the constants
 */
public CwCheckBox(CwConstants constants) {
    super(constants.cwCheckBoxName(), constants.cwCheckBoxDescription());
    this.constants = constants;

    view = new ContentWidgetView(hasMargins(), hasScrollableContent());
    view.setName(getName());
    view.setDescription(getDescription());
    setWidget(view);
    // 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);
    }
    view.setExample(vPanel);
}

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

License:Open Source License

/**
 * To set Document Type List./*from  ww  w . ja v  a 2 s  . co m*/
 * 
 * @param documentTypeDTOs Collection<DocumentTypeDTO>
 * @return List<Record>
 */
public List<Record> setDocumentTypeList(Collection<DocumentTypeDTO> documentTypeDTOs) {

    List<Record> recordList = new LinkedList<Record>();
    for (final DocumentTypeDTO documentTypeDTO : documentTypeDTOs) {
        if (!documentTypeDTO.getName().equalsIgnoreCase(AdminConstants.DOCUMENT_TYPE_UNKNOWN)) {
            CheckBox isHidden = new CheckBox();
            isHidden.setValue(documentTypeDTO.isHidden());
            isHidden.setEnabled(false);
            Record record = new Record(documentTypeDTO.getIdentifier());
            record.addWidget(docTypeListView.name, new Label(documentTypeDTO.getName()));
            record.addWidget(docTypeListView.description, new Label(documentTypeDTO.getDescription()));
            record.addWidget(docTypeListView.isHidden, isHidden);
            recordList.add(record);
        }
    }
    return recordList;
}

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 . j a  v a  2 s  .c om
 * 
 * @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.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 v a2  s  . c om*/
        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);
                }

            });
        }
    }

}