Updated custom style sheet

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@141546 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-01-13 11:07:06 +00:00
parent 2b71b38a8b
commit da1885eba9
2 changed files with 119 additions and 139 deletions

View File

@ -50,7 +50,7 @@ import com.google.gwt.user.client.ui.Button;
/**
*
*
* @author "Federico De Faveri defaveri@isti.cnr.it" - Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
@ -65,40 +65,38 @@ public class SpeciesSearchFormPanel extends ContentPanel {
private boolean isActiveAdvanced = false;
private HorizontalPanel hpAdvancedSearchLinks = new HorizontalPanel();
private final Html htmlLabelAdvs = new Html("Advanced Option");
private HorizontalPanel horizontalQueryPanel = new HorizontalPanel();
private HorizontalPanel horizontalQueryPanel = new HorizontalPanel();
public static final int NORTHHEIGHT = 150;
private List<ToggleButton> tabItemList = new ArrayList<ToggleButton>();
private AdvancedSearchPanelManager advSearchPanelsManager = AdvancedSearchPanelManager.getInstance();
private final int DEFAULTLINKPANELTHEIGHT = 22;
public static enum SEARCHTYPE {SIMPLE, FULLTEXT};
public TextArea textArea = new TextArea();
private SEARCHTYPE currentSearchType = SEARCHTYPE.SIMPLE;
private com.extjs.gxt.ui.client.widget.button.Button buttSearchBy = new com.extjs.gxt.ui.client.widget.button.Button(SEARCHBYQUERY);
private final static String SEARCHBYQUERY = "Text query";
private final static String SEARCHBYSIMPLE = "Simple query";
private HorizontalPanel simpleSearchPanel = new HorizontalPanel();
private HorizontalPanel querySeachPanel = new HorizontalPanel();
protected Button buttQuerySearch;
protected Button buttQueryExample;
protected CheckBox checkValidateOccurrences = new CheckBox();
public SpeciesSearchFormPanel(EventBus eventBus) {
this.eventBus = eventBus;
bind();
horizontalQueryPanel.setStyleAttribute("margin-left", "10px");
horizontalQueryPanel.setStyleAttribute("margin-top", "15px");
// horizontalQueryPanel.setScrollMode(Scroll.AUTO);
// simpleSearchPanel.setScrollMode(Scroll.AUTO);
horizontalQueryPanel.setStyleAttribute("margin-top", "10px");
htmlLabelAdvs.setStyleAttribute("font-size", "11px");
htmlLabelAdvs.setStyleAttribute("margin-left", "10px");
buttSearchBy.setStyleName("button-hyperlink");
buttSearchBy.setStyleAttribute("margin-left", "5px");
@ -106,29 +104,29 @@ public class SpeciesSearchFormPanel extends ContentPanel {
setFrame(false);
setHeaderVisible(false);
setBorders(false);
initComboSearchType();
initComboSearchTypeResult();
init();
switchSearchType(SEARCHTYPE.SIMPLE);
add(advSearchPanelsManager.getPanel());
}
private void initComboSearchType(){
searchType = new SimpleComboBox<String>();
searchType.add(Arrays.asList(new String[]{ConstantsSpeciesDiscovery.SCIENTIFIC_NAME, ConstantsSpeciesDiscovery.COMMON_NAME}));
searchType.setEditable(false);
searchType.setTriggerAction(TriggerAction.ALL);
searchType.setSimpleValue(ConstantsSpeciesDiscovery.SCIENTIFIC_NAME);
searchType.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
@ -137,31 +135,31 @@ public class SpeciesSearchFormPanel extends ContentPanel {
});
}
private void initComboSearchTypeResult(){
searchTypeResults = new SimpleComboBox<String>();
searchTypeResults.add(Arrays.asList(new String[]{SpeciesCapability.RESULTITEM.getName(), SpeciesCapability.TAXONOMYITEM.getName()}));
searchTypeResults.setEditable(false);
searchTypeResults.setTriggerAction(TriggerAction.ALL);
searchTypeResults.setSimpleValue(SpeciesCapability.RESULTITEM.getName());
searchTypeResults.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
eventBus.fireEvent(new CapabilitySelectedEvent(getCapability(se.getSelectedItem().getValue())));
}
});
}
//RETURN RESULT ITEM OR TAXOMONY ITEM
public SpeciesCapability getSelectedCapability(){
return getCapability(searchTypeResults.getValue().getValue());
}
private SpeciesCapability getCapability(String value){
if(value.compareTo(SpeciesCapability.TAXONOMYITEM.getName())==0)
return SpeciesCapability.TAXONOMYITEM;
@ -173,24 +171,24 @@ public class SpeciesSearchFormPanel extends ContentPanel {
return SpeciesCapability.SYNONYMS;
else if(value.compareTo(SpeciesCapability.UNFOLD.getName())==0)
return SpeciesCapability.UNFOLD;
return SpeciesCapability.UNKNOWN;
}
private SearchType getSearchType(String value){
if(value.compareTo(ConstantsSpeciesDiscovery.SCIENTIFIC_NAME)==0)
return SearchType.BY_SCIENTIFIC_NAME;
else if(value.compareTo(ConstantsSpeciesDiscovery.COMMON_NAME)==0)
return SearchType.BY_COMMON_NAME;
return SearchType.BY_SCIENTIFIC_NAME;
}
public void switchSearchType(SEARCHTYPE searchType){
currentSearchType = searchType;
if(searchType.equals(SEARCHTYPE.SIMPLE)){
@ -205,22 +203,22 @@ public class SpeciesSearchFormPanel extends ContentPanel {
hpAdvancedSearchLinks.setEnabled(false);
activeAdvancedSearch(false);
}
}
protected void init()
{
horizontalQueryPanel.setBorders(false);
horizontalQueryPanel.setSize(1150, 33);
searchTypeResults.setStyleAttribute("margin-right", "10px");
initSimpleSearchPanel();
initQuerySearchPanel();
createAdvancedSeachLinks();
horizontalQueryPanel.add(simpleSearchPanel);
horizontalQueryPanel.add(querySeachPanel);
@ -228,70 +226,70 @@ public class SpeciesSearchFormPanel extends ContentPanel {
@Override
public void componentSelected(ButtonEvent ce) {
if(currentSearchType.equals(SEARCHTYPE.SIMPLE))
switchSearchType(SEARCHTYPE.FULLTEXT);
else
switchSearchType(SEARCHTYPE.SIMPLE);
switchSearchType(SEARCHTYPE.SIMPLE);
}
});
horizontalQueryPanel.add(buttSearchBy);
add(horizontalQueryPanel);
add(horizontalQueryPanel);
add(hpAdvancedSearchLinks);
}
private void initQuerySearchPanel() {
querySeachPanel.setSpacing(5);
buttQuerySearch = new Button("Search");
buttQuerySearch.setStyleName("wizardButton");
buttQuerySearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
searchByQuery(textArea.getValue());
}
});
buttQueryExample = new Button("Example", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
textArea.setValue("SEARCH BY SN 'Carcharodon carcharias' in OBIS RETURN Occurrence");
}
});
buttQueryExample.setStyleName("wizardButton");
textArea.setSize(450, 37);
textArea.setEmptyText("Write a query");
textArea.setStyleAttribute("margin-right", "5px");
querySeachPanel.add(textArea);
com.extjs.gxt.ui.client.widget.button.Button buttQueryInfo = new com.extjs.gxt.ui.client.widget.button.Button();
com.extjs.gxt.ui.client.widget.button.Button buttQueryInfo = new com.extjs.gxt.ui.client.widget.button.Button();
buttQueryInfo.setStyleAttribute("margin-right", "15px");
buttQueryInfo.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getHelpIcon()));
buttQueryInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
new HelpQueryWindow();
}
});
querySeachPanel.add(buttQueryInfo);
querySeachPanel.add(buttQuerySearch);
querySeachPanel.add(buttQueryExample);
@ -300,10 +298,10 @@ public class SpeciesSearchFormPanel extends ContentPanel {
private void initSimpleSearchPanel() {
simpleSearchPanel.setSpacing(5);
simpleSearchPanel.setVerticalAlign(VerticalAlignment.MIDDLE);
VerticalPanel vtPanel = new VerticalPanel();
HorizontalPanel hpPanel = new HorizontalPanel();
hpPanel.setVerticalAlign(VerticalAlignment.MIDDLE);
@ -314,19 +312,19 @@ public class SpeciesSearchFormPanel extends ContentPanel {
hpPanel.add(textSearch);
hpPanel.add(searchTypeResults);
Text textBy = new Text("By:");
textBy.setStyleAttribute("margin-left", "5px");
textBy.setStyleAttribute("margin-right", "5px");
hpPanel.add(textBy);
hpPanel.add(searchType);
Text textTerm = new Text("Term:");
textTerm.setStyleAttribute("margin-left", "10px");
textTerm.setStyleAttribute("margin-right", "5px");
hpPanel.add(textTerm);
searchField = new TextField<String>();
searchField.setStyleAttribute("margin-left", "0px");
searchField.setStyleAttribute("margin-right", "10px");
@ -338,76 +336,76 @@ public class SpeciesSearchFormPanel extends ContentPanel {
public void componentKeyPress(ComponentEvent event) {
if (event.getKeyCode()==KeyCodes.KEY_ENTER) search();
}
});
hpPanel.add(searchField);
checkValidateOccurrences.setBoxLabel("validate occurrences");
checkValidateOccurrences.setValueAttribute("validate occurrences");
checkValidateOccurrences.setValueAttribute("validate occurrences");
checkValidateOccurrences.setStyleAttribute("margin-right", "10px");
buttSimpleSearch = new Button("Search");
buttSimpleSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
search();
}
});
buttSimpleSearch.setStyleName("wizardButton");
hpPanel.add(buttSimpleSearch);
buttSimpleExample = new Button("Example", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
searchField.setValue("Carcharodon carcharias");
}
});
buttSimpleExample.setStyleName("wizardButton");
hpPanel.add(buttSimpleExample);
HorizontalPanel hpPanelExpand = new HorizontalPanel();
hpPanelExpand.setVerticalAlign(VerticalAlignment.MIDDLE);
hpPanelExpand.setStyleAttribute("margin-top", "10px");
Text textExpand = new Text("Expand with synonyms: ");
textExpand.setStyleAttribute("margin-left", "5px");
textExpand.setStyleAttribute("margin-right", "5px");
vtPanel.add(hpPanel);
simpleSearchPanel.add(vtPanel);
}
public boolean getValueCheckValidateOcccurrences(){
return this.checkValidateOccurrences.getValue();
}
public void setValueCheckValidateOcccurrences(boolean bool){
this.checkValidateOccurrences.setValue(bool);
}
public void setVisibleCheckValidateOcccurrences(boolean bool){
this.checkValidateOccurrences.setVisible(bool);
}
public void activeButtonSearch(boolean bool){
buttSimpleSearch.setEnabled(bool);
}
private void createAdvancedSeachLinks() {
hpAdvancedSearchLinks.setVerticalAlign(VerticalAlignment.MIDDLE);
hpAdvancedSearchLinks.setStyleAttribute("marginLeft", "15px");
hpAdvancedSearchLinks.setStyleAttribute("marginRight", "15px");
@ -415,12 +413,12 @@ public class SpeciesSearchFormPanel extends ContentPanel {
hpAdvancedSearchLinks.setStyleAttribute("border-bottom", "thin solid #99BBE8;");
hpAdvancedSearchLinks.setStyleAttribute("background-color", "#EFF5FB");
hpAdvancedSearchLinks.add(htmlLabelAdvs);
hpAdvancedSearchLinks.setHeight(DEFAULTLINKPANELTHEIGHT);
//hpAdvancedSearchLinks.setHeight(DEFAULTLINKPANELTHEIGHT);
// imageArrowRight.setStyleAttribute("margin-top", "5px");
// imageArrowDown.setStyleAttribute("margin-top", "5px");
for(final String advPanel : advSearchPanelsManager.getListAdvancedSearchPanels()){
ToggleButton butt = new ToggleButton(advPanel);
butt.setToggleGroup("tab");
butt.setSize(100, -1);
@ -428,32 +426,32 @@ public class SpeciesSearchFormPanel extends ContentPanel {
butt.setId(advPanel);
butt.setStyleName("button-hyperlink");
butt.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getArrowRight()));
tabItemList.add(butt);
butt.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
// isActiveAdvanced = !isActiveAdvanced;
ToggleButton butt = (ToggleButton) ce.getButton();
isActiveAdvanced = butt.isPressed();
advSearchPanelsManager.setActivePanel(advPanel);
activeAdvancedSearch(isActiveAdvanced);
changeStateIcons();
}
private void changeStateIcons() {
for(ToggleButton toggle : tabItemList){
if(toggle.isPressed()){
toggle.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getArrowDown()));
toggle.getElement().getStyle().setBackgroundColor("#D0DEF0");
}else{
toggle.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getArrowRight()));
toggle.getElement().getStyle().clearBackgroundColor();
@ -461,19 +459,19 @@ public class SpeciesSearchFormPanel extends ContentPanel {
}
}
}
});
hpAdvancedSearchLinks.add(butt);
}
}
private void activeAdvancedSearch(boolean bool){
if(bool){
// htmlLabelAdvs.setHtml(messageAdvActive);
SearchBorderLayoutPanel.getInstance().updateNorthSize(NORTHHEIGHT);
@ -489,17 +487,17 @@ public class SpeciesSearchFormPanel extends ContentPanel {
String searchTerm = searchField.getValue();
if (buttSimpleSearch.isEnabled() && searchTerm!=null && searchTerm.length()!=0) {
// if(isActiveAdvanced){
search(searchTerm,
advSearchPanelsManager.getUpperBoundLatitudeField().getValue(),
advSearchPanelsManager.getUpperBoundLongitudeField().getValue(),
advSearchPanelsManager.getLowerBoundLatitudeField().getValue(),
advSearchPanelsManager.getLowerBoundLongitudeField().getValue(),
advSearchPanelsManager.getFromDate().getValue(),
advSearchPanelsManager.getToDate().getValue(),
advSearchPanelsManager.getCheckedDataSources(),
ResultFilterPanelManager.getInstance().getGroupByRank(),
search(searchTerm,
advSearchPanelsManager.getUpperBoundLatitudeField().getValue(),
advSearchPanelsManager.getUpperBoundLongitudeField().getValue(),
advSearchPanelsManager.getLowerBoundLatitudeField().getValue(),
advSearchPanelsManager.getLowerBoundLongitudeField().getValue(),
advSearchPanelsManager.getFromDate().getValue(),
advSearchPanelsManager.getToDate().getValue(),
advSearchPanelsManager.getCheckedDataSources(),
ResultFilterPanelManager.getInstance().getGroupByRank(),
advSearchPanelsManager.getCurrentSelectedCapability(),
advSearchPanelsManager.getCheckedDataSourceForSynonyms(),
advSearchPanelsManager.getCheckedDataSourceForUnfold());
@ -522,8 +520,8 @@ public class SpeciesSearchFormPanel extends ContentPanel {
SearchEvent event = new SearchEvent(type, searchTerm, upperBoundLongitude, upperBoundLatitude, lowerBoundLongitude, lowerBoundLatitude, fromDate, toDate, listDataSources, groupRank, resultType, listDataSourceForSynonyms, listDataSourceForUnfold);
eventBus.fireEvent(event);
}
protected void searchByQuery(String query)
{
if (query!=null && query.length()!=0) {
@ -547,7 +545,7 @@ public class SpeciesSearchFormPanel extends ContentPanel {
@Override
public void onSearchComplete(SearchCompleteEvent event) {
enableSearch();
enableSearch();
}
});
}

View File

@ -96,11 +96,6 @@ public class SessionUtil {
session.setAttribute(TAXONOMY_OCCURRENCE, searchSession);
}
// public static void setCurrentTaxonomyChildrenSession(ASLSession session, FetchingSession<TaxonomyRow> searchSession)
// {
// session.setAttribute(TAXONOMY_CHILD, searchSession);
// }
public static ASLSession getAslSession(HttpSession httpSession)
{
String sessionID = httpSession.getId();
@ -110,30 +105,19 @@ public class SessionUtil {
//for test only
user = "test.user";
// user = "lucio.lelii";
// user = "pasquale.pagano";
// user = "francesco.mangiacrapa";
String scope = "/gcube/devsec"; //Development
// String scope = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityResearchEnvironment"; //Production
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, user);
session.setScope(scope);
logger.warn("TaxonomySearchServiceImpl STARTING IN TEST MODE - NO USER FOUND");
logger.warn("Created fake Asl session for user "+user + " with scope "+scope);
// session.setScope("/gcube/devsec");
return session;
}
return SessionManager.getInstance().getASLSession(sessionID, user);
}
//MODIFIED******************************************************************************************
public static void setCurrentEJBResultRow(ASLSession session, ResultRowPersistence resultRowPersistence) {
session.setAttribute(EJB_RESULT_ROW, resultRowPersistence);
}
@ -197,7 +181,6 @@ public class SessionUtil {
}
/**
*
* @param aslSession
@ -260,7 +243,6 @@ public class SessionUtil {
}
/**
* @return
*