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

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

Introduction

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

Prototype

public CheckBox() 

Source Link

Document

Creates a check box with no label.

Usage

From source file:org.glimpse.client.news.NewsReader.java

License:Open Source License

public NewsReader(Map<String, String> properties) {
    super(properties);
    visitedEntries = ClientUtils.stringToList(getProperty("visitedEntries"));

    entriesTable = new EntriesTable(this);

    // Les boutons de commande du titre

    HorizontalPanel titlePanel = new HorizontalPanel();
    titlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    titleImage = new Image("images/feed.png");
    titleImage.setStylePrimaryName("component-title-image");
    titlePanel.add(titleImage);//from w  w w  .j a  va  2s. c om
    title.setHref("javascript:void(0)");
    title.setTarget("_blank");
    titlePanel.add(title);
    setTitleWidget(titlePanel);

    List<Widget> actions = new LinkedList<Widget>();
    FocusPanel refreshButton = new FocusPanel(new Image(Aggregator.TRANSPARENT_IMAGE));
    refreshButton.setTitle(constants.refresh());
    refreshButton.setStylePrimaryName("component-action-refresh");
    refreshButton.addClickHandler(new RefreshHandler());
    actions.add(refreshButton);

    if (Aggregator.getInstance().isModifiable()) {
        FocusPanel optionButton = new FocusPanel(new Image(Aggregator.TRANSPARENT_IMAGE));
        optionButton.addClickHandler(new OptionHandler());
        optionButton.setTitle(constants.options());
        optionButton.setStylePrimaryName("component-action-options");
        actions.add(optionButton);
    }

    setActions(actions);

    // Contenu
    VerticalPanel panel = new VerticalPanel();
    panel.setWidth("100%");

    optionPanel = new SimplePanel();
    optionPanel.setStylePrimaryName("component-options");
    VerticalPanel vp = new VerticalPanel();
    FlexTable table = new FlexTable();

    table.setText(0, 0, constants.url());
    urlField = new TextBox();
    table.setWidget(0, 1, urlField);

    table.setText(1, 0, constants.directOpen());
    directOpenBox = new CheckBox();
    table.setWidget(1, 1, directOpenBox);

    table.setText(2, 0, constants.maxEntries());
    maxBox = new ListBox();
    for (int i = 1; i <= 20; i++) {
        maxBox.addItem(String.valueOf(i));
    }
    table.setWidget(2, 1, maxBox);

    vp.add(table);

    synchronizeOptions();

    Button button = new Button(constants.ok());
    button.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            setProperty(PROPERTY_URL, urlField.getValue());
            setProperty(PROPERTY_DIRECT_OPEN, Boolean.toString(directOpenBox.getValue()));
            setProperty(PROPERTY_MAX_PER_PAGE, Integer.toString(maxBox.getSelectedIndex() + 1));
            Aggregator.getInstance().update();
            refresh();
        }
    });
    vp.add(button);
    optionPanel.add(vp);
    panel.add(optionPanel);

    // Le tableau des news
    panel.add(entriesTable);

    // image de chargement
    Image wait = new Image("wait.gif");
    loadingPanel.add(wait);
    loadingPanel.setWidth("100%");
    loadingPanel.setVisible(false);
    loadingPanel.setCellHorizontalAlignment(wait, HorizontalPanel.ALIGN_CENTER);
    panel.add(loadingPanel);

    // En cas d'erreur
    error = new Label(constants.error());
    error.setVisible(false);
    panel.add(error);

    // Les boutons de commande du bas
    HorizontalPanelExt bottomBar = new HorizontalPanelExt();
    bottomBar.setWidth("100%");

    previousButton.setText(constants.previous());
    previousButton.setHref("javascript:void(0)");
    previousButton.setStylePrimaryName("news-previous");
    previousButton.addClickHandler(new PreviousHandler());
    bottomBar.add(previousButton);
    bottomBar.setCellHorizontalAlignment(previousButton, HorizontalPanel.ALIGN_LEFT);

    nextButton.setText(constants.next());
    nextButton.setHref("javascript:void(0)");
    nextButton.setStylePrimaryName("news-next");
    nextButton.addClickHandler(new NextHandler());
    bottomBar.add(nextButton);
    bottomBar.setCellHorizontalAlignment(nextButton, HorizontalPanel.ALIGN_RIGHT);

    panel.add(bottomBar);

    setContent(panel);

    checkPreviousNext();
}

From source file:org.glom.web.client.ui.details.DetailsCell.java

License:Open Source License

public void setData(final DataItem dataItem) {
    detailsData.clear();//from   w  w w. j  a v  a2s  . com

    if (dataItem == null) {
        return;
    }

    Formatting formatting = layoutItem.getFormatting();

    // FIXME use the cell renderers from the list view to render the information here
    switch (this.dataType) {
    case TYPE_BOOLEAN:
        final CheckBox checkBox = new CheckBox();
        checkBox.setValue(dataItem.getBoolean());
        checkBox.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(final ClickEvent event) {
                // don't let users change the checkbox
                checkBox.setValue(dataItem.getBoolean());
            }
        });
        detailsData.add(checkBox);
        break;
    case TYPE_NUMERIC:
        if (formatting == null) {
            GWT.log("setData(): formatting is null");
            formatting = new Formatting(); // To avoid checks later.
        }
        final NumericFormat numericFormat = formatting.getNumericFormat();
        final NumberFormat gwtNumberFormat = Utils.getNumberFormat(numericFormat);

        // set the foreground color to red if the number is negative and this is requested
        if (numericFormat.getUseAltForegroundColorForNegatives() && dataItem.getNumber() < 0) {
            // The default alternative color in libglom is red.
            detailsData.getElement().getStyle()
                    .setColor(NumericFormat.getAlternativeColorForNegativesAsHTMLColor());
        }

        final String currencyCode = StringUtils.isEmpty(numericFormat.getCurrencySymbol()) ? ""
                : numericFormat.getCurrencySymbol().trim() + " ";
        detailsLabel.setText(currencyCode + gwtNumberFormat.format(dataItem.getNumber()));
        detailsData.add(detailsLabel);
        break;
    case TYPE_DATE:
    case TYPE_TIME:
    case TYPE_TEXT:
        final String text = StringUtils.defaultString(dataItem.getText());

        // Deal with multiline text differently than single line text.
        if ((formatting != null) && (formatting.getTextFormatMultilineHeightLines() > 1)) {
            detailsData.getElement().getStyle().setOverflow(Overflow.AUTO);
            // Convert '\n' to <br/> escaping the data so that it won't be rendered as HTML.
            try {
                // JavaScript requires the charsetName to be "UTF-8". CharsetName values that work in Java (such as
                // "UTF8") will not work when compiled to JavaScript.
                final String utf8NewLine = new String(new byte[] { 0x0A }, "UTF-8");
                final String[] lines = text.split(utf8NewLine);
                final SafeHtmlBuilder sb = new SafeHtmlBuilder();
                for (final String line : lines) {
                    sb.append(SafeHtmlUtils.fromString(line));
                    sb.append(SafeHtmlUtils.fromSafeConstant("<br/>"));
                }

                // Manually add the HTML to the detailsData container.
                final DivElement div = Document.get().createDivElement();
                div.setInnerHTML(sb.toSafeHtml().asString());
                detailsData.getElement().appendChild(div);

                // Expand the width of detailsData if a vertical scrollbar has been placed on the inside of the
                // detailsData container.
                final int scrollBarWidth = detailsData.getOffsetWidth() - div.getOffsetWidth();
                if (scrollBarWidth > 0) {
                    // A vertical scrollbar is on the inside.
                    detailsData.setWidth((detailsData.getOffsetWidth() + scrollBarWidth + 4) + "px");
                }

                // TODO Add horizontal scroll bars when detailsData expands beyond its container.

            } catch (final UnsupportedEncodingException e) {
                // If the new String() line throws an exception, don't try to add the <br/> tags. This is unlikely
                // to happen but we should do something if it does.
                detailsLabel.setText(text);
                detailsData.add(detailsLabel);
            }

        } else {
            final SingleLineText textPanel = new SingleLineText(text);
            detailsData.add(textPanel);
        }
        break;
    case TYPE_IMAGE:
        final Image image = new Image();
        final String imageDataUrl = dataItem.getImageDataUrl();
        if (imageDataUrl != null) {
            image.setUrl(imageDataUrl);

            // Set an arbitrary default size:
            // image.setPixelSize(200, 200);
        }

        detailsData.add(image);
        break;
    default:
        break;
    }

    this.dataItem = dataItem;

    // enable the navigation button if it's safe
    if (openButton != null && openButtonHandlerReg != null && this.dataItem != null) {
        openButton.setEnabled(true);
    }

}

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// ww w .  jav  a2  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);
    }
    {
        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;/*  w w w  . j a  v a2  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//  w  ww  .j a  va 2 s  .com
    {
        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.FilePropertiesDialog.java

License:Open Source License

/**
 * The widget's constructor./*from  ww  w . j  a v  a  2 s .c om*/
 *
 * @param images the dialog's ImageBundle
 * @param groups
 * @param bodies
 */
public FilePropertiesDialog(final Images images, final List<GroupResource> groups, List<FileResource> bodies,
        String _userFullName) {

    // Set the dialog's caption.
    setText("File properties");

    file = (FileResource) GSS.get().getCurrentSelection();
    userFullName = _userFullName;
    permList = new PermissionsList(images, file.getPermissions(), file.getOwner());

    GWT.log("FILE PERMISSIONS:" + file.getPermissions());
    // Outer contains inner and buttons.
    final VerticalPanel outer = new VerticalPanel();
    final FocusPanel focusPanel = new FocusPanel(outer);
    // Inner contains generalPanel and permPanel.
    inner = new DecoratedTabPanel();
    inner.setAnimationEnabled(true);
    final VerticalPanel generalPanel = new VerticalPanel();
    final VerticalPanel permPanel = new VerticalPanel();
    final HorizontalPanel buttons = new HorizontalPanel();
    final HorizontalPanel permButtons = new HorizontalPanel();
    final HorizontalPanel permForAll = new HorizontalPanel();
    final HorizontalPanel pathPanel = new HorizontalPanel();
    final VerticalPanel verPanel = new VerticalPanel();
    final HorizontalPanel vPanel = new HorizontalPanel();
    final HorizontalPanel vPanel2 = new HorizontalPanel();

    versioned.setValue(file.isVersioned());
    versioned.getElement().setId("filePropertiesDialog.chechBox.versioned");
    inner.add(generalPanel, "General");
    inner.add(permPanel, "Sharing");
    inner.add(verPanel, "Versions");
    inner.selectTab(0);

    final Label fileNameNote = new Label("Please note that slashes ('/') are not allowed in file names.", true);
    fileNameNote.setVisible(false);
    fileNameNote.setStylePrimaryName("gss-readForAllNote");

    final FlexTable generalTable = new FlexTable();
    generalTable.setText(0, 0, "Name");
    generalTable.setText(1, 0, "Folder");
    generalTable.setText(2, 0, "Owner");
    generalTable.setText(3, 0, "Last modified");
    generalTable.setText(4, 0, "Tags");
    name.setWidth("100%");
    name.setText(file.getName());
    name.getElement().setId("filePropertiesDialog.textBox.name");
    generalTable.setWidget(0, 1, name);
    name.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            if (name.getText().contains("/"))
                fileNameNote.setVisible(true);
            else
                fileNameNote.setVisible(false);

        }
    });

    if (file.getFolderName() != null)
        generalTable.setText(1, 1, file.getFolderName());
    else
        generalTable.setText(1, 1, "-");
    generalTable.setWidget(0, 2, fileNameNote);
    generalTable.setText(2, 1, userFullName);

    final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");
    generalTable.setText(3, 1, formatter.format(file.getModificationDate()));
    // Get the tags.
    StringBuffer tagsBuffer = new StringBuffer();
    Iterator i = file.getTags().iterator();
    while (i.hasNext()) {
        String tag = (String) i.next();
        tagsBuffer.append(tag).append(", ");
    }
    if (tagsBuffer.length() > 1)
        tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1);
    initialTagText = tagsBuffer.toString();
    tags.setWidth("100%");
    tags.getElement().setId("filePropertiesDialog.textBox.tags");
    tags.setText(initialTagText);
    generalTable.setWidget(4, 1, tags);
    generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(3, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(4, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values");
    generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values");
    generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values");
    generalTable.getFlexCellFormatter().setStyleName(3, 1, "props-values");
    generalTable.getFlexCellFormatter().setStyleName(4, 1, "props-values");
    generalTable.setCellSpacing(4);

    // Create the 'OK' button, along with a listener that hides the dialog
    // when the button is clicked.
    final Button ok = new Button("OK", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (name.getText().contains("/"))
                fileNameNote.setVisible(true);
            else {
                fileNameNote.setVisible(false);
                accept();
                closeDialog();
            }
        }
    });
    ok.getElement().setId("filePropertiesDialog.button.ok");
    buttons.add(ok);
    buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    // Create the 'Cancel' button, along with a listener that hides the
    // dialog when the button is clicked.
    final Button cancel = new Button("Cancel", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            closeDialog();
        }
    });
    cancel.getElement().setId("filePropertiesDialog.button.cancel");
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.addStyleName("gss-TabPanelBottom");

    generalPanel.add(generalTable);

    // Asynchronously retrieve the tags defined by this user.
    DeferredCommand.addCommand(new Command() {

        @Override
        public void execute() {
            updateTags();
        }
    });

    DisclosurePanel allTags = new DisclosurePanel("All tags");
    allTagsContent = new FlowPanel();
    allTagsContent.setWidth("100%");
    allTags.setContent(allTagsContent);
    generalPanel.add(allTags);
    generalPanel.setSpacing(4);

    final Button add = new Button("Add Group", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, false);
            dlg.center();
        }
    });
    add.getElement().setId("filePropertiesDialog.button.addGroup");
    permButtons.add(add);
    permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER);

    final Button addUser = new Button("Add User", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, true);
            dlg.center();
        }
    });
    add.getElement().setId("filePropertiesDialog.button.addUser");
    permButtons.add(addUser);
    permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER);

    permButtons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    permButtons.setSpacing(8);
    permButtons.addStyleName("gss-TabPanelBottom");

    final Label readForAllNote = new Label("When this option is enabled, the file will be readable"
            + " by everyone. By checking this option, you are certifying that you have the right to "
            + "distribute this file and that it does not violate the Terms of Use.", true);
    readForAllNote.setVisible(false);
    readForAllNote.setStylePrimaryName("gss-readForAllNote");

    readForAll = new CheckBox();
    readForAll.getElement().setId("filePropertiesDialog.checkBox.public");
    readForAll.setValue(file.isReadForAll());
    readForAll.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            readForAllNote.setVisible(readForAll.getValue());
        }

    });

    permPanel.add(permList);
    permPanel.add(permButtons);
    // Only show the read for all permission if the user is the owner.
    if (file.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) {
        permForAll.add(new Label("Public"));
        permForAll.add(readForAll);
        permForAll.setSpacing(8);
        permForAll.addStyleName("gss-TabPanelBottom");
        permForAll.add(readForAllNote);
        permPanel.add(permForAll);
    }

    TextBox path = new TextBox();
    path.setWidth("100%");
    path.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            GSS.enableIESelection();
            ((TextBox) event.getSource()).selectAll();
            GSS.preventIESelection();
        }

    });
    path.setText(file.getUri());
    path.getElement().setId("filePropertiesDialog.textBox.link");
    path.setTitle(
            "Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)");
    path.setWidth("100%");
    path.setReadOnly(true);
    pathPanel.setWidth("100%");
    pathPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    pathPanel.add(new Label("Link"));
    pathPanel.setSpacing(8);
    pathPanel.addStyleName("gss-TabPanelBottom");
    pathPanel.add(path);
    permPanel.add(pathPanel);

    VersionsList verList = new VersionsList(this, images, bodies);
    verPanel.add(verList);

    vPanel.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    vPanel.setSpacing(8);
    vPanel.addStyleName("gss-TabPanelBottom");
    vPanel.add(new Label("Versioned"));

    vPanel.add(versioned);
    verPanel.add(vPanel);
    vPanel2.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    vPanel2.setSpacing(8);
    vPanel2.addStyleName("gss-TabPanelBottom");
    Button removeVersionsButton = new Button(AbstractImagePrototype.create(images.delete()).getHTML(),
            new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    ConfirmationDialog confirm = new ConfirmationDialog(
                            "Really " + "remove all previous versions?", "Remove") {

                        @Override
                        public void cancel() {
                        }

                        @Override
                        public void confirm() {
                            FilePropertiesDialog.this.closeDialog();
                            removeAllOldVersions();
                        }

                    };
                    confirm.center();
                }

            });
    HTML removeAllVersion = new HTML("<span>Remove all previous versions?</span>");
    vPanel2.add(removeAllVersion);
    vPanel2.add(removeVersionsButton);
    verPanel.add(vPanel2);
    if (!file.isVersioned())
        vPanel2.setVisible(false);
    outer.add(inner);
    outer.add(buttons);
    outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    outer.addStyleName("gss-TabPanelBottom");

    focusPanel.setFocus(true);
    setWidget(outer);
}

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

License:Open Source License

/**
 * The widget's constructor.//from w w  w.  jav a 2  s  .  co  m
 *
 * @param images the image icons from the file properties dialog
 * @param _create true if the dialog is displayed for creating a new
 *            sub-folder of the selected folder, false if it is displayed
 *            for modifying the selected folder
 */
public FolderPropertiesDialog(Images images, boolean _create, final List<GroupResource> _groups,
        String _userFullname) {
    setAnimationEnabled(true);

    // Enable IE selection for the dialog (must disable it upon closing it)
    GSS.enableIESelection();

    create = _create;

    folder = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource();
    permList = new PermissionsList(images, folder.getPermissions(), folder.getOwner());
    groups = _groups;

    // Use this opportunity to set the dialog's caption.
    if (create)
        setText("Create folder");
    else
        setText("Folder properties");

    // Outer contains inner and buttons
    VerticalPanel outer = new VerticalPanel();
    // Inner contains generalPanel and permPanel
    inner = new DecoratedTabPanel();
    inner.setAnimationEnabled(true);
    VerticalPanel generalPanel = new VerticalPanel();
    VerticalPanel permPanel = new VerticalPanel();
    final HorizontalPanel permForAll = new HorizontalPanel();
    final HorizontalPanel pathPanel = new HorizontalPanel();
    HorizontalPanel buttons = new HorizontalPanel();
    HorizontalPanel permButtons = new HorizontalPanel();

    inner.add(generalPanel, "General");
    if (!create)
        inner.add(permPanel, "Sharing");
    inner.selectTab(0);

    final Label folderNameNote = new Label("Please note that slashes ('/') are not allowed in folder names.",
            true);
    folderNameNote.setVisible(false);
    folderNameNote.setStylePrimaryName("gss-readForAllNote");

    FlexTable generalTable = new FlexTable();
    generalTable.setText(0, 0, "Name");
    generalTable.setText(1, 0, "Parent");
    generalTable.setText(2, 0, "Creator");
    generalTable.setText(3, 0, "Last modified");
    folderName.setText(create ? "" : folder.getName());
    folderName.getElement().setId("folderPropertiesDialog.textBox.name");
    generalTable.setWidget(0, 1, folderName);
    folderName.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            if (folderName.getText().contains("/"))
                folderNameNote.setVisible(true);
            else
                folderNameNote.setVisible(false);

        }
    });

    if (create)
        generalTable.setText(1, 1, folder.getName());
    else if (folder.getParentName() == null)
        generalTable.setText(1, 1, "-");
    else
        generalTable.setText(1, 1, folder.getParentName());
    generalTable.setWidget(0, 2, folderNameNote);
    generalTable.setText(2, 1, folder.getOwner());
    DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");
    if (folder.getModificationDate() != null)
        generalTable.setText(3, 1, formatter.format(folder.getModificationDate()));
    generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(3, 0, "props-labels");
    generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values");
    generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values");
    generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values");
    generalTable.getFlexCellFormatter().setStyleName(3, 1, "props-values");
    generalTable.setCellSpacing(4);

    // Create the 'Create/Update' button, along with a listener that hides the dialog
    // when the button is clicked and quits the application.
    String okLabel;
    if (create)
        okLabel = "Create";
    else
        okLabel = "Update";
    Button ok = new Button(okLabel, new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (folderName.getText().contains("/"))
                folderNameNote.setVisible(true);
            else {
                folderNameNote.setVisible(false);
                createOrUpdateFolder();
                closeDialog();
            }

        }
    });
    ok.getElement().setId("folderPropertiesDialog.button.ok");
    buttons.add(ok);
    buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    // Create the 'Cancel' button, along with a listener that hides the
    // dialog
    // when the button is clicked.
    Button cancel = new Button("Cancel", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            closeDialog();
        }
    });
    cancel.getElement().setId("folderPropertiesDialog.button.cancel");
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.addStyleName("gss-TabPanelBottom");

    Button add = new Button("Add Group", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, false);
            dlg.center();
        }
    });
    add.getElement().setId("folderPropertiesDialog.button.addGroup");
    permButtons.add(add);
    permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER);

    Button addUser = new Button("Add User", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PermissionsAddDialog dlg = new PermissionsAddDialog(groups, permList, true);
            dlg.center();
        }
    });
    addUser.getElement().setId("folderPropertiesDialog.button.addUser");
    permButtons.add(addUser);
    permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER);

    permButtons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    permButtons.setSpacing(8);
    permButtons.addStyleName("gss-TabPanelBottom");

    final Label readForAllNote = new Label("When this option is enabled, the folder will be readable"
            + " by everyone. By checking this option, you are certifying that you have the right to "
            + "distribute this folder's contents and that it does not violate the Terms of Use.", true);
    readForAllNote.setVisible(false);
    readForAllNote.setStylePrimaryName("gss-readForAllNote");

    readForAll = new CheckBox();
    readForAll.getElement().setId("folderPropertiesDialog.checkBox.public");
    readForAll.setValue(folder.isReadForAll());
    readForAll.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            readForAllNote.setVisible(readForAll.getValue());
        }

    });

    generalPanel.add(generalTable);
    permPanel.add(permList);
    permPanel.add(permButtons);

    // Only show the read for all permission if the user is the owner.
    if (folder.getOwner().equals(GSS.get().getCurrentUserResource().getUsername())) {
        permForAll.add(new Label("Public"));
        permForAll.add(readForAll);
        permForAll.setSpacing(8);
        permForAll.addStyleName("gss-TabPanelBottom");
        permForAll.add(readForAllNote);
        permPanel.add(permForAll);
    }
    TextBox path = new TextBox();
    path.getElement().setId("folderPropertiesDialog.textBox.link");
    path.setWidth("100%");
    path.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            GSS.enableIESelection();
            ((TextBox) event.getSource()).selectAll();
            GSS.preventIESelection();
        }

    });
    path.setText(folder.getUri());
    path.setTitle(
            "Use this link for sharing the folder via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)");
    path.setWidth("100%");
    path.setReadOnly(true);
    pathPanel.setWidth("100%");
    pathPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    pathPanel.add(new Label("Link"));
    pathPanel.setSpacing(8);
    pathPanel.addStyleName("gss-TabPanelBottom");
    pathPanel.add(path);
    permPanel.add(pathPanel);

    outer.add(inner);
    outer.add(buttons);
    outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    outer.addStyleName("gss-TabPanelBottom");

    setWidget(outer);

    /*if (create)
       folderName.setFocus(true);
    else
       ok.setFocus(true);*/
}

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

License:Open Source License

/**
 * Shows the permission table /*from   ww  w. j ava  2  s.co 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.gwm.samples.gwmdemo.client.WindowEditor.java

License:Apache License

private void initUI() {

    ui = new VerticalPanel();

    // style combobox
    style.addItem("default", "default");
    style.addItem("theme1", "theme1");
    style.addItem("alphacube", "alphacube");
    style.addItem("spread", "spread");
    style.addItem("darkX", "darkX");
    style.addItem("mac", "mac");
    style.addItem("sky", "sky");
    style.addItem("citrus", "citrus");
    style.addItem("cloudy", "cloudy");

    ui.setSpacing(1);/*from ww  w  . ja  v a 2  s .c o  m*/
    ui.add(buildPropertyEditor("Theme : ", style, "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol",
            ""));

    // ////////////// title
    inputTitle = new TextBox();
    ui.add(buildPropertyEditor("Title : ", inputTitle, "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol",
            ""));

    ui.add(new Label(" [Url]"));

    inputUrl = new TextBox();
    inputUrl.setText("http://lbroussal.blogspot.com/");
    inputUrl.setWidth("150");
    ui.add(buildPropertyEditor("Url : ", inputUrl, "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol",
            ""));

    ui.add(new Label(" [Size]"));

    // ////////////// width
    inputWidth = new TextBox();
    inputWidth.setText("750");
    ui.add(buildPropertyEditor("Width : ", inputWidth, "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol",
            ""));

    // ////////////// minimum width
    inputMinimumWidth = new TextBox();
    ui.add(buildPropertyEditor("Minimum Width : ", inputMinimumWidth,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// maximum width
    inputMaximumWidth = new TextBox();
    ui.add(buildPropertyEditor("Maximum Width : ", inputMaximumWidth,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// heigth
    inputHeight = new TextBox();
    inputHeight.setText("460");
    ui.add(buildPropertyEditor("Height : ", inputHeight,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// minimum heigth
    inputMinimumHeight = new TextBox();
    ui.add(buildPropertyEditor("Minimum Height : ", inputMinimumHeight,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// maximum heigth
    inputMaximumHeight = new TextBox();
    ui.add(buildPropertyEditor("Maximum Height : ", inputMaximumHeight,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    ui.add(new Label(" [Position]"));

    // ////////////// top
    inputTop = new TextBox();
    inputTop.setText("65");
    ui.add(buildPropertyEditor("Top : ", inputTop, "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol",
            ""));

    // ////////////// left
    inputLeft = new TextBox();
    inputLeft.setText("300");
    ui.add(buildPropertyEditor("Left : ", inputLeft, "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol",
            ""));

    ui.add(new Label(" [Actions]"));

    // ////////////// resizable
    inputResizable = new CheckBox();
    inputResizable.setChecked(true);
    ui.add(buildPropertyEditor("Resizable : ", inputResizable,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// closable
    inputClosable = new CheckBox();
    inputClosable.setChecked(true);
    ui.add(buildPropertyEditor("Closable : ", inputClosable,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// minimizable
    inputMinimizable = new CheckBox();
    inputMinimizable.setChecked(true);
    ui.add(buildPropertyEditor("Minimizable : ", inputMinimizable,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// maximizable
    inputMaximizable = new CheckBox();
    inputMaximizable.setChecked(true);
    ui.add(buildPropertyEditor("Maximizable : ", inputMaximizable,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// draggable
    inputDraggable = new CheckBox();
    inputDraggable.setChecked(true);
    ui.add(buildPropertyEditor("Draggable : ", inputDraggable,
            "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // propertyEditor.add(new Label(" [FX]"));

    // ////////////// showEffect
    inputShowEffect = new ListBox();
    inputShowEffect.addItem("None", "");
    // inputShowEffect.addItem("Appear", "eval(function(){Effect.Appear})");
    // inputShowEffect.addItem("Show", "function(){Effect.Show}");
    // propertyEditor.add(buildPropertyEditor("Show effect : ",
    // inputShowEffect,
    // "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// hideEffect
    inputHideEffect = new ListBox();
    inputHideEffect.addItem("None", "");
    // inputHideEffect.addItem("Fade", "Effect.Fade");
    // inputHideEffect.addItem("Hide", "Effect.Hide");
    // propertyEditor.add(buildPropertyEditor("Hide effect : ",
    // inputHideEffect,
    // "gwtwindowmanager-WindowPropertyEditor-PropertyLabelCol", ""));

    // ////////////// create window button
    createWindow = new Button("Create window");
    ui.add(createWindow);
    ui.setCellHorizontalAlignment(createWindow, HasHorizontalAlignment.ALIGN_CENTER);
    ui.setSpacing(1);
}

From source file:org.gwm.splice.client.form.ResultListGrid.java

License:Apache License

private void init() {
    addTableListener(this);

    clear();//from   w w  w  .  ja  va 2 s  .c o  m

    setStyleName("resultList");
    //      setWidth(calculateWidth());
    setWidth("100%");
    setCellPadding(0);
    setCellSpacing(0);

    firstColumn = (selectable ? 1 : 0) + (showIcons ? 1 : 0);
    lastColumn = columns.length + firstColumn;

    if (showIcons) {
        checkBoxColumn = 0;
        iconColumn = (selectable ? 1 : 0);

        for (int i = 0; i < columns.length; i++) {
            if ("mimeType".equals(columns[i])) {
                mimeTypeColumn = i;
            }
        }
        getCellFormatter().setWidth(0, iconColumn, String.valueOf(ICON_WIDTH) + "px");
    }

    if (selectable) {
        CheckBox cb = new CheckBox();
        cb.setTitle("Select or deselect all items");
        cb.addClickListener(new ClickListener() {
            public void onClick(Widget w) {
                CheckBox box = (CheckBox) w;
                boolean checked = box.isChecked();
                for (int i = 1; i <= resultList.size(); i++) {
                    CheckBox rcb = (CheckBox) getWidget(i, checkBoxColumn);
                    rcb.setChecked(checked);
                    notifyEvent(checked ? EVENT_SOMETHING_SELECTED : EVENT_NOTHING_SELECTED, 0, 0);
                }
            }
        });
        setWidget(0, checkBoxColumn, cb);
        getCellFormatter().setWidth(0, checkBoxColumn, String.valueOf(CHECKBOX_WIDTH) + "px");
    }

    for (int i = 0; i < columns.length; i++) {
        String title = columns[i].getTitle();
        setText(0, i + firstColumn, title);
        String w = columns[i].getDefaultWidth() != 0 ? String.valueOf(columns[i].getDefaultWidth()) + "px"
                : "100px";
        getCellFormatter().setWidth(0, i + firstColumn, w);
    }

    getRowFormatter().setStyleName(0, "columnsHeader");

    loadData();

}