209: TDM - Show the resources through a ListView widget

Task-Url: https://support.d4science.org/issues/209

Updated UI behaviour

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widget-common-event@115281 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-06-09 17:07:57 +00:00
parent 8ea9ab9fa6
commit 7f9ca08068
3 changed files with 32 additions and 20 deletions

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.widgetcommonevent.client.event;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.DataViewType;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;
@ -10,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
/** /**
* *
* @author "Giancarlo Panichi" * @author "Giancarlo Panichi" <a
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class UIStateEvent extends GwtEvent<UIStateEvent.UIStateHandler> { public class UIStateEvent extends GwtEvent<UIStateEvent.UIStateHandler> {
@ -19,17 +20,26 @@ public class UIStateEvent extends GwtEvent<UIStateEvent.UIStateHandler> {
public static Type<UIStateHandler> TYPE = new Type<UIStateHandler>(); public static Type<UIStateHandler> TYPE = new Type<UIStateHandler>();
private UIStateType uiStateType; private UIStateType uiStateType;
private TRId trId; private TRId trId;
private DataViewType dataViewType;
public interface UIStateHandler extends EventHandler { public interface UIStateHandler extends EventHandler {
void onUIState(UIStateEvent event); void onUIState(UIStateEvent event);
} }
public interface HasUIStateHandler extends HasHandlers{ public interface HasUIStateHandler extends HasHandlers {
public HandlerRegistration addUIStateHandler(UIStateHandler handler); public HandlerRegistration addUIStateHandler(UIStateHandler handler);
} }
public UIStateEvent(UIStateType uiStateType) { public UIStateEvent(UIStateType uiStateType) {
this.uiStateType = uiStateType; this.uiStateType = uiStateType;
this.trId=null;
this.dataViewType=DataViewType.GRID;
}
public UIStateEvent(UIStateType uiStateType, TRId trId, DataViewType dataViewType) {
this.uiStateType = uiStateType;
this.trId=trId;
this.dataViewType=dataViewType;
} }
public UIStateType getUIStateType() { public UIStateType getUIStateType() {
@ -50,12 +60,10 @@ public class UIStateEvent extends GwtEvent<UIStateEvent.UIStateHandler> {
return TYPE; return TYPE;
} }
public static void fire(HasHandlers source, UIStateType uiStateType) { public static void fire(HasHandlers source, UIStateEvent uiStateEvent) {
source.fireEvent(new UIStateEvent(uiStateType)); source.fireEvent(uiStateEvent);
} }
public TRId getTrId() { public TRId getTrId() {
return trId; return trId;
} }
@ -64,13 +72,18 @@ public class UIStateEvent extends GwtEvent<UIStateEvent.UIStateHandler> {
this.trId = trId; this.trId = trId;
} }
public DataViewType getDataViewType() {
return dataViewType;
}
public void setDataViewType(DataViewType dataViewType) {
this.dataViewType = dataViewType;
}
@Override @Override
public String toString() { public String toString() {
return "UIStateEvent [uiStateType=" + uiStateType + ", trId=" + trId return "UIStateEvent [uiStateType=" + uiStateType + ", trId=" + trId
+ "]"; + ", dataViewType=" + dataViewType + "]";
} }
} }

View File

@ -7,9 +7,8 @@ package org.gcube.portlets.user.td.widgetcommonevent.shared.dataview;
* *
*/ */
public enum DataViewType { public enum DataViewType {
TABULARRESOURCE("TabularResource"), GRID("Grid"),
MAP("Map"), RESOURCES("Resources");
TABLE("Table");
/** /**
* @param text * @param text

View File

@ -18,20 +18,20 @@ public class TabularResourceDataView extends DataView {
public TabularResourceDataView() { public TabularResourceDataView() {
super(); super();
dataViewType = DataViewType.TABULARRESOURCE; dataViewType = DataViewType.GRID;
} }
public TabularResourceDataView(TRId trId) { public TabularResourceDataView(TRId trId) {
super(); super();
dataViewType = DataViewType.TABULARRESOURCE; dataViewType = DataViewType.GRID;
this.trId = trId; this.trId = trId;
this.tabName = null; this.tabName = null;
} }
public TabularResourceDataView(TRId trId, String tabName) { public TabularResourceDataView(TRId trId, String tabName) {
super(); super();
dataViewType = DataViewType.TABULARRESOURCE; dataViewType = DataViewType.GRID;
this.trId = trId; this.trId = trId;
this.tabName = tabName; this.tabName = tabName;
} }