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:org.fao.fenix.web.modules.metadataeditor.client.view.ColumnDefinitionPanel.java

License:Open Source License

public HorizontalPanel buildDescriptorPanel(String headerValue, String dataTypeValue, boolean isKey,
        List<OptionVO> options, boolean isEditable) {

    HorizontalPanel descriptorPanel = new HorizontalPanel();
    descriptorPanel.setSpacing(10);/*from w w w  .j a  v a  2s  .c  o m*/
    descriptorPanel.setWidth("700px");

    CheckBox keyCheck = new CheckBox("Key");
    keyCheck.setChecked(isKey);
    keyCheck.setEnabled(isEditable);

    HTML headerLabel = new HTML("<b><font color='" + RED + "'>" + BabelFish.print().header() + ":</font></b>");
    TextField<String> header = new TextField<String>();
    header.setAllowBlank(false);
    header.setWidth("100px");
    header.setFieldLabel("<b>Header: </b>");
    header.setValue(headerValue);
    header.setReadOnly(!isEditable);

    HTML typeLabel = new HTML("<b><font color='" + RED + "'>" + BabelFish.print().dataType() + ":</font></b>");
    typeLabel.setWidth("75px");
    ComboBox<DataTypeModelData> typeList = new ComboBox<DataTypeModelData>();
    typeList.setTriggerAction(TriggerAction.ALL);
    ListStore<DataTypeModelData> typeStore = new ListStore<DataTypeModelData>();
    typeList.setStore(typeStore);
    typeList.setDisplayField("dataType");
    typeList.setReadOnly(!isEditable);

    IconButton addOptionButton = new IconButton("mapAddDataset");
    addOptionButton.setTitle(BabelFish.print().addOption());
    addOptionButton.addListener(Events.OnClick, MEController.addOption(this, columnKey, "", "", isEditable));
    addOptionButton.setEnabled(isEditable);

    Button removeColumnButton = new Button(BabelFish.print().removeColumn());
    removeColumnButton.addSelectionListener(MEController.removeColumn(this, columnKey));
    removeColumnButton.setEnabled(isEditable);

    descriptorPanel.add(keyCheck);
    descriptorPanel.add(headerLabel);
    descriptorPanel.add(header);
    descriptorPanel.add(typeLabel);
    descriptorPanel.add(typeList);
    descriptorPanel.add(addOptionButton);
    descriptorPanel.add(removeColumnButton);

    descriptorPanel.setData("dataTypeComboBox", typeList);
    descriptorPanel.setData("header", header);
    descriptorPanel.setData("dataType", typeList);
    descriptorPanel.setData("isKey", keyCheck);

    MEController.fillDataTypeComboBox(descriptorPanel, dataTypeValue);

    return descriptorPanel;
}

From source file:org.gatein.management.gadget.client.Application.java

License:Open Source License

/**
 * Create and return the dialog box for the site upload.
 *
 * @return a {@code DialogBox}//from  w  w w  .  j  ava 2  s.c o m
 */
private DialogBox createDialogBox() {

    // Create a dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Import site");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setModal(true);
    dialogBox.setGlassEnabled(true);

    final AbsolutePanel absolutePanel = new AbsolutePanel();
    dialogBox.setWidget(absolutePanel);
    absolutePanel.setStyleName("status-panel");
    absolutePanel.setSize("400px", "220px");

    final Button importButton = new Button("Import");
    final CheckBox overwriteBox = new CheckBox("Overwrite the existing site");
    final HTML statusImg = new HTML("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", true);
    final Label statusLabel = new Label("status label");
    final Label headerLabel = new Label("Select file to import :");
    final AbsolutePanel statusPanel = new AbsolutePanel();
    headerLabel.setSize("380px", "39px");
    headerLabel.setStyleName("header-style");
    absolutePanel.add(headerLabel, 10, 10);

    final MultiUploader uploader = new GTNMultiUploader();
    uploader.setAvoidRepeatFiles(false);
    absolutePanel.add(uploader, 10, 46);
    uploader.setSize("380px", "32px");
    uploader.addOnChangeUploadHandler(new IUploader.OnChangeUploaderHandler() {

        @Override
        public void onChange(IUploader uploader) {
            // Nothing to do
            if (uploader.getFileName() != null) {
                importButton.setEnabled(true);
            }
        }
    });

    // Add a finish handler which will notify user once the upload finishes
    uploader.addOnFinishUploadHandler(new IUploader.OnFinishUploaderHandler() {

        public void onFinish(IUploader uploader) {

            switch (uploader.getStatus()) {
            case SUCCESS:
                statusLabel.setText("File uploaded with success");
                statusLabel.setStyleName("success-style");
                statusImg.setStyleName("success-style-icon");
                break;
            case ERROR:
                statusLabel.setText("File upload error");
                statusLabel.setStyleName("error-style");
                statusImg.setStyleName("error-style-icon");
                break;
            case CANCELED:
                statusLabel.setText("File upload canceled");
                statusLabel.setStyleName("warn-style");
                statusImg.setStyleName("warn-style-icon");
                break;
            default:
                statusLabel.setText("");
                statusLabel.setStyleName("blank-style");
                statusImg.setStyleName("blank-style");
                break;
            }

            overwriteBox.setEnabled(true);
            importButton.setEnabled(true);
        }
    });
    // Add a start handler which will disable the UI until the upload finishes
    uploader.addOnStartUploadHandler(new IUploader.OnStartUploaderHandler() {

        boolean isShwon = false;

        public void onStart(IUploader uploader) {
            statusLabel.setText("Process in progress...");
            statusLabel.setStyleName("progress-style");
            statusImg.setStyleName("progress-style-icon");
            overwriteBox.setEnabled(false);
            importButton.setEnabled(false);
            if (!isShwon) {
                statusPanel.setStyleName("status-panel");
                statusPanel.setSize("380px", "0px");
                absolutePanel.add(statusPanel, 10, 120);

                Timer t = new Timer() {

                    int dx = 5;
                    int height = 0;

                    public void run() {
                        height += dx;
                        statusPanel.setHeight(height + "px");
                        if (height >= 45) {
                            cancel(); // Stop the timer
                        }
                    }
                };

                // Schedule the timer to run once in 100 milliseconds.
                t.scheduleRepeating(100);
                isShwon = true;
            }
        }
    });
    // accept only zip files
    uploader.setValidExtensions(new String[] { "zip" });
    // You can add customized parameters to servlet call
    uploader.setServletPath(UPLOAD_ACTION_URL + "?pc=" + getPortalContainerName());

    overwriteBox.setTitle("If you want to force overwriting an existing site, check this checkbox");
    overwriteBox.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            String url = UPLOAD_ACTION_URL + "?pc=" + getPortalContainerName() + "&overwrite="
                    + overwriteBox.getValue();
            uploader.setServletPath(url);
        }
    });

    absolutePanel.add(overwriteBox, 10, 84);
    Button closeButton = new Button("Close", new ClickHandler() {

        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    absolutePanel.add(closeButton, 343, 188);

    statusImg.setStyleName("progress-style-icon");
    statusPanel.add(statusImg, 10, 10);
    statusImg.setSize("50px", "30px");

    statusPanel.add(statusLabel, 60, 15);
    statusLabel.setSize("300px", "25px");

    importButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {

            uploader.submit();
        }
    });
    importButton.setEnabled(false);
    absolutePanel.add(importButton, 10, 188);

    return dialogBox;
}

From source file:org.gss_project.gss.admin.client.ui.FilesTable.java

License:Open Source License

private DefaultTableDefinition<FileHeaderDTO> createTableDefinition() {
    tableDefinition = new DefaultTableDefinition<FileHeaderDTO>();

    final String[] rowColors = new String[] { "#FFFFDD", "EEEEEE" };
    tableDefinition.setRowRenderer(new DefaultRowRenderer<FileHeaderDTO>(rowColors));

    // id/*w ww.  j  a  v a2  s. c  om*/
    {
        IdColumnDefinition columnDef = new IdColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(false);
        columnDef.setPreferredColumnWidth(35);
        columnDef.setHeader(0, new HTML("Id"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    {
        NameColumnDefinition columnDef = new NameColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("File Name"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    {
        UriColumnDefinition columnDef = new UriColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("URI"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    // username
    {
        UserColumnDefinition columnDef = new UserColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Username"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    {
        FilesizeDefinition columnDef = new FilesizeDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("File Size"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    {
        DeletedColumnDefinition columnDef = new DeletedColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Deleted"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        columnDef.setCellRenderer(new CellRenderer<FileHeaderDTO, Boolean>() {

            @Override
            public void renderRowValue(FileHeaderDTO rowValue,
                    ColumnDefinition<FileHeaderDTO, Boolean> aColumnDef, AbstractCellView<FileHeaderDTO> view) {
                CheckBox check = new CheckBox();
                check.setValue(aColumnDef.getCellValue(rowValue));
                check.setEnabled(false);
                view.setWidget(check);

            }
        });
        tableDefinition.addColumnDefinition(columnDef);
    }

    {
        CreationColumnDefinition columnDef = new CreationColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Creation Date"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }

    {
        LastModifiedColumnDefinition columnDef = new LastModifiedColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Modification Date"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }

    return tableDefinition;
}

From source file:org.gss_project.gss.admin.client.ui.PermissionsList.java

License:Open Source License

public void updateTable() {
    int i = 1;/*from   w w w.j  av  a  2 s  .c  om*/
    if (toRemove != null) {
        permissions.remove(toRemove);
        toRemove = null;
    }
    for (final PermissionDTO dto : permissions) {

        Button removeButton = new Button("remove", new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                toRemove = dto;
                updateTable();
                hasChanges = true;
            }
        });

        if (dto.getUser() != null)
            if (dto.getUser() != null && dto.getUser().getUsername().equals(owner)) {
                permTable.setHTML(i, 0, "<span>" + "&nbsp;Owner</span>");
                removeButton.setVisible(false);
            } else {
                HTML userLabel = new HTML("<a href='#'>" + dto.getUser().getUsername() + "</a></span>");
                permTable.setWidget(i, 0, userLabel);
                userLabel.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        TwoAdmin.get().searchUsers("username:" + dto.getUser().getUsername());

                    }
                });
            }
        else if (dto.getGroup() != null) {
            //String user = GSS.get().getCurrentUserResource().getUsername();
            String[] names = dto.getGroup().getName().split("/");
            String name = URL.decodeComponent(names[names.length - 1]);
            //String ownr = names.length>1 ? URL.decodeComponent(names[names.length - 3]) : user;
            String groupName = name;
            permTable.setHTML(i, 0, "<span>" + "&nbsp;" + groupName + "</span>");
        }
        CheckBox read = new CheckBox();
        read.setValue(dto.getRead());
        CheckBox write = new CheckBox();
        write.setValue(dto.getWrite());
        CheckBox modify = new CheckBox();
        modify.setValue(dto.getModifyACL());
        permTable.setWidget(i, 1, read);
        permTable.setWidget(i, 2, write);
        permTable.setWidget(i, 3, modify);
        if (dto.getUser() != null && dto.getUser().getUsername().equals(owner) || !allowEditPermissions) {
            read.setEnabled(false);
            write.setEnabled(false);
            modify.setEnabled(false);
        } else
            permTable.setWidget(i, 4, removeButton);
        permTable.getFlexCellFormatter().setStyleName(i, 0, "props-labels");
        permTable.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER);
        permTable.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_CENTER);
        permTable.getFlexCellFormatter().setHorizontalAlignment(i, 3, HasHorizontalAlignment.ALIGN_CENTER);
        i++;
    }
    for (; i < permTable.getRowCount(); i++)
        permTable.removeRow(i);
    hasChanges = false;

}

From source file:org.gss_project.gss.admin.client.ui.UsersTable.java

License:Open Source License

private DefaultTableDefinition<UserDTO> createTableDefinition() {
    tableDefinition = new DefaultTableDefinition<UserDTO>();

    final String[] rowColors = new String[] { "#FFFFDD", "EEEEEE" };
    tableDefinition.setRowRenderer(new DefaultRowRenderer<UserDTO>(rowColors));

    // id//from   w  w w  .  j  av a  2  s.  c  o  m
    {
        IdColumnDefinition columnDef = new IdColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(false);
        columnDef.setPreferredColumnWidth(35);
        columnDef.setHeader(0, new HTML("Id"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    {
        UserClassColumnDefinition columnDef = new UserClassColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("User Class"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    {
        ActiveColumnDefinition columnDef = new ActiveColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Active"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        columnDef.setCellRenderer(new CellRenderer<UserDTO, Boolean>() {

            @Override
            public void renderRowValue(UserDTO rowValue, ColumnDefinition<UserDTO, Boolean> aColumnDef,
                    AbstractCellView<UserDTO> view) {
                CheckBox check = new CheckBox();
                check.setValue(aColumnDef.getCellValue(rowValue));
                check.setEnabled(false);
                view.setWidget(check);

            }
        });
        tableDefinition.addColumnDefinition(columnDef);
    }
    // username
    {
        UsernameColumnDefinition columnDef = new UsernameColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Username"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    {
        EmailColumnDefinition columnDef = new EmailColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Email"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }
    {
        FullNameColumnDefinition columnDef = new FullNameColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Name"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }

    {
        LastLoginColumnDefinition columnDef = new LastLoginColumnDefinition();
        columnDef.setColumnSortable(true);
        columnDef.setColumnTruncatable(true);
        columnDef.setHeader(0, new HTML("Last Login"));
        columnDef.setHeaderCount(1);
        columnDef.setHeaderTruncatable(false);
        tableDefinition.addColumnDefinition(columnDef);
    }

    return tableDefinition;
}

From source file:org.gss_project.gss.web.client.PermissionsList.java

License:Open Source License

/**
 * Shows the permission table /*from  w w  w  .  j a  va2 s . c o  m*/
 */
private void showPermissionTable() {
    int i = 1;
    if (toRemove != null) {
        permissions.remove(toRemove);
        toRemove = null;
    }
    for (final PermissionHolder dto : permissions) {
        PushButton removeButton = new PushButton(AbstractImagePrototype.create(images.delete()).createImage(),
                new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        toRemove = dto;
                        updateTable();
                        hasChanges = true;
                    }
                });

        if (dto.getUser() != null) {
            if (dto.getUser() != null && dto.getUser().equals(owner)) {
                permTable.setHTML(i, 0, "<span id=permissionList.Owner>"
                        + AbstractImagePrototype.create(images.permUser()).getHTML() + "&nbsp;Owner</span>");
                removeButton.setVisible(false);
            } else {
                permTable.setHTML(i, 0,
                        "<span id=permissionList." + GSS.get().findUserFullName(dto.getUser()) + ">"
                                + AbstractImagePrototype.create(images.permUser()).getHTML() + "&nbsp;"
                                + GSS.get().findUserFullName(dto.getUser()) + "</span>");
            }
        } else if (dto.getGroup() != null) {
            permTable.setHTML(i, 0,
                    "<span id=permissionList." + dto.getGroup() + ">"
                            + AbstractImagePrototype.create(images.permGroup()).getHTML() + "&nbsp;"
                            + dto.getGroup() + "</span>");
        }

        CheckBox read = new CheckBox();
        read.setValue(dto.isRead());
        read.getElement().setId("permissionList.read");

        CheckBox write = new CheckBox();
        write.setValue(dto.isWrite());
        write.getElement().setId("permissionList.write");

        CheckBox modify = new CheckBox();
        modify.setValue(dto.isModifyACL());
        modify.getElement().setId("permissionList.modify");

        if (dto.getUser() != null && dto.getUser().equals(owner)) {
            read.setEnabled(false);
            write.setEnabled(false);
            modify.setEnabled(false);
        }

        permTable.setWidget(i, 1, read);
        permTable.setWidget(i, 2, write);
        permTable.setWidget(i, 3, modify);
        permTable.setWidget(i, 4, removeButton);
        permTable.getFlexCellFormatter().setStyleName(i, 0, "props-labels");
        permTable.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER);
        permTable.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_CENTER);
        permTable.getFlexCellFormatter().setHorizontalAlignment(i, 3, HasHorizontalAlignment.ALIGN_CENTER);
        i++;
    }
    for (; i < permTable.getRowCount(); i++)
        permTable.removeRow(i);
    hasChanges = false;
}

From source file:org.jahia.ajax.gwt.client.widget.contentengine.ContentTabItem.java

License:Open Source License

@Override
public void attachPropertiesEditor(final NodeHolder engine, AsyncTabItem tab) {
    // handle jcr:title property
    setNameField(engine, tab);//w w w  .  ja v a 2s.  co m

    // attach properties node
    // Add information field
    FieldSet fieldSet = new FieldSet();
    final FormLayout fl = new FormLayout();
    fl.setLabelWidth(0);
    fieldSet.setLayout(fl);
    fieldSet.setHeadingHtml(Messages.get("label.information", "Information"));
    FormData fd = new FormData("98%");
    fd.setMargins(new Margins(0));
    final GWTJahiaNode selectedNode = engine.getNode();

    Grid g = new Grid(1, 2);
    g.setCellSpacing(10);
    FlowPanel flowPanel = new FlowPanel();

    if (selectedNode != null) {
        String preview = selectedNode.getReferencedNode() != null
                ? selectedNode.getReferencedNode().getPreview()
                : selectedNode.getPreview();
        if (preview != null) {
            g.setWidget(0, 0, new Image(URL.appendTimestamp(preview)));
        }

        if (JahiaGWTParameters.isDevelopmentMode()) {
            String path = selectedNode.getPath();
            if (path != null) {
                flowPanel.add(new HTML("<b>" + Messages.get("label.path") + ":</b> " + path));
            }
            String id = selectedNode.getUUID();
            if (id != null) {
                flowPanel.add(new HTML("<b>" + Messages.get("label.id", "ID") + ":</b> " + id));
            }
            if (selectedNode.isFile() != null && selectedNode.isFile()) {
                Long s = selectedNode.getSize();
                if (s != null) {
                    flowPanel.add(new HTML("<b>" + Messages.get("label.size") + ":</b> "
                            + Formatter.getFormattedSize(s.longValue()) + " (" + s.toString() + " bytes)"));
                }
            }
            Date date = selectedNode.get("jcr:lastModified");
            if (date != null) {
                flowPanel.add(new HTML("<b>" + Messages.get("label.lastModif") + ":</b> "
                        + org.jahia.ajax.gwt.client.util.Formatter.getFormattedDate(date, "d/MM/y")));
            }
            if (selectedNode.isLocked() != null && selectedNode.isLocked()
                    && selectedNode.getLockInfos() != null) {
                StringBuilder infos = new StringBuilder();
                if (selectedNode.getLockInfos().containsKey(null) && selectedNode.getLockInfos().size() == 1) {
                    for (String s : selectedNode.getLockInfos().get(null)) {
                        infos.append(Formatter.getLockLabel(s));
                    }
                } else {
                    for (Map.Entry<String, List<String>> entry : selectedNode.getLockInfos().entrySet()) {
                        if (entry.getKey() != null) {
                            if (infos.length() > 0) {
                                infos.append("; ");
                            }
                            infos.append(entry.getKey()).append(" : ");
                            int i = 0;
                            for (String s : entry.getValue()) {
                                if (i > 0) {
                                    infos.append(", ");
                                }
                                infos.append(Formatter.getLockLabel(s));
                                i++;
                            }
                        }
                    }
                }
                flowPanel.add(new HTML("<b>" + Messages.get("info.lock.label") + ":</b> " + infos));
            }

            flowPanel.add(new HTML(
                    "<b>" + Messages.get("nodes.label", "Types") + ":</b> " + selectedNode.getNodeTypes()));
            flowPanel.add(new HTML("<b>" + Messages.get("org.jahia.jcr.edit.tags.tab", "Tags") + ":</b> "
                    + selectedNode.getTags() != null ? selectedNode.getTags() : ""));
            if (engine.getNode() != null && ModuleHelper.getModulesByPath() != null) {
                List<Module> modules = ModuleHelper.getModulesByPath().get(engine.getNode().getPath());
                if (modules != null && modules.size() > 0 && modules.get(0).getScriptInfo() != null) {
                    flowPanel.add(new HTML("<b>" + Messages.get("script.info.label", "Script info") + ":</b> "
                            + modules.get(0).getScriptInfo()));
                }
            }
            g.setWidget(0, 1, flowPanel);
        }
        if (preview != null || JahiaGWTParameters.isDevelopmentMode()) {
            fieldSet.add(g, fd);
            propertiesEditor.add(fieldSet);
        }
    }
    //Invalid Languages selection
    List<GWTJahiaLanguage> siteLanguages = JahiaGWTParameters.getSiteLanguages();
    if (engine instanceof AbstractContentEngine) {
        siteLanguages = ((AbstractContentEngine) engine).getLanguageSwitcher().getStore().getModels();
    }
    if (invalidLanguagesFieldSet == null && siteLanguages.size() > 1
            && engine.getNodeTypes().get(0).getSuperTypes().contains("jmix:i18n")
            && isInvalidLanguagesAvailableForType(engine)) {
        final List<String> siteMandatoryLanguages = JahiaGWTParameters.getSiteMandatoryLanguages();
        invalidLanguagesCheckBoxes = new ArrayList<CheckBox>();

        LayoutContainer layoutContainer1 = new LayoutContainer();
        layoutContainer1.setBorders(false);
        layoutContainer1.setLayout(new FillLayout(Style.Orientation.HORIZONTAL) {
            @Override
            protected void setSize(Component c, int width, int height) {
                // This method stays empty so that we do not rely on GWT to calculate the size of the
                // checkboxes but let the browser do it.
            }
        });
        layoutContainer1.setWidth("100%");

        for (final GWTJahiaLanguage siteLanguage : siteLanguages) {
            CheckBox checkBox = new CheckBox();
            checkBox.setBoxLabel(siteLanguage.getDisplayName());
            checkBox.setValueAttribute(siteLanguage.getLanguage());
            /*checkBox.addListener(Events.Change, new Listener<ComponentEvent>() {
            public void handleEvent(ComponentEvent componentEvent) {
                CheckBox checkBox1 = (CheckBox) componentEvent.getSource();
                if (engine instanceof AbstractContentEngine) {
                    final ComboBox<GWTJahiaLanguage> languageSwitcher = ((AbstractContentEngine) engine).getLanguageSwitcher();
                    if (languageSwitcher != null) {
                        final ListStore<GWTJahiaLanguage> store = languageSwitcher.getStore();
                        if (store != null) {
                            GWTJahiaLanguage storeModel = store.findModel("language",
                                    checkBox1.getValueAttribute());
                            storeModel.setActive(checkBox1.getValue());
                        }
                        languageSwitcher.getView().refresh();
                    }
                }
            }
            });*/

            if (siteMandatoryLanguages.contains(siteLanguage.getLanguage())) {
                checkBox.setValue(true);
                checkBox.setEnabled(false);
            }

            if (selectedNode == null
                    || !selectedNode.getInvalidLanguages().contains(siteLanguage.getLanguage())) {
                checkBox.setValue(true);
            }
            //                Deactivate interactions between display languages checkboxes and language switcher
            /*else if (engine instanceof AbstractContentEngine) {
            AbstractContentEngine contentEngine = (AbstractContentEngine) engine;
            final GWTJahiaLanguage model = contentEngine.getLanguageSwitcher().getStore().findModel(
                    "language", siteLanguage.getLanguage());
            model.setActive(false);
            }*/
            layoutContainer1.add(checkBox);
            invalidLanguagesCheckBoxes.add(checkBox);

        }
        invalidLanguagesFieldSet = new FieldSet();
        invalidLanguagesFieldSet
                .setHeadingHtml(Messages.get("label.validLanguages", "Valid display languages"));
        invalidLanguagesFieldSet.setLayout(new FormLayout());
        invalidLanguagesFieldSet.add(layoutContainer1, fd);
    }
    super.attachPropertiesEditor(engine, tab);
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.AbstractFieldWidget.java

License:Apache License

private Widget constructBooleanWidget(final BooleanField field,
        List<HandlerRegistration> handlerRegistrations) {
    CheckBox checkBox = new CheckBox();
    checkBox.setValue(field.getValue());
    checkBox.setTitle(field.getDisplayPrompt());
    checkBox.setEnabled(!readOnly && !field.isReadOnly());
    if (!readOnly && !field.isReadOnly()) {
        handlerRegistrations.add(checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            @Override/*  www  .j  av  a2 s  .  co m*/
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                field.setValue(event.getValue());
                fireChanged();
            }
        }));
    }
    return checkBox;
}

From source file:org.kie.guvnor.guided.dtable.client.widget.ActionInsertFactPopup.java

License:Apache License

private Widget doInsertLogical() {
    HorizontalPanel hp = new HorizontalPanel();

    final CheckBox cb = new CheckBox();
    cb.setValue(editingCol.isInsertLogical());
    cb.setText("");
    cb.setEnabled(!isReadOnly);
    if (!isReadOnly) {
        cb.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent arg0) {
                if (oracle.isGlobalVariable(editingCol.getBoundName())) {
                    cb.setEnabled(false);
                    editingCol.setInsertLogical(false);
                } else {
                    editingCol.setInsertLogical(cb.getValue());
                }/*from  ww w.j a v a 2  s  .  com*/
            }
        });
    }
    hp.add(cb);
    hp.add(new InfoPopup(Constants.INSTANCE.LogicallyInsertANewFact(),
            Constants.INSTANCE.LogicallyAssertAFactTheFactWillBeRetractedWhenTheSupportingEvidenceIsRemoved()));
    return hp;
}

From source file:org.kie.guvnor.guided.dtable.client.widget.ActionSetFieldPopup.java

License:Apache License

private Widget doUpdate() {
    HorizontalPanel hp = new HorizontalPanel();

    final CheckBox cb = new CheckBox();
    cb.setValue(editingCol.isUpdate());/*from  w w w.java2  s.  c  o  m*/
    cb.setText("");
    cb.setEnabled(!isReadOnly);
    if (!isReadOnly) {
        cb.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent arg0) {
                if (oracle.isGlobalVariable(editingCol.getBoundName())) {
                    cb.setEnabled(false);
                    editingCol.setUpdate(false);
                } else {
                    editingCol.setUpdate(cb.getValue());
                }
            }
        });
    }
    hp.add(cb);
    hp.add(new InfoPopup(Constants.INSTANCE.UpdateFact(), Constants.INSTANCE.UpdateDescription()));
    return hp;
}