Updated Open Lock TR
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@111491 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -16,7 +16,7 @@ import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TDOpen extends WizardWindow {
|
public class TDOpen extends WizardWindow {
|
||||||
protected static final int WITHWIZARD=800;
|
protected static final int WITHWIZARD=820;
|
||||||
protected static final int HEIGHTWIZARD=520;
|
protected static final int HEIGHTWIZARD=520;
|
||||||
|
|
||||||
protected TDOpenSession tdOpenSession;
|
protected TDOpenSession tdOpenSession;
|
||||||
|
|
|
@ -27,5 +27,6 @@ public interface TabResourcesProperties extends PropertyAccess<TabResource> {
|
||||||
ValueProvider<TabResource, String> date();
|
ValueProvider<TabResource, String> date();
|
||||||
ValueProvider<TabResource, String> tableTypeName();
|
ValueProvider<TabResource, String> tableTypeName();
|
||||||
ValueProvider<TabResource, String> ownerLogin();
|
ValueProvider<TabResource, String> ownerLogin();
|
||||||
|
ValueProvider<TabResource, Boolean> locked();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,8 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
Command sayFinish = new Command() {
|
Command sayFinish = new Command() {
|
||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
retrieveLastTable();
|
ckeckIsLocked();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -87,6 +88,25 @@ public class TabResourcesSelectionCard extends WizardCard {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void ckeckIsLocked() {
|
||||||
|
|
||||||
|
if (tdOpenSession.getSelectedTabResource().isLocked()) {
|
||||||
|
Log.debug(
|
||||||
|
"Attention",
|
||||||
|
"This tabular resource is locked");
|
||||||
|
AlertMessageBox d = new AlertMessageBox("Attention",
|
||||||
|
"This tabular resource is locked");
|
||||||
|
d.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
retrieveLastTable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public TDOpenSession getTdOpenSession() {
|
public TDOpenSession getTdOpenSession() {
|
||||||
return tdOpenSession;
|
return tdOpenSession;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
package org.gcube.portlets.user.td.openwidget.client;
|
package org.gcube.portlets.user.td.openwidget.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
|
@ -20,6 +19,7 @@ import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundl
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.cell.client.AbstractCell;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
@ -29,6 +29,7 @@ import com.google.gwt.event.logical.shared.HasSelectionHandlers;
|
||||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
import com.google.gwt.event.shared.HandlerRegistration;
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
|
@ -73,21 +74,6 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
public class TabResourcesSelectionPanel extends ContentPanel implements
|
public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
HasSelectionHandlers<TabResource> {
|
HasSelectionHandlers<TabResource> {
|
||||||
|
|
||||||
private static final TabResourcesProperties properties = GWT
|
|
||||||
.create(TabResourcesProperties.class);
|
|
||||||
|
|
||||||
protected static final ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
|
||||||
properties.name(), 90, "Name");
|
|
||||||
protected static final ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
|
||||||
properties.tabResourceType(), 30, "Type");
|
|
||||||
protected static final ColumnConfig<TabResource, String> tableTypeNameColumn = new ColumnConfig<TabResource, String>(
|
|
||||||
properties.tableTypeName(), 30, "Table Type");
|
|
||||||
protected static final ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(
|
|
||||||
properties.agency(), 60, "Agency");
|
|
||||||
protected static final ColumnConfig<TabResource, String> ownerColumn = new ColumnConfig<TabResource, String>(
|
|
||||||
properties.ownerLogin(), 70, "Owner");
|
|
||||||
protected static final ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(
|
|
||||||
properties.date(), 50, "Creation Date");
|
|
||||||
|
|
||||||
protected Grid<TabResource> grid;
|
protected Grid<TabResource> grid;
|
||||||
protected ResourceBundle res;
|
protected ResourceBundle res;
|
||||||
|
@ -110,10 +96,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
buildPanel(properties.id(),
|
buildPanel();
|
||||||
Arrays.<ColumnConfig<TabResource, ?>> asList(nameColumn,
|
|
||||||
typeColumn, tableTypeNameColumn, ownerColumn,
|
|
||||||
agencyColumn, dateColumn), nameColumn);
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.debug("Error building panel:" + e.getMessage());
|
Log.debug("Error building panel:" + e.getMessage());
|
||||||
|
@ -123,13 +106,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
// new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void buildPanel(ModelKeyProvider<TabResource> keyProvider,
|
protected void buildPanel() {
|
||||||
List<ColumnConfig<TabResource, ?>> columns,
|
|
||||||
ColumnConfig<TabResource, ?> autoexpandColumn) {
|
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar();
|
ToolBar toolBar = new ToolBar();
|
||||||
toolBar.add(new LabelToolItem("Search: "));
|
toolBar.add(new LabelToolItem("Search: "));
|
||||||
|
@ -146,10 +125,58 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
final CheckBoxSelectionModel<TabResource> sm = new CheckBoxSelectionModel<TabResource>(
|
final CheckBoxSelectionModel<TabResource> sm = new CheckBoxSelectionModel<TabResource>(
|
||||||
identity);
|
identity);
|
||||||
|
|
||||||
|
TabResourcesProperties properties = GWT
|
||||||
|
.create(TabResourcesProperties.class);
|
||||||
|
|
||||||
|
ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
||||||
|
properties.name(), 90, "Name");
|
||||||
|
ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
||||||
|
properties.tabResourceType(), 30, "Type");
|
||||||
|
ColumnConfig<TabResource, String> tableTypeNameColumn = new ColumnConfig<TabResource, String>(
|
||||||
|
properties.tableTypeName(), 30, "Table Type");
|
||||||
|
ColumnConfig<TabResource, Boolean> lockedColumn = new ColumnConfig<TabResource, Boolean>(
|
||||||
|
properties.locked(), 20, "Locked");
|
||||||
|
ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(
|
||||||
|
properties.agency(), 60, "Agency");
|
||||||
|
ColumnConfig<TabResource, String> ownerColumn = new ColumnConfig<TabResource, String>(
|
||||||
|
properties.ownerLogin(), 70, "Owner");
|
||||||
|
ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(
|
||||||
|
properties.date(), 50, "Creation Date");
|
||||||
|
|
||||||
|
lockedColumn.setCell(new AbstractCell<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Context context, Boolean value,
|
||||||
|
SafeHtmlBuilder sb) {
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
sb.appendHtmlConstant("<img style='margin:auto;padding:auto;display:block;' src='"
|
||||||
|
+ ResourceBundleTDOpen.INSTANCE.lock().getSafeUri()
|
||||||
|
.asString() + "' alt='true'>");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
sb.appendHtmlConstant("<img style='margin:auto;padding:auto;display:block;' src='"
|
||||||
|
+ ResourceBundleTDOpen.INSTANCE.lockOpen().getSafeUri()
|
||||||
|
.asString() + "' alt='true'>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
List<ColumnConfig<TabResource, ?>> columns=new ArrayList<ColumnConfig<TabResource,?>>();
|
||||||
|
columns.add(nameColumn);
|
||||||
|
columns.add(typeColumn);
|
||||||
|
columns.add(tableTypeNameColumn);
|
||||||
|
columns.add(lockedColumn);
|
||||||
|
columns.add(ownerColumn);
|
||||||
|
columns.add(agencyColumn);
|
||||||
|
columns.add(dateColumn);
|
||||||
|
|
||||||
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
|
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
|
||||||
|
|
||||||
|
|
||||||
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(
|
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(
|
||||||
keyProvider);
|
properties.id());
|
||||||
|
|
||||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||||
|
|
||||||
|
@ -201,7 +228,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
grid.setLoader(loader);
|
grid.setLoader(loader);
|
||||||
grid.setSelectionModel(sm);
|
grid.setSelectionModel(sm);
|
||||||
grid.getView().setAutoExpandColumn(autoexpandColumn);
|
grid.getView().setAutoExpandColumn(nameColumn);
|
||||||
grid.getView().setStripeRows(true);
|
grid.getView().setStripeRows(true);
|
||||||
grid.getView().setColumnLines(true);
|
grid.getView().setColumnLines(true);
|
||||||
grid.getView().setAutoFill(true);
|
grid.getView().setAutoFill(true);
|
||||||
|
@ -321,9 +348,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
+ " TabularResources");
|
+ " TabularResources");
|
||||||
ArrayList<TabResource> avaibles = new ArrayList<TabResource>();
|
ArrayList<TabResource> avaibles = new ArrayList<TabResource>();
|
||||||
for (TabResource tResource : result) {
|
for (TabResource tResource : result) {
|
||||||
if (!tResource.isLocked()) {
|
//if (!tResource.isLocked()) {
|
||||||
avaibles.add(tResource);
|
avaibles.add(tResource);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -21,4 +21,20 @@ public interface ResourceBundleTDOpen extends ClientBundle {
|
||||||
@Source("delete_32.png")
|
@Source("delete_32.png")
|
||||||
ImageResource delete32();
|
ImageResource delete32();
|
||||||
|
|
||||||
|
@Source("lock-red.png")
|
||||||
|
ImageResource lock();
|
||||||
|
|
||||||
|
@Source("lock-red_32.png")
|
||||||
|
ImageResource lock32();
|
||||||
|
|
||||||
|
@Source("lock-open-green.png")
|
||||||
|
ImageResource lockOpen();
|
||||||
|
|
||||||
|
@Source("lock-open-green_32.png")
|
||||||
|
ImageResource lockOpen32();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
After Width: | Height: | Size: 879 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 858 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 879 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 858 B |
After Width: | Height: | Size: 1.7 KiB |