Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@94996 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-17 16:39:03 +00:00 committed by Giancarlo Panichi
parent dfbe624baf
commit 132dbae8df
2 changed files with 58 additions and 4 deletions

View File

@ -0,0 +1,50 @@
package org.gcube.portlets.user.td.tablewidget.client.custom;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
public class ActionButtonCellNoFirst extends ActionButtonCell {
private final ActionButtonCellAppearance appearance;
private ImageResource icon;
private String title;
public ActionButtonCellNoFirst() {
this(
GWT.<ActionButtonCellAppearance> create(ActionButtonCellAppearance.class));
}
public ActionButtonCellNoFirst(ActionButtonCellAppearance appearance) {
super(appearance);
this.appearance = appearance;
}
@Override
public void render(Context context, String value, SafeHtmlBuilder sb) {
int rowIndex = context.getIndex();
if (rowIndex != 0) {
this.appearance.icon = icon;
this.appearance.title = title;
this.appearance.render(sb);
} else {
sb.appendHtmlConstant("");
}
}
public ImageResource getIcon() {
return icon;
}
public void setIcon(ImageResource icon) {
this.icon = icon;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -7,7 +7,7 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.tablewidget.client.custom.ActionButtonCell;
import org.gcube.portlets.user.td.tablewidget.client.custom.ActionButtonCellNoFirst;
import org.gcube.portlets.user.td.tablewidget.client.progress.RollBackProgressDialog;
import org.gcube.portlets.user.td.tablewidget.client.properties.OpHistoryProperties;
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
@ -132,8 +132,10 @@ public class HistoryPanel extends FramedPanel {
ColumnConfig<OpHistory, String> rollBackColumn = new ColumnConfig<OpHistory, String>(
props.date(), 40, "Undo");
ActionButtonCell button = new ActionButtonCell();
ActionButtonCellNoFirst button = new ActionButtonCellNoFirst();
button.setIcon(ResourceBundle.INSTANCE.undo());
button.setTitle("Undo");
button.addSelectHandler(new SelectHandler() {
@ -148,7 +150,9 @@ public class HistoryPanel extends FramedPanel {
});
rollBackColumn.setCell(button);
List<ColumnConfig<OpHistory, ?>> l = new ArrayList<ColumnConfig<OpHistory, ?>>();
l.add(expander);
l.add(nameCol);
@ -215,7 +219,7 @@ public class HistoryPanel extends FramedPanel {
protected void startSearchRollBackId(int rowIndex) {
currentRowIndex = rowIndex;
currentOpHistory = store.get(rowIndex);
currentOpHistory = store.get(rowIndex-1);
Log.debug(currentOpHistory.toString() + " was clicked.[rowIndex="
+ currentRowIndex + " ]");
callRollBack();