use of com.google.gwt.view.client.SelectionChangeEvent 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);
}
use of com.google.gwt.view.client.SelectionChangeEvent 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.view.client.SelectionChangeEvent 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.view.client.SelectionChangeEvent 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.view.client.SelectionChangeEvent in project perun by CESNET.
the class AddFacilityManagerGroupTabItem method fillGroupsContent.
private Widget fillGroupsContent(GetAllGroups groups, TabMenu tabMenu, final ListBoxWithObjects<VirtualOrganization> box) {
getAllGroups = groups;
getAllGroups.setCoreGroupsCheckable(true);
final CellTable<Group> table = getAllGroups.getTable();
getAllGroups.getSelectionModel().addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
private boolean found = false;
@Override
public void onSelectionChange(SelectionChangeEvent event) {
for (Group g : getAllGroups.getTableSelectedList()) {
if (g.isCoreGroup()) {
if (!found) {
// display only once
UiElements.generateInfo("You have selected 'all vo members' group", "If this group will be added as 'manager group', all new members of VO " + box.getSelectedObject().getName() + " will be automatically managers of your Facility and all removed members will lose management rights.");
}
found = true;
return;
}
}
found = false;
}
});
final CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.addSelectedManagersGroupToGroup());
tabMenu.addWidget(0, addButton);
final TabItem tab = this;
addButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
ArrayList<Group> list = getAllGroups.getTableSelectedList();
if (UiElements.cantSaveEmptyListDialogBox(list)) {
for (int i = 0; i < list.size(); i++) {
if (i == list.size() - 1) {
AddAdmin request = new AddAdmin(JsonCallbackEvents.disableButtonEvents(addButton, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
// close tab and refresh table
if (refreshEvents != null)
refreshEvents.onFinished(null);
session.getTabManager().closeTab(tab, false);
}
}));
request.addFacilityAdminGroup(facility, list.get(i));
} else {
AddAdmin request = new AddAdmin(JsonCallbackEvents.disableButtonEvents(addButton));
request.addFacilityAdminGroup(facility, list.get(i));
}
}
}
}
});
addButton.setEnabled(false);
JsonUtils.addTableManagedButton(getAllGroups, table, addButton);
// add a class to the table and wrap it into scroll panel
table.addStyleName("perun-table");
return table;
}
Aggregations