Search in sources :

Example 26 with Column

use of com.google.gwt.user.cellview.client.Column in project che by eclipse.

the class HistoryViewImpl method createRevisionsTable.

private void createRevisionsTable(org.eclipse.che.ide.Resources coreRes) {
    Column<Revision, String> idColumn = new Column<Revision, String>(new TextCell()) {

        @Override
        public String getValue(Revision revision) {
            return revision.getId().substring(0, 8) + "...";
        }
    };
    Column<Revision, String> timeColumn = new Column<Revision, String>(new TextCell()) {

        @Override
        public String getValue(Revision revision) {
            return dateTimeFormatter.getFormattedDate(revision.getCommitTime());
        }
    };
    Column<Revision, String> authorColumn = new Column<Revision, String>(new TextCell()) {

        @Override
        public String getValue(Revision revision) {
            return revision.getCommitter().getName();
        }
    };
    Column<Revision, String> titleColumn = new Column<Revision, String>(new TextCell()) {

        @Override
        public String getValue(Revision revision) {
            return revision.getMessage().substring(0, 50);
        }
    };
    revisions = new CellTable<>(15, coreRes);
    revisions.setWidth("100%");
    revisions.addColumn(idColumn, locale.viewCompareRevisionTableIdTitle());
    revisions.addColumn(timeColumn, locale.viewCompareRevisionTableTimeTitle());
    revisions.addColumn(authorColumn, locale.viewCompareRevisionTableAuthorTitle());
    revisions.addColumn(titleColumn, locale.viewCompareRevisionTableTitleTitle());
    selectionModel = new SingleSelectionModel<Revision>();
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            description.setText(selectionModel.getSelectedObject().getMessage());
            delegate.onRevisionSelected(selectionModel.getSelectedObject());
        }
    });
    revisions.setSelectionModel(selectionModel);
    revisions.addDomHandler(new DoubleClickHandler() {

        @Override
        public void onDoubleClick(DoubleClickEvent event) {
            delegate.onRevisionDoubleClicked();
        }
    }, DoubleClickEvent.getType());
    this.revisionsPanel.add(revisions);
}
Also used : Revision(org.eclipse.che.api.git.shared.Revision) Column(com.google.gwt.user.cellview.client.Column) DoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler) DoubleClickEvent(com.google.gwt.event.dom.client.DoubleClickEvent) TextCell(com.google.gwt.cell.client.TextCell) SelectionChangeEvent(com.google.gwt.view.client.SelectionChangeEvent)

Example 27 with Column

use of com.google.gwt.user.cellview.client.Column in project rstudio by rstudio.

the class UnsavedChangesDialog method addIconColumn.

private Column<UnsavedChangesTarget, ImageResource> addIconColumn() {
    Column<UnsavedChangesTarget, ImageResource> iconColumn = new Column<UnsavedChangesTarget, ImageResource>(new ImageResourceCell()) {

        @Override
        public ImageResource getValue(UnsavedChangesTarget object) {
            return object.getIcon();
        }
    };
    targetsCellTable_.addColumn(iconColumn);
    targetsCellTable_.setColumnWidth(iconColumn, 20, Unit.PX);
    return iconColumn;
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) IdentityColumn(com.google.gwt.user.cellview.client.IdentityColumn) Column(com.google.gwt.user.cellview.client.Column) UnsavedChangesTarget(org.rstudio.studio.client.workbench.model.UnsavedChangesTarget) ImageResourceCell(com.google.gwt.cell.client.ImageResourceCell)

Example 28 with Column

use of com.google.gwt.user.cellview.client.Column in project rstudio by rstudio.

the class UnsavedChangesDialog method addSelectionColumn.

private Column<UnsavedChangesTarget, Boolean> addSelectionColumn() {
    Column<UnsavedChangesTarget, Boolean> checkColumn = new Column<UnsavedChangesTarget, Boolean>(new CheckboxCell(true, false)) {

        @Override
        public Boolean getValue(UnsavedChangesTarget object) {
            return selectionModel_.isSelected(object);
        }
    };
    checkColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    targetsCellTable_.addColumn(checkColumn);
    targetsCellTable_.setColumnWidth(checkColumn, 25, Unit.PX);
    return checkColumn;
}
Also used : IdentityColumn(com.google.gwt.user.cellview.client.IdentityColumn) Column(com.google.gwt.user.cellview.client.Column) UnsavedChangesTarget(org.rstudio.studio.client.workbench.model.UnsavedChangesTarget) CheckboxCell(com.google.gwt.cell.client.CheckboxCell)

Example 29 with Column

use of com.google.gwt.user.cellview.client.Column in project rstudio by rstudio.

the class FilesList method addSelectionColumn.

private Column<FileSystemItem, Boolean> addSelectionColumn() {
    Column<FileSystemItem, Boolean> checkColumn = new Column<FileSystemItem, Boolean>(new CheckboxCell(true, false) {

        @Override
        public void render(Context context, Boolean value, SafeHtmlBuilder sb) {
            // don't render the check box if its for the parent path
            if (parentPath_ == null || context.getIndex() > 0)
                super.render(context, value, sb);
        }
    }) {

        @Override
        public Boolean getValue(FileSystemItem item) {
            return selectionModel_.isSelected(item);
        }
    };
    checkColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    filesDataGrid_.addColumn(checkColumn);
    filesDataGrid_.setColumnWidth(checkColumn, CHECK_COLUMN_WIDTH_PIXELS, Unit.PX);
    return checkColumn;
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) LinkColumn(org.rstudio.core.client.cellview.LinkColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn) Column(com.google.gwt.user.cellview.client.Column) CheckboxCell(com.google.gwt.cell.client.CheckboxCell) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 30 with Column

use of com.google.gwt.user.cellview.client.Column in project rstudio by rstudio.

the class FilesList method addIconColumn.

private Column<FileSystemItem, ImageResource> addIconColumn(final FileTypeRegistry fileTypeRegistry) {
    Column<FileSystemItem, ImageResource> iconColumn = new Column<FileSystemItem, ImageResource>(new ImageResourceCell()) {

        @Override
        public ImageResource getValue(FileSystemItem object) {
            if (object == parentPath_)
                return new ImageResource2x(FileIconResources.INSTANCE.iconUpFolder2x());
            else
                return fileTypeRegistry.getIconForFile(object);
        }
    };
    iconColumn.setSortable(true);
    filesDataGrid_.addColumn(iconColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
    filesDataGrid_.setColumnWidth(iconColumn, ICON_COLUMN_WIDTH_PIXELS, Unit.PX);
    sortHandler_.setComparator(iconColumn, new FilesListComparator() {

        @Override
        public int doCompare(FileSystemItem arg0, FileSystemItem arg1) {
            if (arg0.isDirectory() && !arg1.isDirectory())
                return 1;
            else if (arg1.isDirectory() && !arg0.isDirectory())
                return -1;
            else
                return arg0.getExtension().compareTo(arg1.getExtension());
        }
    });
    return iconColumn;
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ImageResource(com.google.gwt.resources.client.ImageResource) LinkColumn(org.rstudio.core.client.cellview.LinkColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn) Column(com.google.gwt.user.cellview.client.Column) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) ImageResourceCell(com.google.gwt.cell.client.ImageResourceCell)

Aggregations

Column (com.google.gwt.user.cellview.client.Column)51 ListHandler (com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler)28 CheckboxCell (com.google.gwt.cell.client.CheckboxCell)18 Header (com.google.gwt.user.cellview.client.Header)15 PerunCheckboxCell (cz.metacentrum.perun.webgui.widgets.cells.PerunCheckboxCell)14 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)10 GeneralObject (cz.metacentrum.perun.webgui.model.GeneralObject)10 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)9 TextCell (com.google.gwt.cell.client.TextCell)8 CustomClickableTextCell (cz.metacentrum.perun.webgui.widgets.cells.CustomClickableTextCell)8 FieldUpdater (com.google.gwt.cell.client.FieldUpdater)6 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 TextColumn (com.google.gwt.user.cellview.client.TextColumn)6 SelectionChangeEvent (com.google.gwt.view.client.SelectionChangeEvent)6 Attribute (cz.metacentrum.perun.webgui.model.Attribute)6 Group (cz.metacentrum.perun.webgui.model.Group)6 Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)6 ImageResource (com.google.gwt.resources.client.ImageResource)5 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)5