2021-06-21 15:35:47 +02:00
|
|
|
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
|
|
|
|
|
|
|
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
2021-06-22 18:09:16 +02:00
|
|
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.CloseAllTabsEvent;
|
2021-06-21 15:35:47 +02:00
|
|
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.Dropdown;
|
|
|
|
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.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 ContentModeratorToolbar extends Composite {
|
|
|
|
|
|
|
|
private static ContentModeratorToolbarUiBinder uiBinder = GWT.create(ContentModeratorToolbarUiBinder.class);
|
|
|
|
|
|
|
|
interface ContentModeratorToolbarUiBinder extends UiBinder<Widget, ContentModeratorToolbar> {
|
|
|
|
}
|
|
|
|
|
|
|
|
@UiField
|
|
|
|
Dropdown dropdownSelectStatus;
|
|
|
|
|
2021-06-22 18:09:16 +02:00
|
|
|
@UiField
|
|
|
|
NavLink closeAllTabs;
|
|
|
|
|
2021-06-21 15:35:47 +02:00
|
|
|
private HandlerManager eventBus;
|
|
|
|
|
|
|
|
public ContentModeratorToolbar(HandlerManager eventBus) {
|
|
|
|
initWidget(uiBinder.createAndBindUi(this));
|
|
|
|
this.eventBus = eventBus;
|
|
|
|
fillItemStatusOptions();
|
2021-06-22 18:09:16 +02:00
|
|
|
bindEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void bindEvents() {
|
|
|
|
closeAllTabs.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
eventBus.fireEvent(new CloseAllTabsEvent());
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-06-21 15:35:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void fillItemStatusOptions() {
|
|
|
|
for (ItemStatus status : ItemStatus.values()) {
|
|
|
|
|
|
|
|
NavLink link = new NavLink();
|
|
|
|
link.setText(status.getLabel());
|
|
|
|
link.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dropdownSelectStatus.add(link);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|