143 lines
3.7 KiB
Java
143 lines
3.7 KiB
Java
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
|
|
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
|
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable.DISPLAY_FIELD;
|
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
|
|
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
|
import com.github.gwtbootstrap.client.ui.Tab;
|
|
import com.google.gwt.core.client.GWT;
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
import com.google.gwt.event.shared.HandlerManager;
|
|
import com.google.gwt.uibinder.client.UiBinder;
|
|
import com.google.gwt.uibinder.client.UiField;
|
|
import com.google.gwt.user.client.ui.Composite;
|
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
|
|
/**
|
|
* The Class GeonaMainTabPanel.
|
|
*
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
*
|
|
* Aug 5, 2021
|
|
*/
|
|
public class GeonaMainTabPanel extends Composite {
|
|
|
|
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
|
|
|
|
/**
|
|
* The Interface GeonaMainTabPanelUiBinder.
|
|
*
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
*
|
|
* Aug 5, 2021
|
|
*/
|
|
interface GeonaMainTabPanelUiBinder extends UiBinder<Widget, GeonaMainTabPanel> {
|
|
}
|
|
|
|
/** The geona main form panel. */
|
|
@UiField
|
|
HTMLPanel geonaMainFormPanel;
|
|
|
|
@UiField
|
|
HTMLPanel geonaListOfConcessioniPanel;
|
|
|
|
/** The loader. */
|
|
@UiField
|
|
LoaderIcon loader;
|
|
|
|
@UiField
|
|
NavLink buttCreateNewProject;
|
|
|
|
@UiField
|
|
NavLink buttonReloadConcessioni;
|
|
|
|
@UiField
|
|
Tab tabNewProject;
|
|
|
|
@UiField
|
|
Tab tabGetListOfProjects;
|
|
|
|
private HandlerManager appManagerBus;
|
|
|
|
/**
|
|
* Instantiates a new geona main tab panel.
|
|
*
|
|
* @param appManagerBus the first name
|
|
*/
|
|
public GeonaMainTabPanel(HandlerManager appManagerBus) {
|
|
initWidget(uiBinder.createAndBindUi(this));
|
|
this.appManagerBus = appManagerBus;
|
|
bindEvents();
|
|
|
|
}
|
|
|
|
private void bindEvents() {
|
|
|
|
buttCreateNewProject.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
appManagerBus.fireEvent(new CreateNewProjectEvent());
|
|
|
|
}
|
|
});
|
|
|
|
buttonReloadConcessioni.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE));
|
|
|
|
}
|
|
});
|
|
|
|
tabGetListOfProjects.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE,
|
|
null, DISPLAY_FIELD.NAME);
|
|
showListOfConcessioniView(grpw);
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
* Adds the form panel.
|
|
*
|
|
* @param formPanel the form panel
|
|
*/
|
|
public void addFormPanel(GeonaDataEntryMainForm formPanel) {
|
|
geonaMainFormPanel.add(formPanel);
|
|
}
|
|
|
|
public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) {
|
|
geonaListOfConcessioniPanel.clear();
|
|
VerticalPanel htmllPanel = new VerticalPanel();
|
|
htmllPanel.add(grpw.getCellPanel());
|
|
htmllPanel.add(grpw.getPagerPanel());
|
|
geonaListOfConcessioniPanel.add(htmllPanel);
|
|
}
|
|
|
|
/**
|
|
* Sets the loader visible.
|
|
*
|
|
* @param txtHTML the txt HTML
|
|
* @param visible the visible
|
|
*/
|
|
public void setLoaderVisible(String txtHTML, boolean visible) {
|
|
loader.setText(txtHTML);
|
|
loader.setVisible(visible);
|
|
}
|
|
|
|
}
|