75 lines
2.0 KiB
Java
75 lines
2.0 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 com.github.gwtbootstrap.client.ui.NavLink;
|
|
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.EventBus;
|
|
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.Widget;
|
|
|
|
public class GeonaNavigationBar extends Composite {
|
|
|
|
private static GeonaNavigationBarUiBinder uiBinder = GWT.create(GeonaNavigationBarUiBinder.class);
|
|
|
|
interface GeonaNavigationBarUiBinder extends UiBinder<Widget, GeonaNavigationBar> {
|
|
}
|
|
|
|
private EventBus eventBus;
|
|
|
|
public GeonaNavigationBar() {
|
|
initWidget(uiBinder.createAndBindUi(this));
|
|
bindEvents();
|
|
}
|
|
|
|
private void bindEvents() {
|
|
linkCreateNewProject.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
appManagerBus.fireEvent(new CreateNewProjectEvent());
|
|
|
|
}
|
|
});
|
|
|
|
linkGetListOfRecords.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE));
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
@UiField
|
|
NavLink linkCreateNewProject;
|
|
|
|
@UiField
|
|
NavLink linkGetListOfRecords;
|
|
|
|
private HandlerManager appManagerBus;
|
|
|
|
public GeonaNavigationBar(String firstName) {
|
|
initWidget(uiBinder.createAndBindUi(this));
|
|
}
|
|
|
|
/**
|
|
* Sets the app manager bus.
|
|
*
|
|
* @param appManagerBus the new app manager bus
|
|
*/
|
|
public void setAppManagerBus(HandlerManager appManagerBus) {
|
|
this.appManagerBus = appManagerBus;
|
|
}
|
|
|
|
}
|