Graphic glitch added to Liferay 6.2

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@128967 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-06-01 14:50:24 +00:00
parent 733aab8758
commit 3eaf0c29da
4 changed files with 171 additions and 164 deletions

View File

@ -60,6 +60,6 @@ public class ConstantsPortlet {
public static final long MILLISECS_PER_DAY = 1000L * 60L * 60L * 24L; public static final long MILLISECS_PER_DAY = 1000L * 60L * 60L * 24L;
public static final int NORTH_HEIGHT = 70; public static final int NORTH_HEIGHT = 77;
} }

View File

@ -46,7 +46,7 @@ public class GxtBasicTabPanel extends LayoutContainer {
private TabItem tabView = null; private TabItem tabView = null;
private TabItem tabSearch = null; private TabItem tabSearch = null;
private TabPanel tabPanel = null; private TabPanel tabPanel = null;
private Text txtPath = new Text("PATH:"); private Text txtPath = new Text("PATH:");
private Label labelPath = new Label(""); private Label labelPath = new Label("");
private GxtComboBox comboBoxGxt = null; private GxtComboBox comboBoxGxt = null;
private ComboBox<ScopeModel> cbViewScope = null; private ComboBox<ScopeModel> cbViewScope = null;
@ -54,7 +54,7 @@ public class GxtBasicTabPanel extends LayoutContainer {
private Text txtViewScope = new Text("View Scope:"); private Text txtViewScope = new Text("View Scope:");
public enum viewSwitchType {TREE,SHORTCUT}; public enum viewSwitchType {TREE,SHORTCUT};
private final String EMPTY = "EMPTY"; private final String EMPTY = "EMPTY";
//Tab Search //Tab Search
private final TextField<String> textSearch = new TextField<String>(); private final TextField<String> textSearch = new TextField<String>();
private Button bSearch = new Button("Search"); private Button bSearch = new Button("Search");
@ -65,15 +65,15 @@ public class GxtBasicTabPanel extends LayoutContainer {
private final String FIELDVALIDATEERROR = "The field must be alphanumeric"; private final String FIELDVALIDATEERROR = "The field must be alphanumeric";
private SimpleComboBox<String> cbNameFilter = null; private SimpleComboBox<String> cbNameFilter = null;
// TableData tdContentView = null; // TableData tdContentView = null;
public GxtBasicTabPanel() { public GxtBasicTabPanel() {
// Log.trace("Initializing GxtBasicTabPanel"); // Log.trace("Initializing GxtBasicTabPanel");
setLayout(new FitLayout()); setLayout(new FitLayout());
setBorders(true); setBorders(true);
setId("ContentPanelTab"); setId("ContentPanelTab");
this.tabPanel = new TabPanel(); this.tabPanel = new TabPanel();
this.tabView = new TabItem("View"); this.tabView = new TabItem("View");
this.tabSearch = new TabItem("Search"); this.tabSearch = new TabItem("Search");
@ -101,28 +101,15 @@ public class GxtBasicTabPanel extends LayoutContainer {
tabPanel.setBorderStyle(false); tabPanel.setBorderStyle(false);
tabPanel.setPlain(true); tabPanel.setPlain(true);
VBoxLayout vBoxLayout = new VBoxLayout(); VBoxLayout vBoxLayout = new VBoxLayout();
vBoxLayout.setPadding(new Padding(5)); vBoxLayout.setPadding(new Padding(5));
vBoxLayout.setVBoxLayoutAlign(VBoxLayoutAlign.LEFT); vBoxLayout.setVBoxLayoutAlign(VBoxLayoutAlign.LEFT);
VBoxLayoutData flex = new VBoxLayoutData(new Margins(30, 10, 10, 10)); VBoxLayoutData flex = new VBoxLayoutData(new Margins(30, 10, 10, 10));
txtPath.addStyleName("pad-text"); txtPath.addStyleName("pad-text");
txtPath.setStyleAttribute("backgroundColor", "white"); txtPath.setStyleAttribute("backgroundColor", "white");
txtPath.setAutoWidth(true); txtPath.setAutoWidth(true);
// Radio radioTree = new Radio();
// radioTree.setBoxLabel("Tree");
// radioTree.setValue(true);
// radioTree.setValueAttribute(viewSwitchType.TREE.toString());
// Radio radioShortcut = new Radio();
// radioShortcut.setBoxLabel("Shortcut");
// radioShortcut.setValueAttribute(viewSwitchType.SHORTCUT.toString());
// RadioGroup radioGroup = new RadioGroup();
// radioGroup.setFieldLabel("Afecto");
// radioGroup.add(radioTree);
// radioGroup.add(radioShortcut);
// radioGroup.setStyleAttribute("margin-left", "20px");
HorizontalPanel hpPath = new HorizontalPanel(); HorizontalPanel hpPath = new HorizontalPanel();
hpPath.setLayout(new FitLayout()); hpPath.setLayout(new FitLayout());
hpPath.setBorders(true); hpPath.setBorders(true);
@ -131,49 +118,40 @@ public class GxtBasicTabPanel extends LayoutContainer {
this.setLabelPath(""); this.setLabelPath("");
this.labelPath.setStyleAttribute("margin-left", "20px"); this.labelPath.setStyleAttribute("margin-left", "20px");
hpPath.add(this.labelPath); hpPath.add(this.labelPath);
HorizontalPanel hpScope = new HorizontalPanel(); HorizontalPanel hpScope = new HorizontalPanel();
hpScope.setLayout(new FitLayout()); hpScope.setLayout(new FitLayout());
hpScope.add(txtViewScope); hpScope.add(txtViewScope);
//Select in combo the first element of store //Select in combo the first element of store
this.cbViewScope.addListener(Events.Attach, new Listener<BaseEvent>(){ this.cbViewScope.addListener(Events.Attach, new Listener<BaseEvent>(){
public void handleEvent(BaseEvent be) { public void handleEvent(BaseEvent be) {
cbViewScope.setValue(cbViewScope.getStore().getAt(0)); cbViewScope.setValue(cbViewScope.getStore().getAt(0));
} }
}); });
this.cbViewScope.addSelectionChangedListener(new SelectionChangedListener<ScopeModel>() { this.cbViewScope.addSelectionChangedListener(new SelectionChangedListener<ScopeModel>() {
@Override @Override
public void selectionChanged(SelectionChangedEvent<ScopeModel> se) { public void selectionChanged(SelectionChangedEvent<ScopeModel> se) {
// Window.alert("selected scope" + se.getSelectedItem().get("name"));
//TODO
} }
}); });
this.cbViewScope.setStyleAttribute("margin-left", "20px"); this.cbViewScope.setStyleAttribute("margin-left", "20px");
hpScope.add(this.cbViewScope); hpScope.add(this.cbViewScope);
// HorizontalPanel hpRadio = new HorizontalPanel();
// hpRadio.setLayout(new FitLayout());
// hpRadio.add(txtSwitch);
// hpRadio.add(radioGroup);
cp.add(hpPath,flex); cp.add(hpPath,flex);
cp.add(hpScope,flex); cp.add(hpScope,flex);
// cp.add(hpRadio, flex); // cp.add(hpRadio, flex);
this.tabView.add(cp); this.tabView.add(cp);
tabPanel.add(tabView); tabPanel.add(tabView);
add(tabPanel); add(tabPanel);
} }
private void initTabSearch() { private void initTabSearch() {
ContentPanel cp = new ContentPanel(); ContentPanel cp = new ContentPanel();
@ -181,28 +159,24 @@ public class GxtBasicTabPanel extends LayoutContainer {
cp.setLayout(new RowLayout()); cp.setLayout(new RowLayout());
cp.setBorders(false); cp.setBorders(false);
cp.setBodyBorder(false); cp.setBodyBorder(false);
FormPanel formPanel = new FormPanel(); FormPanel formPanel = new FormPanel();
formPanel.setHeaderVisible(false); formPanel.setHeaderVisible(false);
formPanel.setBodyBorder(false); formPanel.setBodyBorder(false);
// formPanel.setFrame(true); // formPanel.setFrame(true);
formPanel.setWidth(350); formPanel.setWidth(350);
FormData formData = new FormData("-20"); FormData formData = new FormData("-20");
cbNameFilter.setFieldLabel("Name Filter");
// combo.setDisplayField("name");
cbNameFilter.setFieldLabel("Name Filter");
// combo.setDisplayField("name");
formPanel.add(cbNameFilter, formData); formPanel.add(cbNameFilter, formData);
textSearch.setFieldLabel("Item Name"); textSearch.setFieldLabel("Item Name");
textSearch.setAllowBlank(false); textSearch.setAllowBlank(false);
textSearch.setRegex("^[ a-zA-Z0-9_-]*$"); textSearch.setRegex("^[ a-zA-Z0-9_-]*$");
// textSearch.getMessages().setRegexText(FIELDVALIDATEERROR); // textSearch.getMessages().setRegexText(FIELDVALIDATEERROR);
formPanel.add(textSearch, formData); formPanel.add(textSearch, formData);
fromDate.setName("date"); fromDate.setName("date");
fromDate.setFieldLabel("From"); fromDate.setFieldLabel("From");
formPanel.add(fromDate); formPanel.add(fromDate);
@ -210,13 +184,13 @@ public class GxtBasicTabPanel extends LayoutContainer {
toDate.setName("date"); toDate.setName("date");
toDate.setFieldLabel("To"); toDate.setFieldLabel("To");
formPanel.add(toDate); formPanel.add(toDate);
textFull.setFieldLabel("Full Text"); textFull.setFieldLabel("Full Text");
textFull.setAllowBlank(true); textFull.setAllowBlank(true);
formPanel.add(textFull, formData); formPanel.add(textFull, formData);
this.tabSearch.add(formPanel); this.tabSearch.add(formPanel);
bSearch.addSelectionListener(new SelectionListener<ButtonEvent>() { bSearch.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
if (textSearch.getValue() == null || textSearch.getValue() == "" || !textSearch.isValid()) { if (textSearch.getValue() == null || textSearch.getValue() == "" || !textSearch.isValid()) {
@ -231,32 +205,31 @@ public class GxtBasicTabPanel extends LayoutContainer {
} }
} }
}); });
this.bCancel.addSelectionListener(new SelectionListener<ButtonEvent>() { this.bCancel.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
resetFieldsInTabSearch(); resetFieldsInTabSearch();
} }
}); });
formPanel.setButtonAlign(HorizontalAlignment.LEFT); formPanel.setButtonAlign(HorizontalAlignment.LEFT);
formPanel.addButton(this.bSearch); formPanel.addButton(this.bSearch);
formPanel.addButton(this.bCancel); formPanel.addButton(this.bCancel);
FormButtonBinding binding = new FormButtonBinding(formPanel); FormButtonBinding binding = new FormButtonBinding(formPanel);
binding.addButton(this.bSearch); binding.addButton(this.bSearch);
tabPanel.add(tabSearch); tabPanel.add(tabSearch);
add(tabPanel); add(tabPanel);
} }
public void resetFieldsInTabSearch(){ public void resetFieldsInTabSearch(){
this.textSearch.reset(); this.textSearch.reset();
this.textFull.reset(); this.textFull.reset();
@ -265,26 +238,26 @@ public class GxtBasicTabPanel extends LayoutContainer {
this.cbNameFilter.reset(); this.cbNameFilter.reset();
} }
public LayoutContainer getTabs() { public LayoutContainer getTabs() {
return this; return this;
} }
public String getValueComboNameFilter(){ public String getValueComboNameFilter(){
return this.cbViewScope.getRawValue(); return this.cbViewScope.getRawValue();
} }
public void setLabelPath(String path){ public void setLabelPath(String path){
if(path != null && (!path.isEmpty())) if(path != null && !path.isEmpty())
this.labelPath.setText(path); this.labelPath.setText(path);
else else
this.labelPath.setText(EMPTY); this.labelPath.setText(EMPTY);
} }
} }

View File

@ -24,20 +24,21 @@ import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox; import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.extjs.gxt.ui.client.widget.form.TextField; import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.github.gwtbootstrap.client.ui.Button;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
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.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
/** /**
* The Class GxtSeachAndFilterPanel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @author Massimiliano Assante ISTI-CNR * Jun 1, 2016
*
* @version 1.0 May 14th 2012
*/ */
public class GxtSeachAndFilterPanel extends LayoutContainer { public class GxtSeachAndFilterPanel extends LayoutContainer {
@ -45,49 +46,42 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
private ComboBox<ScopeModel> cbViewScope = null; private ComboBox<ScopeModel> cbViewScope = null;
private final TextField<String> textSearch = new TextField<String>(); private final TextField<String> textSearch = new TextField<String>();
private Button bSearch = new Button(ConstantsPortlet.SEARCH); 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 bCancel = new Button(ConstantsPortlet.CANCEL);
private Button bSave = new Button(ConstantsPortlet.SAVE); private Button bSave = new Button(ConstantsPortlet.SAVE);
// private Label labelSearchIn = new Label();
private TextField<String> textFull = new TextField<String>(); private TextField<String> textFull = new TextField<String>();
private DateField fromDate = new DateField(); private DateField fromDate = new DateField();
private DateField toDate = new DateField(); private DateField toDate = new DateField();
private SimpleComboBox<String> cbNameFilter = null; private SimpleComboBox<String> cbNameFilter = null;
// private HorizontalPanel hpToolbarPathPanel = null;
private boolean isSearchActive = false; private boolean isSearchActive = false;
private VerticalPanel verticalPanel = new VerticalPanel(); private VerticalPanel verticalPanel = new VerticalPanel();
private HorizontalPanel hp = new HorizontalPanel(); private HorizontalPanel hp = new HorizontalPanel();
// private HorizontalPanel hp2 = new HorizontalPanel();
private HorizontalPanel hpMain = new HorizontalPanel(); private HorizontalPanel hpMain = new HorizontalPanel();
private GxtBreadcrumbPathPanel toolbarPahtPanel; private GxtBreadcrumbPathPanel toolbarPahtPanel;
/**
* Instantiates a new gxt seach and filter panel.
*
* @param toolBarPathPanel the tool bar path panel
*/
public GxtSeachAndFilterPanel(GxtBreadcrumbPathPanel toolBarPathPanel) { public GxtSeachAndFilterPanel(GxtBreadcrumbPathPanel toolBarPathPanel) {
setLayout(new FitLayout()); setLayout(new FitLayout());
setBorders(true); setBorders(true);
this.setId("SearchAndFilter"); this.setId("SearchAndFilter");
this.setBorders(false); this.setBorders(false);
// this.setStyleAttribute("background-color", "#d0def0");
this.comboBoxGxt = new GxtComboBox(); this.comboBoxGxt = new GxtComboBox();
this.cbViewScope = this.comboBoxGxt.getComboViewScope(); this.cbViewScope = this.comboBoxGxt.getComboViewScope();
this.cbNameFilter = this.comboBoxGxt.getComboStringFilter(); this.cbNameFilter = this.comboBoxGxt.getComboStringFilter();
this.textSearch.setId("text-search"); this.textSearch.setId("text-search");
// this.textSearch.setStyleAttribute("margin-bottom", "0px");
this.cbViewScope.setWidth(360); this.cbViewScope.setWidth(360);
// this.cbViewScope.setAutoWidth(true);
this.toolbarPahtPanel = toolBarPathPanel; this.toolbarPahtPanel = toolBarPathPanel;
hp.setStyleAttribute("margin-left", "2px"); hp.setStyleAttribute("margin-left", "2px");
seVisibleButtonsCancelSave(false); seVisibleButtonsCancelSave(false);
textSearch.setAllowBlank(true); textSearch.setAllowBlank(true);
textSearch.setEmptyText(ConstantsPortlet.SEARCHBYNAME); textSearch.setEmptyText(ConstantsPortlet.SEARCHBYNAME);
// textSearch.setWidth(325);
// textSearch.setHeight(12);
/* COMMENTED TO FIX https://support.social.isti.cnr.it/ticket/87 /* COMMENTED TO FIX https://support.social.isti.cnr.it/ticket/87
textSearch.setRegex("^[a-zA-Z0-9]+[ a-zA-Z0-9_().-]*"); //alphanumeric textSearch.setRegex("^[a-zA-Z0-9]+[ a-zA-Z0-9_().-]*"); //alphanumeric
@ -95,75 +89,52 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
textSearch.setAutoValidate(true); textSearch.setAutoValidate(true);
*/ */
hp.add(textSearch); hp.add(textSearch);
bSearch.setStyleName("wizardButton"); // bSearch.setStyleName("wizardButton");
// bSearch.getElement().getStyle().setMarginLeft(3, Unit.PX); // bSearch.getElement().getStyle().setMarginLeft(3, Unit.PX);
bCancel.setStyleName("wizardButton"); // bCancel.setStyleName("wizardButton");
bCancel.getElement().getStyle().setMarginLeft(3, Unit.PX); bCancel.getElement().getStyle().setMarginLeft(3, Unit.PX);
bSave.setStyleName("wizardButton"); // bSave.setStyleName("wizardButton");
bSave.getElement().getStyle().setMarginLeft(3, Unit.PX); bSave.getElement().getStyle().setMarginLeft(3, Unit.PX);
hp.add(bSearch); hp.add(bSearch);
hp.add(bSave); hp.add(bSave);
hp.setVerticalAlign(VerticalAlignment.MIDDLE); hp.setVerticalAlign(VerticalAlignment.MIDDLE);
bSearch.addStyleName("button_toolbar");
// hp.setHeight(20); bSave.addStyleName("button_toolbar");
// hpMain.setHeight(20);
bSearch.setWidth("70px");
bSave.setWidth("70px");
cbViewScope.setStyleAttribute("margin-left", "132px"); cbViewScope.setStyleAttribute("margin-left", "132px");
cbViewScope.setStyleAttribute("margin-top", "2px"); cbViewScope.setStyleAttribute("margin-top", "2px");
hpMain.setId("hpMain"); hpMain.setId("hpSearchAndFilter");
hpMain.setStyleAttribute("background", "#D0DEF0"); // hpMain.setStyleAttribute("background", "#D0DEF0");
verticalPanel.setId("VerticalPanelSearchAndFilter"); verticalPanel.setId("VerticalPanelSearchAndFilter");
verticalPanel.setStyleAttribute("background", "#D0DEF0"); verticalPanel.setStyleAttribute("background", "#D0DEF0");
hpMain.add(hp); hpMain.add(hp);
hpMain.setVerticalAlign(VerticalAlignment.MIDDLE); hpMain.setVerticalAlign(VerticalAlignment.MIDDLE);
//SOLUTION FOR SCOPE INVISIBLE //SOLUTION FOR SCOPE INVISIBLE
cbViewScope.setVisible(false); cbViewScope.setVisible(false);
verticalPanel.add(this.toolbarPahtPanel.getToolBarPathPanel()); verticalPanel.add(this.toolbarPahtPanel.getToolBarPathPanel());
verticalPanel.add(hpMain); verticalPanel.add(hpMain);
verticalPanel.setVerticalAlign(VerticalAlignment.MIDDLE); verticalPanel.setVerticalAlign(VerticalAlignment.MIDDLE);
this.addListeners(); this.addListeners();
add(verticalPanel); add(verticalPanel);
updateSize(); updateSize();
Window.addResizeHandler(new ResizeHandler() { Window.addResizeHandler(new ResizeHandler() {
@Override @Override
public void onResize(ResizeEvent event) { public void onResize(ResizeEvent event) {
updateSize(); updateSize();
} }
}); });
layout(); 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 * Update window size.
*/ */
public void updateSize() { public void updateSize() {
RootPanel workspace = RootPanel.get(ConstantsPortlet.WORKSPACEDIV); RootPanel workspace = RootPanel.get(ConstantsPortlet.WORKSPACEDIV);
@ -172,11 +143,16 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
//SOLUTION FOR SCOPE INVISIBLE //SOLUTION FOR SCOPE INVISIBLE
hp.setWidth(rootWidth); hp.setWidth(rootWidth);
// ORIGINAL CODE // ORIGINAL CODE
// hp.setWidth(rootWidth - 500); // hp.setWidth(rootWidth - 500);
} }
/**
* Search text.
*
* @param value the value
*/
public void searchText(String value){ public void searchText(String value){
textSearch.setValue(value); textSearch.setValue(value);
seVisibleButtonsCancelSave(true); seVisibleButtonsCancelSave(true);
@ -184,14 +160,17 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
AppController.getEventBus().fireEvent(new SearchTextEvent(value, parentId)); AppController.getEventBus().fireEvent(new SearchTextEvent(value, parentId));
} }
/**
* Adds the listeners.
*/
private void addListeners(){ private void addListeners(){
bSearch.addClickHandler(new ClickHandler() { bSearch.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
if(isValidSearch()){ if(isValidSearch()){
// seVisibleButtonsCancelSave(true); // seVisibleButtonsCancelSave(true);
// AppController.getEventBus().fireEvent(new SearchTextEvent(textSearch.getValue())); // AppController.getEventBus().fireEvent(new SearchTextEvent(textSearch.getValue()));
searchText(textSearch.getValue()); searchText(textSearch.getValue());
}else if(textSearch.getValue()==null || textSearch.getValue().isEmpty()){ }else if(textSearch.getValue()==null || textSearch.getValue().isEmpty()){
searchCancel(); searchCancel();
@ -202,7 +181,7 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
KeyListener keyListener = new KeyListener() { KeyListener keyListener = new KeyListener() {
public void componentKeyUp(ComponentEvent event) { public void componentKeyUp(ComponentEvent event) {
if (event.getKeyCode() == 13) { // KEY_ENTER if (event.getKeyCode() == 13) { // KEY_ENTER
if(isValidSearch()){ if(isValidSearch()){
searchText(textSearch.getValue()); searchText(textSearch.getValue());
}else if(textSearch.getValue()==null || textSearch.getValue().isEmpty()){ }else if(textSearch.getValue()==null || textSearch.getValue().isEmpty()){
searchCancel(); searchCancel();
@ -213,17 +192,8 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
textSearch.addKeyListener(keyListener); textSearch.addKeyListener(keyListener);
// //
// bCancel.addClickHandler(new ClickHandler() {
// @Override bSave.addClickHandler(new ClickHandler() {
// public void onClick(ClickEvent event) {
// if(textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid()){
// searchCancel();
// AppController.getEventBus().fireEvent(new SearchTextEvent(null));
// }
// }
// });
bSave.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
if(textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid()){ if(textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid()){
@ -234,7 +204,7 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
} }
} }
}); });
this.cbViewScope.addSelectionChangedListener(new SelectionChangedListener<ScopeModel>() { this.cbViewScope.addSelectionChangedListener(new SelectionChangedListener<ScopeModel>() {
@Override @Override
@ -249,6 +219,9 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
} }
/**
* Reset fields.
*/
public void resetFields(){ public void resetFields(){
this.textSearch.reset(); this.textSearch.reset();
this.textFull.reset(); this.textFull.reset();
@ -257,49 +230,96 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
this.cbNameFilter.reset(); this.cbNameFilter.reset();
} }
/**
* Checks if is valid search.
*
* @return true, if is valid search
*/
private boolean isValidSearch(){ private boolean isValidSearch(){
return textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid(); return textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid();
} }
/**
* Se visible buttons cancel save.
*
* @param flag the flag
*/
public void seVisibleButtonsCancelSave(boolean flag){ public void seVisibleButtonsCancelSave(boolean flag){
this.bCancel.setVisible(flag); this.bCancel.setVisible(flag);
this.bSave.setVisible(flag); this.bSave.setVisible(flag);
} }
/**
* Search cancel.
*/
public void searchCancel(){ public void searchCancel(){
resetFields(); resetFields();
// initSearchIn();
seVisibleButtonsCancelSave(false); seVisibleButtonsCancelSave(false);
} }
/**
* Checks if is search active.
*
* @return true, if is search active
*/
public boolean isSearchActive(){ public boolean isSearchActive(){
return this.isSearchActive; return this.isSearchActive;
} }
/**
* Sets the list scope.
*
* @param listScope the new list scope
*/
public void setListScope(List<ScopeModel> listScope){ public void setListScope(List<ScopeModel> listScope){
this.comboBoxGxt.setListScope(listScope); this.comboBoxGxt.setListScope(listScope);
} }
/**
* Select scope by index.
*
* @param index the index
*/
public void selectScopeByIndex(int index){ public void selectScopeByIndex(int index){
this.cbViewScope.setValue(cbViewScope.getStore().getAt(index)); this.cbViewScope.setValue(cbViewScope.getStore().getAt(index));
} }
/**
* Sets the search active.
*
* @param isSearchActive the new search active
*/
public void setSearchActive(boolean isSearchActive) { public void setSearchActive(boolean isSearchActive) {
this.isSearchActive = isSearchActive; this.isSearchActive = isSearchActive;
} }
/**
* Sets the visible button save.
*
* @param bool the new visible button save
*/
public void setVisibleButtonSave(boolean bool){ public void setVisibleButtonSave(boolean bool){
this.bSave.setVisible(bool); this.bSave.setVisible(bool);
} }
/**
* Sets the empty text.
*
* @param emptyText the new empty text
*/
public void setEmptyText(String emptyText){ public void setEmptyText(String emptyText){
textSearch.setEmptyText(emptyText); textSearch.setEmptyText(emptyText);
} }
/**
* Gets the toolbar path panel.
*
* @return the toolbar path panel
*/
public GxtBreadcrumbPathPanel getToolbarPathPanel() { public GxtBreadcrumbPathPanel getToolbarPathPanel() {
return toolbarPahtPanel; return toolbarPahtPanel;
} }

View File

@ -420,13 +420,27 @@
vertical-align: middle; vertical-align: middle;
} }
#hpSearchAndFilter {
background-color: #D0DEF0;
}
#hpSearchAndFilter td {
vertical-align: top;
!
important;
}
#text-search { #text-search {
margin-right: 3px; margin-right: 3px;
width: 325px !important; width: 325px !important;
} }
#text-search>input:first-child { #text-search-input {
height: 18px !important; height: 20px !important;
width: 319px !important; width: 312px !important;
padding: 1px 2px; /* padding: 1px 2px; */
}
.button_toolbar {
width: 60px;
} }