diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/custom/ActionButtonCellNoFirst.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/custom/ActionButtonCellNoFirst.java new file mode 100644 index 0000000..bf3ebb9 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/custom/ActionButtonCellNoFirst.java @@ -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. 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; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryPanel.java index 76b5c06..3f02cd0 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/history/HistoryPanel.java @@ -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 rollBackColumn = new ColumnConfig( 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> l = new ArrayList>(); 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();