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 {
|
||||
protected static final int WITHWIZARD=800;
|
||||
protected static final int WITHWIZARD=820;
|
||||
protected static final int HEIGHTWIZARD=520;
|
||||
|
||||
protected TDOpenSession tdOpenSession;
|
||||
|
|
|
@ -27,5 +27,6 @@ public interface TabResourcesProperties extends PropertyAccess<TabResource> {
|
|||
ValueProvider<TabResource, String> date();
|
||||
ValueProvider<TabResource, String> tableTypeName();
|
||||
ValueProvider<TabResource, String> ownerLogin();
|
||||
ValueProvider<TabResource, Boolean> locked();
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,8 @@ public class TabResourcesSelectionCard extends WizardCard {
|
|||
Command sayFinish = new Command() {
|
||||
|
||||
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() {
|
||||
return tdOpenSession;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package org.gcube.portlets.user.td.openwidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
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 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.Scheduler;
|
||||
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.SelectionHandler;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||
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
|
||||
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 ResourceBundle res;
|
||||
|
@ -110,11 +96,8 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
buildPanel(properties.id(),
|
||||
Arrays.<ColumnConfig<TabResource, ?>> asList(nameColumn,
|
||||
typeColumn, tableTypeNameColumn, ownerColumn,
|
||||
agencyColumn, dateColumn), nameColumn);
|
||||
|
||||
buildPanel();
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.debug("Error building panel:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
@ -123,13 +106,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
|
||||
protected void init() {
|
||||
setHeaderVisible(false);
|
||||
// new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
||||
|
||||
}
|
||||
|
||||
protected void buildPanel(ModelKeyProvider<TabResource> keyProvider,
|
||||
List<ColumnConfig<TabResource, ?>> columns,
|
||||
ColumnConfig<TabResource, ?> autoexpandColumn) {
|
||||
protected void buildPanel() {
|
||||
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(new LabelToolItem("Search: "));
|
||||
|
@ -145,11 +124,59 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
IdentityValueProvider<TabResource> identity = new IdentityValueProvider<TabResource>();
|
||||
final CheckBoxSelectionModel<TabResource> sm = new CheckBoxSelectionModel<TabResource>(
|
||||
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);
|
||||
|
||||
|
||||
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(
|
||||
keyProvider);
|
||||
properties.id());
|
||||
|
||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||
|
||||
|
@ -201,7 +228,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||
grid.setLoader(loader);
|
||||
grid.setSelectionModel(sm);
|
||||
grid.getView().setAutoExpandColumn(autoexpandColumn);
|
||||
grid.getView().setAutoExpandColumn(nameColumn);
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
|
@ -321,9 +348,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
+ " TabularResources");
|
||||
ArrayList<TabResource> avaibles = new ArrayList<TabResource>();
|
||||
for (TabResource tResource : result) {
|
||||
if (!tResource.isLocked()) {
|
||||
avaibles.add(tResource);
|
||||
}
|
||||
//if (!tResource.isLocked()) {
|
||||
avaibles.add(tResource);
|
||||
//}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -21,4 +21,20 @@ public interface ResourceBundleTDOpen extends ClientBundle {
|
|||
@Source("delete_32.png")
|
||||
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 |