metadata-profile-form-build.../src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java

68 lines
1.4 KiB
Java
Raw Normal View History

2020-10-02 16:16:31 +02:00
/**
*
*/
package org.gcube.portlets.widgets.mpformbuilder.client.ui.utils;
2024-02-16 10:15:52 +01:00
import com.github.gwtbootstrap.client.ui.Icon;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.dom.client.Style.Unit;
2020-10-02 16:16:31 +02:00
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
/**
* The Class LoaderIcon.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 19, 2015
*/
public class LoaderIcon extends HorizontalPanel{
2024-02-16 10:15:52 +01:00
//private Image imgLoading = new Image(Images.ICONS.loading());
2020-10-02 16:16:31 +02:00
private HTML txtLoading = new HTML("");
2024-02-16 10:15:52 +01:00
private Icon iconSpinner = new Icon(IconType.SPINNER);
2020-10-02 16:16:31 +02:00
/**
* Instantiates a new loader icon.
*
* @param txtHTML the txt html
*/
public LoaderIcon(String txtHTML) {
this();
setText(txtHTML);
}
/**
* Instantiates a new loader icon.
*/
public LoaderIcon() {
setStyleName("marginTop20");
add(txtLoading);
2024-02-16 10:15:52 +01:00
iconSpinner.setSpin(true);
2024-02-20 15:18:24 +01:00
iconSpinner.getElement().getStyle().setProperty("animation", "spin 1s infinite linear");
2024-02-16 10:15:52 +01:00
iconSpinner.getElement().getStyle().setMarginLeft(5, Unit.PX);
add(iconSpinner);
2020-10-02 16:16:31 +02:00
}
/**
* Sets the text.
*
* @param txtHTML the new text
*/
public void setText(String txtHTML){
txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>");
}
/**
* Show.
*
* @param bool the bool
*/
public void show(boolean bool){
this.setVisible(bool);
}
}