merged with branch version at 119582

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@119616 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-10-12 14:34:45 +00:00
parent 635771de74
commit 210133ec30
5 changed files with 142 additions and 47 deletions

View File

@ -5,10 +5,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<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="workspace-tree-widget-6.9.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-tree-widget-BRANCH-6.9.0-SNAPSHOT/workspace-tree-widget-BRANCH-6.9.0-SNAPSHOT">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="wsmail-widget-1.9.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/wsmail-widget-TRUNK/wsmail-widget-TRUNK">
<dependent-module archiveName="workspace-tree-widget-6.9.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-tree-widget-TRUNK/workspace-tree-widget-TRUNK">
<dependency-type>uses</dependency-type>
</dependent-module>

View File

@ -527,7 +527,7 @@ public class AppController implements SubscriberInterface {
private void doSaveSmartFolder(SaveSmartFolderEvent event) {
AppControllerExplorer.getEventBus().fireEvent(new AddSmartFolderEvent(event.getSearchText()));
AppControllerExplorer.getEventBus().fireEvent(new AddSmartFolderEvent(event.getSearchText(), event.getWorkpaceFolderId()));
}
});
@ -542,16 +542,10 @@ public class AppController implements SubscriberInterface {
}
private void doElementDoubleClick(final FileGridModel fileModel) {
// appContrExplorer.expandFolder(event.getIdentifier());
//COMMENTED 01-02-2013
// appContrExplorer.expandFolder(event.getIdentifier());
if(fileModel.getIdentifier()!=null){
if(wsPortlet.getSearchAndFilterContainer().isSearchActive()){
AppController.getEventBus().fireEvent(new SearchTextEvent(null));
AppController.getEventBus().fireEvent(new SearchTextEvent(null, null));
wsPortlet.getSearchAndFilterContainer().setSearchActive(false);
resetSmartFolderSelected();
}
@ -583,23 +577,21 @@ public class AppController implements SubscriberInterface {
// setSearchActive(true);
appContrExplorer.searching(true);
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activeButtonsOnSearch(true); //ADDED 09-08-13
doSearchText(searchTextEvent.getTextSearch());
doSearchText(searchTextEvent.getTextSearch(), searchTextEvent.getFolderId());
}
}
private void doSearchText(String textSearch) {
private void doSearchText(String textSearch, String folderId) {
if(wsPortlet.getGxtCardLayoutResultPanel().getActivePanel() instanceof GxtItemsPanel){ //If active panel is panel with file items
wsPortlet.getSearchAndFilterContainer().setVisibleButtonSave(true); //ADDED 24/04/2012
// wsPortlet.getGxtCardLayoutResultPanel().getToolBarItem().activeAllButtonWithoutGroupView(false); //ADDED 06/02/2013
wsPortlet.getGridGroupContainer().setBorderAsOnSearch(true);
wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE);
appContrExplorer.getRpcWorkspaceService().getItemsBySearchName(textSearch, new AsyncCallback<List<FileGridModel>>() {
appContrExplorer.getRpcWorkspaceService().getItemsBySearchName(textSearch, folderId, new AsyncCallback<List<FileGridModel>>() {
@Override
public void onFailure(Throwable caught) {
@ -615,7 +607,7 @@ public class AppController implements SubscriberInterface {
wsPortlet.getGridGroupContainer().unmask();
}
});
}
}
}
});
@ -725,7 +717,7 @@ public class AppController implements SubscriberInterface {
wsPortlet.getSearchAndFilterContainer().searchCancel(); //cancel search
if(wsPortlet.getGxtCardLayoutResultPanel().getActivePanel() instanceof GxtItemsPanel){ //If active panel is panel with file items
AppController.getEventBus().fireEvent(new SearchTextEvent(null));
AppController.getEventBus().fireEvent(new SearchTextEvent(null, null));
}
doPathElementSelected(event);
@ -1427,7 +1419,7 @@ public class AppController implements SubscriberInterface {
//CASE IS A SEARCH
if(wsPortlet.getSearchAndFilterContainer().isSearchActive()){ //ADDED 12-04-12
wsPortlet.getSearchAndFilterContainer().searchCancel(); //TODO added in 05/04/2012
AppController.getEventBus().fireEvent(new SearchTextEvent(null));
AppController.getEventBus().fireEvent(new SearchTextEvent(null, null));
wsPortlet.getSearchAndFilterContainer().setSearchActive(false);
resetSmartFolderSelected();
updatGridViewForSelectedItem(item);
@ -1578,7 +1570,7 @@ public class AppController implements SubscriberInterface {
//***ADDED 24/04/2012
wsPortlet.getSearchAndFilterContainer().searchCancel();
eventBus.fireEvent(new SearchTextEvent(null));
eventBus.fireEvent(new SearchTextEvent(null, null));
// appContrExplorer.searching(false);
//**************

View File

@ -2,33 +2,62 @@ package org.gcube.portlets.user.workspace.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* The Class SearchTextEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Oct 9, 2015
*/
public class SearchTextEvent extends GwtEvent<SearchTextEventHandler> {
public static Type<SearchTextEventHandler> TYPE = new Type<SearchTextEventHandler>();
public static Type<SearchTextEventHandler> TYPE = new Type<SearchTextEventHandler>();
private String textSearch = null;
public SearchTextEvent(String text) {
this.textSearch = text;
private String textSearch = null;
private String folderId;
/**
* Instantiates a new search text event.
*
* @param text the text
* @param folderId the folder id
*/
public SearchTextEvent(String text, String folderId) {
this.textSearch = text;
this.folderId = folderId;
}
/**
* @return the folderId
*/
public String getFolderId() {
return folderId;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<SearchTextEventHandler> getAssociatedType() {
// TODO Auto-generated method stub
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(SearchTextEventHandler handler) {
handler.onSearchText(this);
}
/**
* Gets the text search.
*
* @return the text search
*/
public String getTextSearch() {
return textSearch;
}
}

View File

@ -11,6 +11,7 @@ import org.gcube.portlets.user.workspace.client.model.ScopeModel;
import org.gcube.portlets.user.workspace.client.view.GxtComboBox;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtBreadcrumbPathPanel;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.KeyListener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
@ -44,8 +45,12 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
private ComboBox<ScopeModel> cbViewScope = null;
private final TextField<String> textSearch = new TextField<String>();
private Button bSearch = new Button(ConstantsPortlet.SEARCH);
// private Image bSearchIn = Resources.getIconSearchWs().createImage();
// private HorizontalPanel hpSearchIn = new HorizontalPanel();
// private String searchInFolderId = ""; //is the root
private Button bCancel = new Button(ConstantsPortlet.CANCEL);
private Button bSave = new Button(ConstantsPortlet.SAVE);
// private Label labelSearchIn = new Label();
private TextField<String> textFull = new TextField<String>();
private DateField fromDate = new DateField();
private DateField toDate = new DateField();
@ -74,11 +79,9 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
// this.textSearch.setStyleAttribute("margin-bottom", "0px");
this.cbViewScope.setWidth(360);
// this.cbViewScope.setAutoWidth(true);
this.toolbarPahtPanel = toolBarPathPanel;
hp.setStyleAttribute("margin-left", "2px");
seVisibleButtonsCancelSave(false);
textSearch.setAllowBlank(true);
@ -99,9 +102,55 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
bSave.setStyleName("wizardButton");
bSave.getElement().getStyle().setMarginLeft(3, Unit.PX);
/*bSearchIn.addStyleName("bSearchIn");
// hpSearchIn.setVerticalAlign(VerticalAlignment.BOTTOM);
bSearchIn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final WorkspaceExplorerSelectDialog navigator = new WorkspaceExplorerSelectDialog("Select a Folder", true);
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
GWT.log("onSelectedItem: "+item);
selectedFolderToSearch(item);
navigator.hide();
}
@Override
public void onFailed(Throwable throwable) {
GWT.log("onFailed..");
}
@Override
public void onAborted() {
GWT.log("onAborted..");
}
@Override
public void onNotValidSelection() {
GWT.log("onNotValidSelection..");
}
};
navigator.addWorkspaceExplorerSelectNotificationListener(listener);
navigator.show();
}
});*/
/*
initSearchIn();
hpSearchIn.setVerticalAlign(VerticalAlignment.MIDDLE);
labelSearchIn.setStyleAttribute("margin-right", "2px");
hp.add(hpSearchIn);
*/
hp.add(bSearch);
// hp.add(bCancel);
hp.add(bSave);
hp.setVerticalAlign(VerticalAlignment.MIDDLE);
hp.setHeight(20);
hpMain.setHeight(20);
@ -116,18 +165,14 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
verticalPanel.setId("VerticalPanelSearchAndFilter");
verticalPanel.setStyleAttribute("background", "#D0DEF0");
hpMain.add(hp);
hpMain.setVerticalAlign(VerticalAlignment.MIDDLE);
//SOLUTION FOR SCOPE INVISIBLE
cbViewScope.setVisible(false);
// hpMain.add(hp2);
// verticalPanel.setLayout(new FitLayout());
// hpMain.setStyleAttribute("margin", "2px; 8px;");
verticalPanel.add(this.toolbarPahtPanel.getToolBarPathPanel());
verticalPanel.add(hpMain);
// verticalPanel.setStyleAttribute("background-color", "#d0def0");
verticalPanel.setVerticalAlign(VerticalAlignment.MIDDLE);
this.addListeners();
@ -143,6 +188,24 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
layout();
}
/*
private void initSearchIn(){
hpSearchIn.removeAll();
searchInFolderId = "";
labelSearchIn.setText("");
// labelSearchIn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
hpSearchIn.add(labelSearchIn);
hpSearchIn.setStyleAttribute("margin-left", "3px");
hpSearchIn.add(bSearchIn);
hpSearchIn.layout(true);
}
private void selectedFolderToSearch(Item item){
searchInFolderId = item.getId();
labelSearchIn.setText("in "+item.getName());
labelSearchIn.setTitle("search in "+item.getName());
}*/
/**
* Update window size
@ -162,7 +225,8 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
public void searchText(String value){
textSearch.setValue(value);
seVisibleButtonsCancelSave(true);
AppController.getEventBus().fireEvent(new SearchTextEvent(value));
String parentId = toolbarPahtPanel.getLastParent()!=null?toolbarPahtPanel.getLastParent().getIdentifier():null;
AppController.getEventBus().fireEvent(new SearchTextEvent(value, parentId));
}
private void addListeners(){
@ -170,10 +234,12 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
bSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid()){
if(isValidSearch()){
// seVisibleButtonsCancelSave(true);
// AppController.getEventBus().fireEvent(new SearchTextEvent(textSearch.getValue()));
searchText(textSearch.getValue());
}else if(textSearch.getValue()==null || textSearch.getValue().isEmpty()){
searchCancel();
}
}
});
@ -181,9 +247,11 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
KeyListener keyListener = new KeyListener() {
public void componentKeyUp(ComponentEvent event) {
if (event.getKeyCode() == 13) { // KEY_ENTER
// seVisibleButtonsCancelSave(true);
// AppController.getEventBus().fireEvent(new SearchTextEvent(textSearch.getValue()));
searchText(textSearch.getValue());
if(isValidSearch()){
searchText(textSearch.getValue());
}else if(textSearch.getValue()==null || textSearch.getValue().isEmpty()){
searchCancel();
}
}
}
};
@ -205,7 +273,8 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
public void onClick(ClickEvent event) {
if(textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid()){
if (textSearch.getValue() != null && textSearch.getValue().length()>0) {
AppController.getEventBus().fireEvent(new SaveSmartFolderEvent(null, textSearch.getValue(), null));
String parentId = toolbarPahtPanel.getLastParent()!=null?toolbarPahtPanel.getLastParent().getIdentifier():null;
AppController.getEventBus().fireEvent(new SaveSmartFolderEvent(null, textSearch.getValue(), parentId));
}
}
}
@ -233,6 +302,10 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
this.cbNameFilter.reset();
}
private boolean isValidSearch(){
return textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid();
}
public void seVisibleButtonsCancelSave(boolean flag){
@ -242,6 +315,7 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
public void searchCancel(){
resetFields();
// initSearchIn();
seVisibleButtonsCancelSave(false);
}

View File

@ -332,4 +332,7 @@
}
.Breadcrumbs-Personal a:hover {
text-decoration: underline;
}
.bSearchIn {
cursor: pointer;
}