Added Combo

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@90118 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-01-14 18:35:34 +00:00
parent fb3e99196c
commit aa7646f3f0
14 changed files with 175 additions and 20 deletions

View File

@ -30,6 +30,7 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/tabular-data-column-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>

View File

@ -5,6 +5,16 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
@ -15,9 +25,29 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

13
.settings/.jsdtscope Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

View File

@ -1,4 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
warSrcDir=
warSrcDirIsOutput=true
lastWarOutDir=/home/giancarlo/workspace/tabular-data-column-widget/target/tabular-data-column-widget-1.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,5 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="tabular-data-column-widget">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="tabular-data-gwt-service-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-gwt-service/tabular-data-gwt-service">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-widget-common-event-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-widget-common-event/tabular-data-widget-common-event">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="tabular-data-column-widget"/>
<property name="java-output-path" value="/tabular-data-column-widget/target/tabular-data-column-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module>
</project-modules>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.5"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

View File

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

View File

@ -0,0 +1 @@
Window

View File

@ -19,7 +19,7 @@
</MavenCoordinates>
<Type>library</Type>
<Files>
<File>tabular-data-column-widget-1.0.0-SNAPSHOT.jar</File>
<File>tabular-data-column-widget-1.0.0-SNAPSHOT.war</File>
</Files>
</Software>
</Packages>

View File

@ -293,4 +293,5 @@
</dependency>
</dependencies>
</dependencyManagement>
<packaging>war</packaging>
</project>

View File

@ -2,6 +2,8 @@ package org.gcube.portlets.user.td.columnwidget.client;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
@ -9,7 +11,11 @@ public class ColumnWidgetEntry implements EntryPoint {
public void onModuleLoad() {
TRId trId=new TRId();
trId.setId("1");
trId.setTableId("1");
RemoveColumnDialog dialog=new RemoveColumnDialog(trId);
dialog.show();
Log.info("Hello!");
}
}

View File

@ -1,22 +1,41 @@
package org.gcube.portlets.user.td.columnwidget.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.widget.client.TextButton;
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
import com.sencha.gxt.data.client.loader.RpcProxy;
import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
import com.sencha.gxt.data.shared.loader.ListLoadResult;
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
import com.sencha.gxt.data.shared.loader.ListLoader;
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.Dialog;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.form.ComboBox;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.info.Info;
public class RemoveColumnDialog extends Dialog {
public class RemoveColumnDialog extends Window {
public RemoveColumnDialog(TRId trId) {
create(trId, null);
@ -29,31 +48,63 @@ public class RemoveColumnDialog extends Dialog {
protected void create(TRId trId, String columnName) {
setBodyBorder(false);
// getHeader().setIcon(Resources.IMAGES.side_list());
setHeadingText("BorderLayout Dialog");
setHeadingText("Remove Column");
setWidth(400);
setHeight(225);
setHideOnButtonClick(true);
setHeight(200);
ContentPanel panel = new ContentPanel();
panel.setHeaderVisible(false);
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
ListStore<ColumnData> states = new ListStore<ColumnData>(props.id());
// states.addAll(TestData.getStates());
ComboBox<ColumnData> combo = new ComboBox<ColumnData>(states,
props.label());
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
Log.trace("Store created");
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<ColumnData>> callback) {
loadData(loadConfig, callback);
}
};
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(proxy);
loader.setRemoteSort(false);
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(store));
Log.trace("Loader created");
ComboBox<ColumnData> combo = new ComboBox<ColumnData>(store,
props.label()){
@Override
protected void onAfterFirstAttach() {
super.onAfterFirstAttach();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
loader.load();
}
});
}
};
Log.trace("Combo created");
addHandlersForEventObservation(combo, props.label());
combo.setEmptyText("Select a state...");
combo.setEmptyText("Select a column...");
combo.setWidth(150);
combo.setTypeAhead(true);
combo.setTriggerAction(TriggerAction.ALL);
combo.setLoader(loader);
panel.add(combo);
FramedPanel form = new FramedPanel();
form.setHeaderVisible(false);
//form.setWidth(350);
form.setBodyStyle("background: none;");
VerticalLayoutContainer v = new VerticalLayoutContainer();
form.add(v);
v.add(new FieldLabel(combo, "Column"), new VerticalLayoutData(1, -1));
panel.add(form);
panel.addButton(new TextButton("Remove"));
//
add(panel);
}
@ -83,5 +134,29 @@ public class RemoveColumnDialog extends Dialog {
}
});
}
protected void loadData(ListLoadConfig loadConfig,
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
TDGWTServiceAsync.INSTANCE.getColumns(new AsyncCallback<ArrayList<ColumnData>>(){
public void onFailure(Throwable caught) {
Log.error("load combo failure:"+caught.getLocalizedMessage());
callback.onFailure(caught);
}
public void onSuccess(ArrayList<ColumnData> result) {
Log.trace("loaded " + result.size() + " ColumnData");
callback.onSuccess(new ListLoadResultBean<ColumnData>(
result));
}
});
}
}

View File

@ -19,7 +19,7 @@
<!-- Servlets Mapping -->
<servlet-mapping>
<servlet-name>TDGWTService</servlet-name>
<url-pattern>tdgwtservice/TDGWTService</url-pattern>
<url-pattern>ColumnWidget/TDGWTService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jUnitHostImpl</servlet-name>