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"?>
<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>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</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>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -34,10 +34,10 @@
</attributes>
</classpathentry>
<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>
<attribute name="owner.project.facets" value="java"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</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>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1
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.problem.assertIdentifier=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="/WEB-INF/classes" source-path="/src/main/java"/>
<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="context-root" value="resource-management"/>
</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"
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"
date="2017-02-24">
<Change>Changed codes for AuthZ framework</Change>

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>resource-management</artifactId>
<version>6.4.0-SNAPSHOT</version>
<version>6.5.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>gCube Resource Management Portlet</name>
<description>
@ -63,6 +63,12 @@
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<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.Listener;
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.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel;
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.MessageBox;
import com.extjs.gxt.ui.client.widget.ProgressBar;
import com.extjs.gxt.ui.client.widget.Status;
import com.extjs.gxt.ui.client.widget.Text;
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.BorderLayout;
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.GWT;
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.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager;
@ -654,11 +662,42 @@ public class ResourceManagementPortlet implements EntryPoint {
statusbar.add(new SeparatorToolItem());
if (StatusHandler.getStatus().getRunningMode() != RunningMode.PORTAL) {
Button btnScope = new Button("Available Scopes");
btnScope.setMenu(new Menu());
WidgetsRegistry.registerWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID, btnScope);
//Your View Class
final ListStore<ContexClientModel> yourStore = new ListStore<ContexClientModel>(){
@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
statusbar.add(btnScope);
statusbar.add(new Html("&nbsp;&nbsp;&nbsp;"));
statusbar.add(select);
} else {
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.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.resourcedetails.ResourceDetailsPanel;
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 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.Dialog;
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.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.user.client.rpc.AsyncCallback;
@ -69,28 +68,26 @@ public class Callbacks {
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
return;
}
Button btnScopes = (Button) WidgetsRegistry.getWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID);
Menu scrollMenu = new Menu();
scrollMenu.setMaxHeight(200);
@SuppressWarnings("unchecked")
ComboBox<ContexClientModel> select = (ComboBox<ContexClientModel>) WidgetsRegistry.getWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID);
LocalStatus.getInstance().getAvailableScopes().clear();
final ListStore<ContexClientModel> yourStore = select.getStore();
for (String scope : result) {
final String currScope = scope;
LocalStatus.getInstance().getAvailableScopes().add(currScope);
scrollMenu.add(new MenuItem(currScope) {
@Override
protected void onClick(final ComponentEvent be) {
super.onClick(be);
Commands.doLoadResourceTree(this, currScope);
String splits[] = currScope.split("/");
String context = splits[splits.length-1];
if (splits.length > 3) { //VRE
context += " ("+splits[2]+")";
} else if (splits.length == 3) { //VO
context += " ("+splits[1]+")";
}
});
}
btnScopes.setMenu(scrollMenu);
yourStore.add(new ContexClientModel(scope, context));
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
}
}
public void onFailure(final Throwable caught) {
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
MessageBox.info("Failure", "cannot retrieve the scopes", null);

View File

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