use of com.google.gwt.user.cellview.client.Column in project perun by CESNET.
the class GetCompleteRichMembers method getEmptyTable.
/**
* Returns empty table
*
* @return CellTable widget
*/
public CellTable<RichMember> getEmptyTable() {
// Table data provider.
dataProvider = new ListDataProvider<RichMember>(list);
// Cell table
table = new PerunTable<RichMember>(list);
// Connect the table to the data provider.
dataProvider.addDataDisplay(table);
// Sorting
ListHandler<RichMember> columnSortHandler = new ListHandler<RichMember>(dataProvider.getList());
table.addColumnSortHandler(columnSortHandler);
// table selection
table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<RichMember>createCheckboxManager());
// set empty content & loader
table.setEmptyTableWidget(loaderImage);
if (PerunEntity.VIRTUAL_ORGANIZATION.equals(entity)) {
loaderImage.setEmptyResultMessage("VO has no members.");
} else {
loaderImage.setEmptyResultMessage("Group has no members.");
}
Column<RichMember, RichMember> checkBoxColumn = new Column<RichMember, RichMember>(new PerunCheckboxCell<RichMember>(true, false, indirectCheckable)) {
@Override
public RichMember getValue(RichMember object) {
// Get the value from the selection model.
object.setChecked(selectionModel.isSelected(object));
return object;
}
};
// updates the columns size
table.setColumnWidth(checkBoxColumn, 40.0, Style.Unit.PX);
// Add the columns
// Checkbox column header
CheckboxCell cb = new CheckboxCell();
Header<Boolean> checkBoxHeader = new Header<Boolean>(cb) {
public Boolean getValue() {
//return true to see a checked checkbox.
return false;
}
};
checkBoxHeader.setUpdater(new ValueUpdater<Boolean>() {
public void update(Boolean value) {
// sets selected to all, if value = true, unselect otherwise
for (RichMember obj : list) {
if (!"INDIRECT".equalsIgnoreCase(obj.getMembershipType())) {
selectionModel.setSelected(obj, value);
}
}
}
});
if (checkable) {
table.addColumn(checkBoxColumn, checkBoxHeader);
}
MemberColumnProvider columnProvider = new MemberColumnProvider(dataProvider, backupList, table, tableFieldUpdater);
IsClickableCell<RichMember> authz = new IsClickableCell<RichMember>() {
@Override
public boolean isClickable(RichMember object) {
return true;
}
@Override
public String linkUrl(RichMember object) {
return null;
}
};
columnProvider.addIdColumn(authz, 110);
columnProvider.addUserIdColumn(authz, 110);
columnProvider.addStatusColumn(authz, 20);
columnProvider.addNameColumn(authz);
columnProvider.addOrganizationColumn(authz);
columnProvider.addEmailColumn(authz);
columnProvider.addLoginsColumn(authz);
return table;
}
use of com.google.gwt.user.cellview.client.Column in project che by eclipse.
the class RemoteViewImpl method initRepositoriesTable.
/**
* Initialize the columns of the grid.
*
* @param ideResources
*/
private void initRepositoriesTable(org.eclipse.che.ide.Resources ideResources) {
repositories = new CellTable<>(15, ideResources);
Column<Remote, String> nameColumn = new Column<Remote, String>(new TextCell()) {
@Override
public String getValue(Remote remote) {
return remote.getName();
}
@Override
public void render(Cell.Context context, Remote remote, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-remotes-remotes-cellTable-" + context.getIndex() + "\">");
super.render(context, remote, sb);
}
};
Column<Remote, String> urlColumn = new Column<Remote, String>(new TextCell()) {
@Override
public String getValue(Remote remote) {
return remote.getUrl();
}
};
repositories.addColumn(nameColumn, locale.remoteGridNameField());
repositories.setColumnWidth(nameColumn, "20%");
repositories.addColumn(urlColumn, locale.remoteGridLocationField());
repositories.setColumnWidth(urlColumn, "80%");
final SingleSelectionModel<Remote> selectionModel = new SingleSelectionModel<Remote>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
selectedObject = selectionModel.getSelectedObject();
delegate.onRemoteSelected(selectedObject);
}
});
repositories.setSelectionModel(selectionModel);
}
use of com.google.gwt.user.cellview.client.Column in project che by eclipse.
the class RevisionListViewImpl 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);
}
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);
}
use of com.google.gwt.user.cellview.client.Column in project che by eclipse.
the class ResetToCommitViewImpl method createCommitsTable.
/** Creates table what contains list of available commits. */
private void createCommitsTable() {
commits = new CellTable<Revision>(15, tableRes);
Column<Revision, String> dateColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM).format(new Date((long) revision.getCommitTime()));
}
@Override
public void render(Cell.Context context, Revision revision, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "git-reset-cellTable-" + context.getIndex() + "\">");
super.render(context, revision, sb);
}
};
Column<Revision, String> commiterColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
if (revision.getCommitter() == null) {
return "";
}
return revision.getCommitter().getName();
}
};
Column<Revision, String> commentColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getMessage();
}
};
commits.addColumn(dateColumn, locale.commitGridDate());
commits.setColumnWidth(dateColumn, "20%");
commits.addColumn(commiterColumn, locale.commitGridCommiter());
commits.setColumnWidth(commiterColumn, "20%");
commits.addColumn(commentColumn, locale.commitGridComment());
commits.setColumnWidth(commentColumn, "60%");
final SingleSelectionModel<Revision> selectionModel = new SingleSelectionModel<Revision>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Revision selectedObject = selectionModel.getSelectedObject();
delegate.onRevisionSelected(selectedObject);
}
});
commits.setSelectionModel(selectionModel);
}
Aggregations