SElectedTableEvent added

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98581 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-07-14 08:06:55 +00:00
parent 6f54509bc4
commit 5637622fc1
5 changed files with 765 additions and 258 deletions

View File

@ -8,6 +8,7 @@ public enum EventsTypeEnum {
SAMPLING_EVENT,
SMART_SAMPLING_EVENT,
RANDOM_SAMPLING_EVENT,
LOAD_TABLES_EVENT;
LOAD_TABLES_EVENT,
SELECTED_TABLE_EVENT;
}

View File

@ -0,0 +1,34 @@
package org.gcube.portlets.user.databasesmanager.client.events;
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SelectedTableEventHandler;
import com.google.gwt.event.shared.GwtEvent;
public class SelectedTableEvent extends GwtEvent<SelectedTableEventHandler> {
public static Type<SelectedTableEventHandler> TYPE = new Type<SelectedTableEventHandler>();
@Override
public Type<SelectedTableEventHandler> getAssociatedType() {
// TODO Auto-generated method stub
return TYPE;
}
@Override
protected void dispatch(SelectedTableEventHandler handler) {
// TODO Auto-generated method stub
handler.onSelectedTable(this);
}
public EventsTypeEnum getKey() {
// TODO Auto-generated method stub
return EventsTypeEnum.SELECTED_TABLE_EVENT;
}
}

View File

@ -0,0 +1,11 @@
package org.gcube.portlets.user.databasesmanager.client.events.interfaces;
import org.gcube.portlets.user.databasesmanager.client.events.SelectedTableEvent;
import com.google.gwt.event.shared.EventHandler;
public interface SelectedTableEventHandler extends EventHandler{
public void onSelectedTable(SelectedTableEvent selectedTableEvent);
}

View File

@ -8,9 +8,11 @@ import org.gcube.portlets.user.databasesmanager.client.datamodel.SubmitQueryData
import org.gcube.portlets.user.databasesmanager.client.events.LoadTablesEvent;
import org.gcube.portlets.user.databasesmanager.client.events.RandomSamplingEvent;
import org.gcube.portlets.user.databasesmanager.client.events.SamplingEvent;
import org.gcube.portlets.user.databasesmanager.client.events.SelectedTableEvent;
import org.gcube.portlets.user.databasesmanager.client.events.ShowCreateTableEvent;
import org.gcube.portlets.user.databasesmanager.client.events.SmartSamplingEvent;
import org.gcube.portlets.user.databasesmanager.client.events.SubmitQueryEvent;
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SelectedTableEventHandler;
import org.gcube.portlets.user.databasesmanager.client.form.GxtFormSubmitQuery;
import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
@ -70,6 +72,7 @@ public class GxtToolbarFunctionality {
toolBar = new ToolBar();
initToolBar();
addHandler();
addSelectionListenersOnToolBar();
}
@ -138,6 +141,30 @@ public class GxtToolbarFunctionality {
btnRandomSample.disable();
}
private void addHandler() {
eventBus.addHandler(SelectedTableEvent.TYPE, new SelectedTableEventHandler() {
@Override
public void onSelectedTable(SelectedTableEvent selectedTableEvent) {
// TODO Auto-generated method stub
//enable button for tabele details and sampling operation
btnTablesList.enable();
btnSubmitQuery.enable();
btnShowCreateTable.enable();
btnSimpleSample.enable();
btnSmartSample.enable();
btnRandomSample.enable();
}
});
}
private void addSelectionListenersOnToolBar() {
@ -378,12 +405,14 @@ public class GxtToolbarFunctionality {
// fire event
eventBus.fireEvent(new LoadTablesEvent());
}
});
}
public void disableButtonOnToolbar(int infoTreeDepthSelectedItem,
public void enableButtonOnToolbar(int infoTreeDepthSelectedItem,
boolean infoSelectedItemIsSchema, String databaseType) {
// System.out.println("GxtToolbarFunctionality-> depth: "
@ -480,6 +509,15 @@ public class GxtToolbarFunctionality {
}
}
public void disableButtonsOperationsOnTable(){
btnShowCreateTable.disable();
btnSimpleSample.disable();
btnSmartSample.disable();
btnRandomSample.disable();
}
public ToolBar getToolBar() {
return this.toolBar;