Update Batch Replace
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@94401 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
914cef09a9
commit
41eb61a1ee
|
@ -6,7 +6,10 @@ import java.util.List;
|
|||
import org.gcube.portlets.user.td.columnwidget.client.custom.ActionButtonCell;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ShowOccurrencesTypeProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeElement;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeStore;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
|
@ -24,18 +27,22 @@ 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.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.safecss.shared.SafeStylesBuilder;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
||||
import com.sencha.gxt.core.client.util.Format;
|
||||
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.event.StoreDataChangeEvent;
|
||||
import com.sencha.gxt.data.shared.event.StoreDataChangeEvent.StoreDataChangeHandler;
|
||||
|
@ -54,12 +61,16 @@ 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.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
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.grid.CheckBoxSelectionModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
||||
import com.sencha.gxt.widget.core.client.info.Info;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
/**
|
||||
|
@ -87,21 +98,21 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
|||
|
||||
private TextButton btnSave;
|
||||
private TextButton btnClose;
|
||||
private ComboBox<ShowOccurrencesTypeElement> comboShowOccurrencesType = null;
|
||||
private FieldLabel comboShowOccurencesTypeLabel;
|
||||
|
||||
protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader;
|
||||
protected Grid<ReplaceEntry> grid;
|
||||
protected ListStore<ReplaceEntry> store;
|
||||
protected HTML info;
|
||||
|
||||
|
||||
|
||||
|
||||
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
|
||||
String columnName, EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
this.trId = trId;
|
||||
this.columnName = columnName;
|
||||
this.eventBus = eventBus;
|
||||
hasValidationColumns=false;
|
||||
hasValidationColumns = false;
|
||||
Log.debug("Create BatchReplacePanel(): [" + trId.toString()
|
||||
+ " , columnName:" + columnName + "]");
|
||||
init();
|
||||
|
@ -117,7 +128,39 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
|||
}
|
||||
|
||||
protected void create() {
|
||||
ToolBar toolBarHead = new ToolBar();
|
||||
toolBarHead.add(new LabelToolItem("Show: "));
|
||||
|
||||
|
||||
// Create Combo Show
|
||||
ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT
|
||||
.create(ShowOccurrencesTypeProperties.class);
|
||||
ListStore<ShowOccurrencesTypeElement> storeShowOccurrencesType = new ListStore<ShowOccurrencesTypeElement>(
|
||||
propsShowOccurrencesType.id());
|
||||
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
|
||||
.getShowOccurrencesType());
|
||||
|
||||
comboShowOccurrencesType = new ComboBox<ShowOccurrencesTypeElement>(
|
||||
storeShowOccurrencesType, propsShowOccurrencesType.type());
|
||||
Log.trace("ComboMeasureType created");
|
||||
|
||||
addHandlersForShowOccurrencesType(propsShowOccurrencesType.type());
|
||||
|
||||
comboShowOccurrencesType.setEmptyText("Select a show type...");
|
||||
comboShowOccurrencesType.setWidth(100);
|
||||
comboShowOccurrencesType.setTypeAhead(true);
|
||||
comboShowOccurrencesType.setEditable(false);
|
||||
comboShowOccurrencesType.setTriggerAction(TriggerAction.ALL);
|
||||
comboShowOccurrencesType.setValue(ShowOccurrencesTypeStore.onlyErrorsElement);
|
||||
|
||||
toolBarHead.add(comboShowOccurrencesType);
|
||||
|
||||
/*comboShowOccurencesTypeLabel = new FieldLabel(comboShowOccurrencesType,
|
||||
"Show");
|
||||
*/
|
||||
|
||||
|
||||
// Create Grid
|
||||
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
|
||||
CheckBoxSelectionModel<ReplaceEntry> sm = new CheckBoxSelectionModel<ReplaceEntry>(
|
||||
identity);
|
||||
|
@ -233,7 +276,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
|||
number.initPlugin(grid);
|
||||
// grid.getView().setAutoExpandColumn(labelCol);
|
||||
// grid.setHeight(360);
|
||||
grid.setHeight("418px");
|
||||
grid.setHeight("388px");
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
|
@ -284,6 +327,8 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
|||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
//v.add(comboShowOccurencesTypeLabel,new VerticalLayoutData(-1, -1, new Margins(0,0,2,0)));
|
||||
v.add(toolBarHead,new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
|
||||
v.add(flowButton, new VerticalLayoutData(-1, 36,
|
||||
|
@ -329,14 +374,14 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
|||
Log.debug("Validation Columns: " + result.size());
|
||||
ArrayList<String> validationColumnReferences = new ArrayList<String>();
|
||||
if (result.size() > 0) {
|
||||
hasValidationColumns=true;
|
||||
hasValidationColumns = true;
|
||||
for (ColumnData columnData : result) {
|
||||
validationColumnReferences.add(columnData
|
||||
.getColumnId());
|
||||
}
|
||||
column.setValidationColumnReferences(validationColumnReferences);
|
||||
} else {
|
||||
hasValidationColumns=false;
|
||||
hasValidationColumns = false;
|
||||
}
|
||||
create();
|
||||
}
|
||||
|
@ -344,6 +389,35 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
protected void addHandlersForShowOccurrencesType(
|
||||
final LabelProvider<ShowOccurrencesTypeElement> labelProvider) {
|
||||
comboShowOccurrencesType
|
||||
.addSelectionHandler(new SelectionHandler<ShowOccurrencesTypeElement>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<ShowOccurrencesTypeElement> event) {
|
||||
Info.display(
|
||||
"Show Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboShowOccurrencesType selected: "
|
||||
+ event.getSelectedItem());
|
||||
ShowOccurrencesTypeElement showType = event
|
||||
.getSelectedItem();
|
||||
updateShowType(showType.getType());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected void updateShowType(String type){
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) {
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.properties;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeElement;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface ShowOccurrencesTypeProperties extends
|
||||
PropertyAccess<ShowOccurrencesTypeElement> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<ShowOccurrencesTypeElement> id();
|
||||
|
||||
LabelProvider<ShowOccurrencesTypeElement> type();
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.store;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ShowOccurrencesTypeElement {
|
||||
|
||||
protected int id; // For insert in table only
|
||||
protected String type;
|
||||
|
||||
|
||||
public ShowOccurrencesTypeElement(int id,String type){
|
||||
this.id=id;
|
||||
this.type=type;
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ShowOccurrencesTypeElement [id=" + id + ", type=" + type + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.store;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ShowOccurrencesTypeStore implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1908324094430432681L;
|
||||
private final static String ONLYERRORS="Only Errors";
|
||||
private final static String ALL="All";
|
||||
|
||||
protected static ArrayList<ShowOccurrencesTypeElement> store;
|
||||
|
||||
public static ShowOccurrencesTypeElement onlyErrorsElement=new ShowOccurrencesTypeElement(1,ONLYERRORS);
|
||||
public static ShowOccurrencesTypeElement allElement=new ShowOccurrencesTypeElement(2,ALL);
|
||||
|
||||
|
||||
public static ArrayList<ShowOccurrencesTypeElement> getShowOccurrencesType(){
|
||||
store=new ArrayList<ShowOccurrencesTypeElement>();
|
||||
store.add(onlyErrorsElement);
|
||||
store.add(allElement);
|
||||
return store;
|
||||
}
|
||||
|
||||
public static int selectedShowOccurrencesTypePosition(String selected){
|
||||
int position=0;
|
||||
if(selected.compareTo(ONLYERRORS)==0){
|
||||
position=1;
|
||||
} else {
|
||||
if(selected.compareTo(ALL)==0){
|
||||
position=2;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
public static String selectedShowOccurrencesType(String selected){
|
||||
if(selected.compareTo(ONLYERRORS)==0){
|
||||
return ONLYERRORS;
|
||||
} else {
|
||||
if(selected.compareTo(ALL)==0){
|
||||
return ALL;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ShowOccurrencesTypeElement selectedShowOccurrencesTypeElement(String selected){
|
||||
if(selected.compareTo(ONLYERRORS)==0){
|
||||
return onlyErrorsElement;
|
||||
} else {
|
||||
if(selected.compareTo(ALL)==0){
|
||||
return allElement;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue