101 lines
1.8 KiB
Java
101 lines
1.8 KiB
Java
/**
|
|
*
|
|
*/
|
|
package org.gcube.portlets.user.performfishanalytics.client.view;
|
|
|
|
import com.github.gwtbootstrap.client.ui.Alert;
|
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
|
import com.google.gwt.user.client.ui.FlowPanel;
|
|
import com.google.gwt.user.client.ui.HTML;
|
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
|
|
/**
|
|
* The Class BodyPage.
|
|
*
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
* Feb 19, 2015
|
|
*/
|
|
public class BodyPanel extends VerticalPanel{
|
|
|
|
private LoaderIcon loader = new LoaderIcon();
|
|
private FlowPanel panelError = new FlowPanel();
|
|
|
|
/**
|
|
* Instantiates a new body page.
|
|
*/
|
|
public BodyPanel() {
|
|
this.init();
|
|
add(panelError);
|
|
}
|
|
|
|
/**
|
|
* Inits the.
|
|
*/
|
|
private void init(){
|
|
add(loader);
|
|
loader.setVisible(false);
|
|
}
|
|
|
|
/**
|
|
* Sets the loading.
|
|
*
|
|
* @param bool the bool
|
|
* @param text the text
|
|
*/
|
|
public void setLoading(boolean bool, String text){
|
|
loader.setVisible(bool);
|
|
loader.setText(text);
|
|
}
|
|
|
|
/**
|
|
* Reset.
|
|
*/
|
|
public void reset() {
|
|
this.clear();
|
|
this.init();
|
|
}
|
|
|
|
/**
|
|
* Show error.
|
|
*
|
|
* @param txt the txt
|
|
*/
|
|
public void showError(String txt) {
|
|
panelError.clear();
|
|
panelError.setVisible(true);
|
|
Alert msg = new Alert(txt);
|
|
msg.setAnimation(true);
|
|
msg.setClose(false);
|
|
msg.setType(AlertType.ERROR);
|
|
panelError.add(msg);
|
|
}
|
|
|
|
/**
|
|
* Hide error.
|
|
*/
|
|
public void hideError(){
|
|
panelError.setVisible(false);
|
|
}
|
|
|
|
/**
|
|
* Show message.
|
|
*
|
|
* @param txt the txt
|
|
*/
|
|
public void showMessage(String txt) {
|
|
FlowPanel panel = new FlowPanel();
|
|
String html = "<div style=\"color:blue\">";
|
|
if(txt!=null && txt.length()>0)
|
|
html+=txt;
|
|
// panel.add(new HTML(label));
|
|
else
|
|
html+="No data";
|
|
// panel.add(new HTML("No data"));
|
|
html+="</div>";
|
|
|
|
panel.add(new HTML(html));
|
|
add(panel);
|
|
|
|
}
|
|
}
|