use of com.google.gwt.cell.client.ButtonCell in project che by eclipse.
the class SshKeyManagerViewImpl method initSshKeyTable.
/** Creates table what contains list of available ssh keys. */
private void initSshKeyTable(final CellTable.Resources res) {
keys = new CellTable<>(20, res);
Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {
@Override
public String getValue(SshPairDto object) {
return object.getName();
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-title-" + context.getIndex() + "\">");
super.render(context, object, sb);
}
};
hostColumn.setSortable(true);
Column<SshPairDto, String> publicKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
@Override
public String getValue(SshPairDto object) {
return "View";
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-key-" + context.getIndex() + "\">");
if (object != null && object.getPublicKey() != null) {
super.render(context, object, sb);
}
}
};
// Creates handler on button clicked
publicKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
@Override
public void update(int index, SshPairDto object, String value) {
delegate.onViewClicked(object);
}
});
Column<SshPairDto, String> deleteKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
@Override
public String getValue(SshPairDto object) {
return "Delete";
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-delete-" + context.getIndex() + "\">");
super.render(context, object, sb);
}
};
// Creates handler on button clicked
deleteKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
@Override
public void update(int index, SshPairDto object, String value) {
delegate.onDeleteClicked(object);
}
});
keys.addColumn(hostColumn, "Title");
keys.addColumn(publicKeyColumn, "Public Key");
keys.addColumn(deleteKeyColumn, "Delete");
keys.setColumnWidth(hostColumn, 50, Style.Unit.PCT);
keys.setColumnWidth(publicKeyColumn, 30, Style.Unit.PX);
keys.setColumnWidth(deleteKeyColumn, 30, Style.Unit.PX);
// don't show loading indicator
keys.setLoadingIndicator(null);
}
use of com.google.gwt.cell.client.ButtonCell in project che by eclipse.
the class SshKeyManagerViewImpl method initSshKeyTable.
/** Creates table what contains list of available ssh keys. */
private void initSshKeyTable(final CellTable.Resources res) {
keys = new CellTable<>(15, res);
Column<SshPairDto, String> hostColumn = new Column<SshPairDto, String>(new TextCell()) {
@Override
public String getValue(SshPairDto object) {
return object.getName();
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-host-" + context.getIndex() + "\">");
super.render(context, object, sb);
}
};
hostColumn.setSortable(true);
Column<SshPairDto, String> publicKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
@Override
public String getValue(SshPairDto object) {
return "View";
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-key-" + context.getIndex() + "\">");
if (object != null && object.getPublicKey() != null) {
super.render(context, object, sb);
}
}
};
// Creates handler on button clicked
publicKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
@Override
public void update(int index, SshPairDto object, String value) {
delegate.onViewClicked(object);
}
});
Column<SshPairDto, String> deleteKeyColumn = new Column<SshPairDto, String>(new ButtonCell()) {
@Override
public String getValue(SshPairDto object) {
return "Delete";
}
@Override
public void render(Context context, SshPairDto object, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<div id=\"" + UIObject.DEBUG_ID_PREFIX + "-sshKeys-cellTable-delete-" + context.getIndex() + "\">");
super.render(context, object, sb);
}
};
// Creates handler on button clicked
deleteKeyColumn.setFieldUpdater(new FieldUpdater<SshPairDto, String>() {
@Override
public void update(int index, SshPairDto object, String value) {
delegate.onDeleteClicked(object);
}
});
keys.addColumn(hostColumn, "Host");
keys.addColumn(publicKeyColumn, "Public Key");
keys.addColumn(deleteKeyColumn, "Delete");
keys.setColumnWidth(hostColumn, 50, Style.Unit.PCT);
keys.setColumnWidth(publicKeyColumn, 30, Style.Unit.PX);
keys.setColumnWidth(deleteKeyColumn, 30, Style.Unit.PX);
// don't show loading indicator
keys.setLoadingIndicator(null);
}
Aggregations