Updated select context menu enabling filtering as you type

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/resource-management@169505 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2018-06-27 15:03:05 +00:00
parent 33f4cbe31e
commit 37af2d2413
10 changed files with 136 additions and 39 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/resource-management-6.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/resource-management-6.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/resource-management-6.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/resource-management-6.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -34,10 +34,10 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/resource-management-6.4.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/resource-management-6.5.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

View File

@ -4,6 +4,9 @@
<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="rmp-common-library-2.8.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/rmp-common-library/rmp-common-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/> <property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="resource-management"/> <property name="context-root" value="resource-management"/>
</wb-module> </wb-module>

View File

@ -1 +1,17 @@
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]} {
"plugins": {
"aui": {
},
"liferay": {
},
"yui": {
}
},
"libs": [
"ecma5",
"browser"
]
}

View File

@ -1,5 +1,9 @@
<ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xsd/changelog.xsd"> xsi:noNamespaceSchemaLocation="xsd/changelog.xsd">
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.6-5-0"
date="2018-06-25">
<Change>Updated select context menu enabling filtering as you type</Change>
</Changeset>
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.6-3-0" <Changeset component="org.gcube.portlets-admin.resource-management-portlet.6-3-0"
date="2017-02-24"> date="2017-02-24">
<Change>Changed codes for AuthZ framework</Change> <Change>Changed codes for AuthZ framework</Change>

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.admin</groupId> <groupId>org.gcube.portlets.admin</groupId>
<artifactId>resource-management</artifactId> <artifactId>resource-management</artifactId>
<version>6.4.0-SNAPSHOT</version> <version>6.5.0-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>gCube Resource Management Portlet</name> <name>gCube Resource Management Portlet</name>
<description> <description>
@ -63,6 +63,12 @@
<version>${gwtVersion}</version> <version>${gwtVersion}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId> <artifactId>gcube-widgets</artifactId>

View File

@ -0,0 +1,27 @@
package org.gcube.portlets.admin.resourcemanagement.client;
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.google.gwt.user.client.rpc.IsSerializable;
@SuppressWarnings("serial")
public class ContexClientModel extends BaseModelData implements IsSerializable {
public ContexClientModel() {
}
public ContexClientModel(final String id, final String name) {
set("id", id);
set("name", name);
}
public String getId() {
return get("id");
}
public String getName() {
return get("name");
}
public void setId(final String id) {
set("id", id);
}
public void setName(final String name) {
set("name", name);
}
}

View File

@ -50,15 +50,22 @@ import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ComponentEvent; import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.Listener; import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.MessageBoxEvent; import com.extjs.gxt.ui.client.event.MessageBoxEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.util.Margins; import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Dialog; import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Label; import com.extjs.gxt.ui.client.widget.Label;
import com.extjs.gxt.ui.client.widget.MessageBox; import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.ProgressBar; import com.extjs.gxt.ui.client.widget.ProgressBar;
import com.extjs.gxt.ui.client.widget.Status; import com.extjs.gxt.ui.client.widget.Status;
import com.extjs.gxt.ui.client.widget.Text; import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.layout.AccordionLayout; import com.extjs.gxt.ui.client.widget.layout.AccordionLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout; import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.extjs.gxt.ui.client.widget.layout.FitLayout;
@ -74,6 +81,7 @@ import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback; import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler; import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
@ -654,11 +662,42 @@ public class ResourceManagementPortlet implements EntryPoint {
statusbar.add(new SeparatorToolItem()); statusbar.add(new SeparatorToolItem());
if (StatusHandler.getStatus().getRunningMode() != RunningMode.PORTAL) { if (StatusHandler.getStatus().getRunningMode() != RunningMode.PORTAL) {
Button btnScope = new Button("Available Scopes"); //Your View Class
btnScope.setMenu(new Menu()); final ListStore<ContexClientModel> yourStore = new ListStore<ContexClientModel>(){
WidgetsRegistry.registerWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID, btnScope); @Override
public ContexClientModel findModel(final ContexClientModel model) {
if(model.getId()!=null&&!model.getId().isEmpty()){
for (final ContexClientModel m : all) {
if(model.getId().equals(m.getId())) {
return m;
}
}
}
return null;
}
};
final ComboBox< ContexClientModel > select = new ComboBox< ContexClientModel >();
select.setAllowBlank(false);
select.setStore(yourStore);
select.setDisplayField("name");
select.setValueField("id");
select.setTriggerAction(TriggerAction.ALL);
select.setMaxHeight(500);
select.setWidth("310px");
select.setEmptyText("Available Contexts");
select.addSelectionChangedListener(new SelectionChangedListener<ContexClientModel>() {
@Override
public void selectionChanged(SelectionChangedEvent<ContexClientModel> se) {
Commands.doLoadResourceTree(this, se.getSelectedItem().getId());
GWT.log("doLoadResourceTree");
}
});
WidgetsRegistry.registerWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID, select);
// Checks that this menu item is permitted to the current user // Checks that this menu item is permitted to the current user
statusbar.add(btnScope); statusbar.add(new Html("&nbsp;&nbsp;&nbsp;"));
statusbar.add(select);
} else { } else {
statusbar.add(new Label("Current role: " + StatusHandler.getStatus().getCredentials())); statusbar.add(new Label("Current role: " + StatusHandler.getStatus().getCredentials()));
} }

View File

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import org.gcube.portlets.admin.resourcemanagement.client.ContexClientModel;
import org.gcube.portlets.admin.resourcemanagement.client.views.profile.ResourceProfilePanel; import org.gcube.portlets.admin.resourcemanagement.client.views.profile.ResourceProfilePanel;
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceDetailsPanel; import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceDetailsPanel;
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceGridFactory; import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceGridFactory;
@ -38,15 +39,13 @@ import org.gcube.resourcemanagement.support.shared.types.Tuple;
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile; import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
import com.extjs.gxt.ui.client.data.ModelData; import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.ComponentEvent; import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Dialog; import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.MessageBox; import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.grid.Grid; import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
@ -69,27 +68,25 @@ public class Callbacks {
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID); Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
return; return;
} }
Button btnScopes = (Button) WidgetsRegistry.getWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID);
Menu scrollMenu = new Menu(); @SuppressWarnings("unchecked")
scrollMenu.setMaxHeight(200); ComboBox<ContexClientModel> select = (ComboBox<ContexClientModel>) WidgetsRegistry.getWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID);
LocalStatus.getInstance().getAvailableScopes().clear(); LocalStatus.getInstance().getAvailableScopes().clear();
final ListStore<ContexClientModel> yourStore = select.getStore();
for (String scope : result) { for (String scope : result) {
final String currScope = scope; final String currScope = scope;
LocalStatus.getInstance().getAvailableScopes().add(currScope); LocalStatus.getInstance().getAvailableScopes().add(currScope);
scrollMenu.add(new MenuItem(currScope) { String splits[] = currScope.split("/");
@Override String context = splits[splits.length-1];
protected void onClick(final ComponentEvent be) { if (splits.length > 3) { //VRE
super.onClick(be); context += " ("+splits[2]+")";
Commands.doLoadResourceTree(this, currScope); } else if (splits.length == 3) { //VO
} context += " ("+splits[1]+")";
}); }
yourStore.add(new ContexClientModel(scope, context));
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
} }
btnScopes.setMenu(scrollMenu);
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
} }
public void onFailure(final Throwable caught) { public void onFailure(final Throwable caught) {
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID); Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
@ -148,7 +145,7 @@ public class Callbacks {
* Here implemented the logics for that. * Here implemented the logics for that.
*/ */
public static final AsyncCallback<HashMap<String, ArrayList<String>>> handleLoadResourceTree = public static final AsyncCallback<HashMap<String, ArrayList<String>>> handleLoadResourceTree =
new AsyncCallback<HashMap<String, ArrayList<String>>>() { new AsyncCallback<HashMap<String, ArrayList<String>>>() {
public void onSuccess(final HashMap<String, ArrayList<String>> result) { public void onSuccess(final HashMap<String, ArrayList<String>> result) {
builtResourceTree(result, true); builtResourceTree(result, true);
} }
@ -169,7 +166,7 @@ public class Callbacks {
* Here implemented the logics for that. * Here implemented the logics for that.
*/ */
public static final AsyncCallback<HashMap<String, ArrayList<String>>> handleReloadResourceTree = public static final AsyncCallback<HashMap<String, ArrayList<String>>> handleReloadResourceTree =
new AsyncCallback<HashMap<String, ArrayList<String>>>() { new AsyncCallback<HashMap<String, ArrayList<String>>>() {
public void onSuccess(final HashMap<String, ArrayList<String>> result) { public void onSuccess(final HashMap<String, ArrayList<String>> result) {
builtResourceTree(result, false); builtResourceTree(result, false);
} }
@ -190,13 +187,13 @@ public class Callbacks {
* they will be shown inside a grid that is created here. * they will be shown inside a grid that is created here.
*/ */
public static final AsyncCallback<List<String>> handleLoadResourceDetailsGrid = public static final AsyncCallback<List<String>> handleLoadResourceDetailsGrid =
new AsyncCallback<List<String>>() { new AsyncCallback<List<String>>() {
public void onSuccess(final List<String> result) { public void onSuccess(final List<String> result) {
Commands.mask( Commands.mask(
"Rendering grid", "Rendering grid",
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer() WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
); );
try { try {
ResourceDetailsPanel resGrid = Commands.getResourceDetailPanel(); ResourceDetailsPanel resGrid = Commands.getResourceDetailPanel();
Grid<ModelData> grid = ResourceGridFactory.createGrid(StatusHandler.getStatus().getCurrentResourceType(), Grid<ModelData> grid = ResourceGridFactory.createGrid(StatusHandler.getStatus().getCurrentResourceType(),
@ -226,7 +223,7 @@ public class Callbacks {
public static final AsyncCallback<List<String>> handleFilterResourceDetailsGrid = public static final AsyncCallback<List<String>> handleFilterResourceDetailsGrid =
new AsyncCallback<List<String>>() { new AsyncCallback<List<String>>() {
public void onSuccess(final List<String> result) { public void onSuccess(final List<String> result) {
try { try {
ResourceDetailsPanel resGrid = Commands.getResourceDetailPanel(); ResourceDetailsPanel resGrid = Commands.getResourceDetailPanel();
@ -258,7 +255,7 @@ public class Callbacks {
public static final AsyncCallback<CompleteResourceProfile> handleGetResourceProfile = public static final AsyncCallback<CompleteResourceProfile> handleGetResourceProfile =
new AsyncCallback<CompleteResourceProfile>() { new AsyncCallback<CompleteResourceProfile>() {
public void onSuccess(final CompleteResourceProfile result) { public void onSuccess(final CompleteResourceProfile result) {
Dialog dlg = new Dialog(); Dialog dlg = new Dialog();
@ -285,7 +282,7 @@ public class Callbacks {
//result.getType() + ": " + result.getTitle(), //result.getType() + ": " + result.getTitle(),
result.getTitle(), result.getTitle(),
"resource-profile-taskbar-item", "resource-profile-taskbar-item",
"profile-big-icon"); "profile-big-icon");
tkItem.getRelatedWindow().setMainWidget( tkItem.getRelatedWindow().setMainWidget(
new ResourceProfilePanel( new ResourceProfilePanel(
result.getType(), result.getType(),
@ -308,7 +305,7 @@ public class Callbacks {
public static final AsyncCallback<Tuple<String>> handleGetDeploymentReport = public static final AsyncCallback<Tuple<String>> handleGetDeploymentReport =
new AsyncCallback<Tuple<String>>() { new AsyncCallback<Tuple<String>>() {
public void onSuccess(final Tuple<String> result) { public void onSuccess(final Tuple<String> result) {

View File

@ -2,6 +2,11 @@
/*@import url(openbio.css);*/ /*@import url(openbio.css);*/
@import url(coherence.css); @import url(coherence.css);
div.x-form-field-wrap .x-form-trigger {
left: -15px !important;
}
/* Fix the scrollbar background style*/ /* Fix the scrollbar background style*/
.x-progress-text div { .x-progress-text div {
background-color: transparent !important; background-color: transparent !important;