Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@90390 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6a8c6ccdf1
commit
04f2a3efc3
|
@ -30,3 +30,99 @@ Compiling...
|
||||||
Compilation completed in 0.00 seconds
|
Compilation completed in 0.00 seconds
|
||||||
Removing invalidated units
|
Removing invalidated units
|
||||||
Finding entry point classes
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
30% complete (ETR: 9 seconds)
|
||||||
|
30% complete (ETR: 9 seconds)
|
||||||
|
30% complete (ETR: 9 seconds)
|
||||||
|
30% complete (ETR: 9 seconds)
|
||||||
|
40% complete (ETR: 8 seconds)
|
||||||
|
50% complete (ETR: 6 seconds)
|
||||||
|
60% complete (ETR: 4 seconds)
|
||||||
|
70% complete (ETR: 3 seconds)
|
||||||
|
80% complete (ETR: 2 seconds)
|
||||||
|
90% complete (ETR: 1 seconds)
|
||||||
|
100% complete (ETR: 0 seconds)
|
||||||
|
Compilation completed in 10.36 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
Compilation completed in 0.00 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
Compilation completed in 0.00 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
30% complete (ETR: 8 seconds)
|
||||||
|
40% complete (ETR: 7 seconds)
|
||||||
|
40% complete (ETR: 7 seconds)
|
||||||
|
40% complete (ETR: 7 seconds)
|
||||||
|
40% complete (ETR: 7 seconds)
|
||||||
|
50% complete (ETR: 6 seconds)
|
||||||
|
60% complete (ETR: 4 seconds)
|
||||||
|
70% complete (ETR: 3 seconds)
|
||||||
|
80% complete (ETR: 2 seconds)
|
||||||
|
90% complete (ETR: 1 seconds)
|
||||||
|
100% complete (ETR: 0 seconds)
|
||||||
|
Compilation completed in 16.74 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
Compilation completed in 0.00 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
Compilation completed in 0.00 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
20% complete (ETR: 13 seconds)
|
||||||
|
20% complete (ETR: 13 seconds)
|
||||||
|
20% complete (ETR: 13 seconds)
|
||||||
|
30% complete (ETR: 12 seconds)
|
||||||
|
40% complete (ETR: 9 seconds)
|
||||||
|
50% complete (ETR: 7 seconds)
|
||||||
|
60% complete (ETR: 5 seconds)
|
||||||
|
70% complete (ETR: 4 seconds)
|
||||||
|
80% complete (ETR: 2 seconds)
|
||||||
|
90% complete (ETR: 1 seconds)
|
||||||
|
100% complete (ETR: 0 seconds)
|
||||||
|
Compilation completed in 13.39 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
Compilation completed in 0.00 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
Compilation completed in 0.00 seconds
|
||||||
|
Removing invalidated units
|
||||||
|
Finding entry point classes
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<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/java"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<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-model-3.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-model/tabular-model">
|
||||||
|
<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="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"/>
|
<property name="java-output-path" value="/tabular-data-column-widget/target/tabular-data-column-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
|
import com.sencha.gxt.widget.core.client.Window;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
|
||||||
|
public class ChangeColumnTypeDialog extends Window {
|
||||||
|
protected String WIDTH = "650px";
|
||||||
|
protected String HEIGHT = "530px";
|
||||||
|
protected TRId trId;
|
||||||
|
|
||||||
|
protected String columnName=null;
|
||||||
|
protected ColumnData column=null;
|
||||||
|
protected ComboBox<ColumnData> combo=null;
|
||||||
|
|
||||||
|
public ChangeColumnTypeDialog(TRId trId) {
|
||||||
|
create(trId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChangeColumnTypeDialog(TRId trId, String columnName) {
|
||||||
|
create(trId, columnName);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void create(TRId trId, String columnName) {
|
||||||
|
setWidth(WIDTH);
|
||||||
|
setHeight(HEIGHT);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setResizable(false);
|
||||||
|
setHeadingText("Change Column Type");
|
||||||
|
//getHeader().setIcon(Resources.IMAGES.side_list());
|
||||||
|
this.trId=trId;
|
||||||
|
this.columnName=columnName;
|
||||||
|
|
||||||
|
ChangeColumnTypePanel changeColumnTypePanel= new ChangeColumnTypePanel(trId, columnName);
|
||||||
|
add(changeColumnTypePanel);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,176 @@
|
||||||
|
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.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
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.FramedPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
|
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.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
|
public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
|
protected String WIDTH = "640px";
|
||||||
|
protected String HEIGHT = "520px";
|
||||||
|
|
||||||
|
protected ChangeColumnTypeDialog parent;
|
||||||
|
protected TextField label=null;
|
||||||
|
protected TRId trId;
|
||||||
|
protected String columnName;
|
||||||
|
protected ColumnData column;
|
||||||
|
protected ComboBox<ColumnData> combo=null;
|
||||||
|
|
||||||
|
|
||||||
|
public ChangeColumnTypePanel(TRId trId, String columnName){
|
||||||
|
setWidth(WIDTH);
|
||||||
|
setHeight(HEIGHT);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
setBodyBorder(false);
|
||||||
|
this.trId=trId;
|
||||||
|
this.columnName=columnName;
|
||||||
|
|
||||||
|
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
||||||
|
|
||||||
|
ContentPanel panel = new ContentPanel();
|
||||||
|
panel.setHeaderVisible(false);
|
||||||
|
|
||||||
|
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
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 column...");
|
||||||
|
combo.setWidth(150);
|
||||||
|
combo.setTypeAhead(true);
|
||||||
|
combo.setTriggerAction(TriggerAction.ALL);
|
||||||
|
combo.setLoader(loader);
|
||||||
|
|
||||||
|
FramedPanel form = new FramedPanel();
|
||||||
|
form.setHeaderVisible(false);
|
||||||
|
//form.setWidth(350);
|
||||||
|
form.setBodyStyle("background: none;");
|
||||||
|
|
||||||
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
|
v.add(new FieldLabel(combo, "Column"), new VerticalLayoutData(1, -1));
|
||||||
|
form.add(v);
|
||||||
|
form.addButton(new TextButton("Change"));
|
||||||
|
|
||||||
|
|
||||||
|
panel.add(form);
|
||||||
|
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
|
||||||
|
add(basicLayout);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> void addHandlersForEventObservation(ComboBox<T> combo,
|
||||||
|
final LabelProvider<T> labelProvider) {
|
||||||
|
combo.addValueChangeHandler(new ValueChangeHandler<T>() {
|
||||||
|
|
||||||
|
public void onValueChange(ValueChangeEvent<T> event) {
|
||||||
|
Info.display(
|
||||||
|
"Value Changed",
|
||||||
|
"New value: "
|
||||||
|
+ (event.getValue() == null ? "nothing"
|
||||||
|
: labelProvider.getLabel(event
|
||||||
|
.getValue()) + "!"));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
combo.addSelectionHandler(new SelectionHandler<T>() {
|
||||||
|
public void onSelection(SelectionEvent<T> event) {
|
||||||
|
Info.display(
|
||||||
|
"State Selected",
|
||||||
|
"You selected "
|
||||||
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
|
: labelProvider.getLabel(event
|
||||||
|
.getSelectedItem()) + "!"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getColumns(trId, 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");
|
||||||
|
if(columnName!=null){
|
||||||
|
for(ColumnData cd: result){
|
||||||
|
if(cd.getName().compareTo(columnName)==0){
|
||||||
|
combo.setValue(cd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback.onSuccess(new ListLoadResultBean<ColumnData>(
|
||||||
|
result));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.columnwidget.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.custom.ErrorMessageDialog;
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
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.gwtservice.shared.tr.ColumnData;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
@ -15,7 +16,6 @@ import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
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.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
|
@ -29,20 +29,22 @@ import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
import com.sencha.gxt.widget.core.client.Window;
|
import com.sencha.gxt.widget.core.client.Window;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
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.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
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.form.FieldLabel;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
import com.sencha.gxt.widget.core.client.info.Info;
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
|
|
||||||
public class ChangeLabelColumnDialog extends Window {
|
public class ChangeLabelColumnDialog extends Window {
|
||||||
protected TRId trId;
|
protected TRId trId;
|
||||||
protected TextField label=null;
|
protected TextField label = null;
|
||||||
protected String columnName=null;
|
protected String columnName = null;
|
||||||
protected ColumnData column=null;
|
protected ColumnData column = null;
|
||||||
protected ComboBox<ColumnData> combo=null;
|
protected ComboBox<ColumnData> combo = null;
|
||||||
|
|
||||||
public ChangeLabelColumnDialog(TRId trId) {
|
public ChangeLabelColumnDialog(TRId trId) {
|
||||||
create(trId, null);
|
create(trId, null);
|
||||||
|
@ -53,14 +55,14 @@ public class ChangeLabelColumnDialog extends Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(TRId trId, String columnName) {
|
protected void create(TRId trId, String columnName) {
|
||||||
this.trId=trId;
|
this.trId = trId;
|
||||||
this.columnName=columnName;
|
this.columnName = columnName;
|
||||||
setBodyBorder(false);
|
|
||||||
// getHeader().setIcon(Resources.IMAGES.side_list());
|
|
||||||
setHeadingText("Change Column Label");
|
|
||||||
setWidth(400);
|
setWidth(400);
|
||||||
setHeight(140);
|
setHeight(140);
|
||||||
|
setBodyBorder(false);
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
|
setHeadingText("Change Column Label");
|
||||||
|
// getHeader().setIcon(Resources.IMAGES.side_list());
|
||||||
|
|
||||||
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
||||||
|
|
||||||
|
@ -68,32 +70,34 @@ public class ChangeLabelColumnDialog extends Window {
|
||||||
panel.setHeaderVisible(false);
|
panel.setHeaderVisible(false);
|
||||||
|
|
||||||
FramedPanel form = new FramedPanel();
|
FramedPanel form = new FramedPanel();
|
||||||
form.setHeaderVisible(false);
|
form.setHeaderVisible(false);
|
||||||
form.setBodyStyle("background: none;");
|
form.setBodyBorder(false);
|
||||||
|
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
|
|
||||||
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
||||||
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
||||||
|
|
||||||
Log.trace("Store created");
|
Log.trace("Store created");
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
||||||
|
|
||||||
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
public void load(ListLoadConfig loadConfig,
|
||||||
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
loadData(loadConfig, callback);
|
loadData(loadConfig, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(proxy);
|
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(
|
||||||
|
proxy);
|
||||||
loader.setRemoteSort(false);
|
loader.setRemoteSort(false);
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(store));
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(
|
||||||
|
store));
|
||||||
Log.trace("Loader created");
|
Log.trace("Loader created");
|
||||||
|
|
||||||
label = new TextField();
|
label = new TextField();
|
||||||
label.setAllowBlank(false);
|
label.setAllowBlank(false);
|
||||||
label.setWidth(150);
|
label.setWidth(150);
|
||||||
|
|
||||||
combo = new ComboBox<ColumnData>(store,
|
combo = new ComboBox<ColumnData>(store, props.label()) {
|
||||||
props.label()){
|
|
||||||
@Override
|
@Override
|
||||||
protected void onAfterFirstAttach() {
|
protected void onAfterFirstAttach() {
|
||||||
super.onAfterFirstAttach();
|
super.onAfterFirstAttach();
|
||||||
|
@ -113,17 +117,18 @@ public class ChangeLabelColumnDialog extends Window {
|
||||||
combo.setTypeAhead(true);
|
combo.setTypeAhead(true);
|
||||||
combo.setTriggerAction(TriggerAction.ALL);
|
combo.setTriggerAction(TriggerAction.ALL);
|
||||||
combo.setLoader(loader);
|
combo.setLoader(loader);
|
||||||
v.add(new FieldLabel(combo, "Column"), new VerticalLayoutData(1, -1));
|
v.add(new FieldLabel(combo, "Column"), new VerticalLayoutData(1, -1,
|
||||||
v.add(new FieldLabel(label, "Column Label"), new VerticalLayoutData(1, -1));
|
new Margins(1)));
|
||||||
|
v.add(new FieldLabel(label, "Column Label"), new VerticalLayoutData(1,
|
||||||
|
-1, new Margins(1)));
|
||||||
|
|
||||||
form.add(v);
|
form.add(v);
|
||||||
form.addButton(new TextButton("Change"));
|
form.addButton(new TextButton("Change"));
|
||||||
|
|
||||||
|
panel.add(form);
|
||||||
|
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
|
||||||
|
|
||||||
panel.add(form);
|
add(basicLayout);
|
||||||
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
|
|
||||||
|
|
||||||
add(basicLayout);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,34 +158,46 @@ public class ChangeLabelColumnDialog extends Window {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void loadData(ListLoadConfig loadConfig,
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
TDGWTServiceAsync.INSTANCE.getColumns(trId, new AsyncCallback<ArrayList<ColumnData>>(){
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||||
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.error("load combo failure:"+caught.getLocalizedMessage());
|
final Throwable c = caught;
|
||||||
callback.onFailure(caught);
|
Log.error("load combo failure:"
|
||||||
}
|
+ caught.getLocalizedMessage());
|
||||||
|
HideHandler hideHandler = new HideHandler() {
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
callback.onFailure(c);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ErrorMessageDialog d = new ErrorMessageDialog("Error",
|
||||||
|
"Error loading data", caught
|
||||||
|
.getLocalizedMessage());
|
||||||
|
d.addHideHandler(hideHandler);
|
||||||
|
d.show();
|
||||||
|
|
||||||
public void onSuccess(ArrayList<ColumnData> result) {
|
|
||||||
Log.trace("loaded " + result.size() + " ColumnData");
|
|
||||||
if(columnName!=null){
|
|
||||||
for(ColumnData cd: result){
|
|
||||||
if(cd.getName().compareTo(columnName)==0){
|
|
||||||
combo.setValue(cd);
|
|
||||||
column=cd;
|
|
||||||
label.setValue(cd.getLabel());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
callback.onSuccess(new ListLoadResultBean<ColumnData>(
|
|
||||||
result));
|
|
||||||
|
|
||||||
}
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
|
Log.trace("loaded " + result.size() + " ColumnData");
|
||||||
|
if (columnName != null) {
|
||||||
|
for (ColumnData cd : result) {
|
||||||
|
if (cd.getName().compareTo(columnName) == 0) {
|
||||||
|
combo.setValue(cd);
|
||||||
|
column = cd;
|
||||||
|
label.setValue(cd.getLabel());
|
||||||
|
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback.onSuccess(new ListLoadResultBean<ColumnData>(
|
||||||
|
result));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
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.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
|
@ -29,6 +29,7 @@ import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
import com.sencha.gxt.widget.core.client.Window;
|
import com.sencha.gxt.widget.core.client.Window;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
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.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.portlets.user.td.columnwidget.client;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
|
||||||
import com.google.gwt.editor.client.Editor.Path;
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
|
||||||
import com.sencha.gxt.data.shared.LabelProvider;
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
@ -16,8 +15,9 @@ public interface ColumnDataProperties extends
|
||||||
|
|
||||||
LabelProvider<ColumnData> label();
|
LabelProvider<ColumnData> label();
|
||||||
|
|
||||||
|
/*
|
||||||
ValueProvider<ColumnData, String> name();
|
ValueProvider<ColumnData, String> name();
|
||||||
/*
|
|
||||||
ValueProvider<ColumnData, String> typeName();
|
ValueProvider<ColumnData, String> typeName();
|
||||||
|
|
||||||
ValueProvider<ColumnData, String> typeCode();
|
ValueProvider<ColumnData, String> typeCode();
|
||||||
|
|
|
@ -2,10 +2,13 @@ package org.gcube.portlets.user.td.columnwidget.client;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.custom.ErrorMessageDialog;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||||
|
|
||||||
public class ColumnWidgetEntry implements EntryPoint {
|
public class ColumnWidgetEntry implements EntryPoint {
|
||||||
|
|
||||||
|
@ -21,6 +24,20 @@ public class ColumnWidgetEntry implements EntryPoint {
|
||||||
changeLabel.show();
|
changeLabel.show();
|
||||||
ChangeToAnnotationColumnDialog changeToAnnotation=new ChangeToAnnotationColumnDialog(trId);
|
ChangeToAnnotationColumnDialog changeToAnnotation=new ChangeToAnnotationColumnDialog(trId);
|
||||||
changeToAnnotation.show();
|
changeToAnnotation.show();
|
||||||
|
ChangeColumnTypeDialog changeColumnType=new ChangeColumnTypeDialog(trId);
|
||||||
|
changeColumnType.show();
|
||||||
|
|
||||||
|
HideHandler hideHandler = new HideHandler() {
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ErrorMessageDialog d = new ErrorMessageDialog("Error",
|
||||||
|
"Error loading data", new Throwable("Che bello poter scrivere tanto")
|
||||||
|
.getLocalizedMessage());
|
||||||
|
d.addHideHandler(hideHandler);
|
||||||
|
d.show();
|
||||||
|
|
||||||
Log.info("Hello!");
|
Log.info("Hello!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.widget.client.TextButton;
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
|
@ -35,11 +35,10 @@ 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.form.FieldLabel;
|
||||||
import com.sencha.gxt.widget.core.client.info.Info;
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
|
|
||||||
public class RemoveColumnDialog extends Window {
|
public class RemoveColumnDialog extends Window {
|
||||||
protected TRId trId;
|
protected TRId trId;
|
||||||
protected ComboBox<ColumnData> combo=null;
|
protected ComboBox<ColumnData> combo = null;
|
||||||
protected String columnName=null;
|
protected String columnName = null;
|
||||||
|
|
||||||
public RemoveColumnDialog(TRId trId) {
|
public RemoveColumnDialog(TRId trId) {
|
||||||
create(trId, null);
|
create(trId, null);
|
||||||
|
@ -50,8 +49,8 @@ public class RemoveColumnDialog extends Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(TRId trId, String columnName) {
|
protected void create(TRId trId, String columnName) {
|
||||||
this.trId=trId;
|
this.trId = trId;
|
||||||
this.columnName=columnName;
|
this.columnName = columnName;
|
||||||
setBodyBorder(false);
|
setBodyBorder(false);
|
||||||
// getHeader().setIcon(Resources.IMAGES.side_list());
|
// getHeader().setIcon(Resources.IMAGES.side_list());
|
||||||
setHeadingText("Remove Column");
|
setHeadingText("Remove Column");
|
||||||
|
@ -63,26 +62,27 @@ public class RemoveColumnDialog extends Window {
|
||||||
|
|
||||||
ContentPanel panel = new ContentPanel();
|
ContentPanel panel = new ContentPanel();
|
||||||
panel.setHeaderVisible(false);
|
panel.setHeaderVisible(false);
|
||||||
//panel.setBodyStyle("margin: 0px;");
|
// panel.setBodyStyle("margin: 0px;");
|
||||||
|
|
||||||
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
||||||
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
||||||
|
|
||||||
Log.trace("Store created");
|
Log.trace("Store created");
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
||||||
|
|
||||||
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
public void load(ListLoadConfig loadConfig,
|
||||||
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
loadData(loadConfig, callback);
|
loadData(loadConfig, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(proxy);
|
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(
|
||||||
|
proxy);
|
||||||
loader.setRemoteSort(false);
|
loader.setRemoteSort(false);
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(store));
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(
|
||||||
|
store));
|
||||||
Log.trace("Loader created");
|
Log.trace("Loader created");
|
||||||
|
|
||||||
|
combo = new ComboBox<ColumnData>(store, props.label()) {
|
||||||
combo = new ComboBox<ColumnData>(store,
|
|
||||||
props.label()){
|
|
||||||
@Override
|
@Override
|
||||||
protected void onAfterFirstAttach() {
|
protected void onAfterFirstAttach() {
|
||||||
super.onAfterFirstAttach();
|
super.onAfterFirstAttach();
|
||||||
|
@ -104,18 +104,17 @@ public class RemoveColumnDialog extends Window {
|
||||||
combo.setLoader(loader);
|
combo.setLoader(loader);
|
||||||
|
|
||||||
FramedPanel form = new FramedPanel();
|
FramedPanel form = new FramedPanel();
|
||||||
form.setHeaderVisible(false);
|
form.setHeaderVisible(false);
|
||||||
//form.setWidth(350);
|
// form.setWidth(350);
|
||||||
form.setBodyStyle("background: none;");
|
form.setBodyStyle("background: none;");
|
||||||
|
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
v.add(new FieldLabel(combo, "Column"), new VerticalLayoutData(1, -1));
|
v.add(new FieldLabel(combo, "Column"), new VerticalLayoutData(1, -1));
|
||||||
form.add(v);
|
form.add(v);
|
||||||
form.addButton(new TextButton("Remove"));
|
form.addButton(new TextButton("Remove"));
|
||||||
|
|
||||||
|
panel.add(form);
|
||||||
panel.add(form);
|
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
|
||||||
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
|
|
||||||
add(basicLayout);
|
add(basicLayout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -146,34 +145,32 @@ public class RemoveColumnDialog extends Window {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void loadData(ListLoadConfig loadConfig,
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
TDGWTServiceAsync.INSTANCE.getColumns(trId, new AsyncCallback<ArrayList<ColumnData>>(){
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||||
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.error("load combo failure:"+caught.getLocalizedMessage());
|
Log.error("load combo failure:"
|
||||||
callback.onFailure(caught);
|
+ caught.getLocalizedMessage());
|
||||||
}
|
callback.onFailure(caught);
|
||||||
|
|
||||||
public void onSuccess(ArrayList<ColumnData> result) {
|
|
||||||
Log.trace("loaded " + result.size() + " ColumnData");
|
|
||||||
if(columnName!=null){
|
|
||||||
for(ColumnData cd: result){
|
|
||||||
if(cd.getName().compareTo(columnName)==0){
|
|
||||||
combo.setValue(cd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
callback.onSuccess(new ListLoadResultBean<ColumnData>(
|
|
||||||
result));
|
|
||||||
|
|
||||||
}
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
|
Log.trace("loaded " + result.size() + " ColumnData");
|
||||||
|
if (columnName != null) {
|
||||||
|
for (ColumnData cd : result) {
|
||||||
|
if (cd.getName().compareTo(columnName) == 0) {
|
||||||
|
combo.setValue(cd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback.onSuccess(new ListLoadResultBean<ColumnData>(
|
||||||
|
result));
|
||||||
|
|
||||||
});
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.custom;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.custom.ErrorMessageDialog.ErrorMessageDialogAppearance;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
import com.google.gwt.resources.client.CssResource;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle.Source;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
import com.sencha.gxt.core.client.XTemplates;
|
||||||
|
import com.sencha.gxt.core.client.dom.XElement;
|
||||||
|
|
||||||
|
public class DefaultErrorMessageDialogApperance implements ErrorMessageDialogAppearance {
|
||||||
|
|
||||||
|
public interface Template extends XTemplates {
|
||||||
|
@XTemplate(source = "ErrorMessageDialog.html")
|
||||||
|
SafeHtml template(ErrorMessageDialogStyle style);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ErrorMessageDialogStyle extends CssResource {
|
||||||
|
@ClassName("container")
|
||||||
|
public String getContainer();
|
||||||
|
|
||||||
|
@ClassName("error")
|
||||||
|
public String getError();
|
||||||
|
|
||||||
|
@ClassName("errorExtended")
|
||||||
|
public String getErrorExtended();
|
||||||
|
|
||||||
|
@ClassName("errorExtendedContainer")
|
||||||
|
public String getErrorExtendedContainer();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ErrorMessageDialogStyle style;
|
||||||
|
private final Template template;
|
||||||
|
|
||||||
|
public interface ErrorMessageDialogResources extends ClientBundle {
|
||||||
|
public static final ErrorMessageDialogResources INSTANCE = GWT.create(ErrorMessageDialogResources.class);
|
||||||
|
|
||||||
|
@Source("ErrorMessageDialog.css")
|
||||||
|
ErrorMessageDialogStyle style();
|
||||||
|
|
||||||
|
@Source("exclamation.png")
|
||||||
|
ImageResource error();
|
||||||
|
|
||||||
|
@Source("exclamation_32.png")
|
||||||
|
ImageResource error32();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultErrorMessageDialogApperance() {
|
||||||
|
this(ErrorMessageDialogResources.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultErrorMessageDialogApperance(ErrorMessageDialogResources resources) {
|
||||||
|
this.style = resources.style();
|
||||||
|
this.style.ensureInjected();
|
||||||
|
|
||||||
|
this.template = GWT.create(Template.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void render(SafeHtmlBuilder sb) {
|
||||||
|
sb.append(template.template(style));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public XElement getMessageElement(XElement parent) {
|
||||||
|
XElement element = parent.selectNode("." + style.getError());
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XElement getExtendedElement(XElement parent) {
|
||||||
|
XElement element = parent.selectNode("." + style.getErrorExtended());
|
||||||
|
return element;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageResource getWindowIcon(){
|
||||||
|
return ErrorMessageDialogResources.INSTANCE.error();
|
||||||
|
};
|
||||||
|
|
||||||
|
/*public void onUpdateIcon(XElement parent, ImageResource icon) {
|
||||||
|
XElement element = parent.selectNode("." + style.getIconButtonImage());
|
||||||
|
Image image=new Image(icon);
|
||||||
|
Element img=image.getElement();
|
||||||
|
img.setClassName(style.getIconButtonRef());
|
||||||
|
element.appendChild(img);
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
|
||||||
|
.container {
|
||||||
|
background-color: #dfe8f6;
|
||||||
|
padding-left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
border: none;
|
||||||
|
font-size: 12px;
|
||||||
|
margin: 2px;
|
||||||
|
padding: 8px 0px 0px 0px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorExtended {
|
||||||
|
resize: none;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorExtendedContainer {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!-- file: ./IconButton.html -->
|
||||||
|
<div class="{style.container}">
|
||||||
|
<div class="{style.error}">
|
||||||
|
</div>
|
||||||
|
<div class="{style.errorExtendedContainer}">
|
||||||
|
<textarea class="{style.errorExtended}" cols="86" rows="16">
|
||||||
|
</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,110 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.custom;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
import com.sencha.gxt.core.client.dom.XElement;
|
||||||
|
import com.sencha.gxt.widget.core.client.Dialog;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||||
|
|
||||||
|
public class ErrorMessageDialog extends Dialog {
|
||||||
|
|
||||||
|
public interface ErrorMessageDialogAppearance {
|
||||||
|
|
||||||
|
XElement getMessageElement(XElement parent);
|
||||||
|
|
||||||
|
XElement getExtendedElement(XElement parent);
|
||||||
|
|
||||||
|
ImageResource getWindowIcon();
|
||||||
|
|
||||||
|
void render(SafeHtmlBuilder sb);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ImageResource icon;
|
||||||
|
protected ErrorMessageDialogAppearance contentAppearance;
|
||||||
|
|
||||||
|
public ErrorMessageDialog(String headingHtml, String messageHtml,
|
||||||
|
String extendedHtml) {
|
||||||
|
this(headingHtml, messageHtml, extendedHtml, (WindowAppearance) GWT
|
||||||
|
.create(WindowAppearance.class),
|
||||||
|
(ErrorMessageDialogAppearance) GWT
|
||||||
|
.create(DefaultErrorMessageDialogApperance.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a message box with the specified heading HTML, message HTML and
|
||||||
|
* appearance. It is the caller's responsibility to ensure the HTML is CSS
|
||||||
|
* safe.
|
||||||
|
*
|
||||||
|
* @param headingHtml
|
||||||
|
* the HTML to display for the message box heading
|
||||||
|
* @param messageHtml
|
||||||
|
* the HTML to display in the message box
|
||||||
|
* @param extendedHtml
|
||||||
|
* the HTML to display in the extended box
|
||||||
|
* @param appearance
|
||||||
|
* the message box window appearance
|
||||||
|
* @param contentAppearance
|
||||||
|
* the message box content appearance
|
||||||
|
*/
|
||||||
|
public ErrorMessageDialog(String headingHtml, String messageHtml,
|
||||||
|
String extendedHtml, WindowAppearance appearance,
|
||||||
|
ErrorMessageDialogAppearance contentAppearance) {
|
||||||
|
super(appearance);
|
||||||
|
|
||||||
|
setWidth(650);
|
||||||
|
//setHeight(350);
|
||||||
|
getHeader().setIcon(contentAppearance.getWindowIcon());
|
||||||
|
|
||||||
|
setResizable(false);
|
||||||
|
|
||||||
|
this.contentAppearance = contentAppearance;
|
||||||
|
|
||||||
|
setHeadingHtml(headingHtml);
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||||
|
contentAppearance.render(sb);
|
||||||
|
|
||||||
|
appearance.getContentElem(getElement()).setInnerHTML(
|
||||||
|
sb.toSafeHtml().asString());
|
||||||
|
|
||||||
|
contentAppearance.getMessageElement(getElement()).setId(
|
||||||
|
getId() + "-content");
|
||||||
|
|
||||||
|
if (messageHtml != null) {
|
||||||
|
contentAppearance.getMessageElement(getElement()).setInnerHTML(
|
||||||
|
messageHtml);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extendedHtml != null) {
|
||||||
|
contentAppearance.getExtendedElement(getElement()).setInnerHTML(
|
||||||
|
extendedHtml);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the message.
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* the message
|
||||||
|
*/
|
||||||
|
public void setMessage(String message) {
|
||||||
|
contentAppearance.getMessageElement(getElement()).setInnerHTML(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
setData("errorMessageDialog", true);
|
||||||
|
setResizable(false);
|
||||||
|
setConstrain(true);
|
||||||
|
setMinimizable(false);
|
||||||
|
setMaximizable(false);
|
||||||
|
setClosable(false);
|
||||||
|
setModal(true);
|
||||||
|
setButtonAlign(BoxLayoutPack.CENTER);
|
||||||
|
setPredefinedButtons(PredefinedButton.OK);
|
||||||
|
setHideOnButtonClick(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 636 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in New Issue