You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.2 KiB
Java
86 lines
2.2 KiB
Java
/**
|
|
*
|
|
*/
|
|
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
|
|
|
|
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
|
|
|
|
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
|
import com.github.gwtbootstrap.client.ui.Button;
|
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
|
import com.google.gwt.dom.client.Style.Unit;
|
|
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.user.client.ui.FlowPanel;
|
|
|
|
|
|
/**
|
|
* The Class CkanMetadataManagementPanel.
|
|
*
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
* Jun 9, 2016
|
|
*/
|
|
public class CkanMetadataManagementPanel extends FlowPanel{
|
|
|
|
private AlertBlock nav = new AlertBlock();
|
|
private Button insertMeta = new Button("Insert Metadata");
|
|
private Button editMeta = new Button("Edit Metadata");
|
|
private HandlerManager eventBus;
|
|
|
|
/**
|
|
* Instantiates a new ckan metadata management panel.
|
|
* @param eventBus
|
|
*/
|
|
public CkanMetadataManagementPanel(HandlerManager eventBus){
|
|
this.eventBus = eventBus;
|
|
// this.getElement().getStyle().setPaddingTop(H_OFFSET, Unit.PX);
|
|
// this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX);
|
|
insertMeta.setType(ButtonType.LINK);
|
|
editMeta.setType(ButtonType.LINK);
|
|
nav.add(insertMeta);
|
|
nav.add(editMeta);
|
|
nav.setClose(false);
|
|
nav.setType(AlertType.INFO);
|
|
nav.getElement().getStyle().setMarginBottom(0, Unit.PX);
|
|
nav.getElement().getStyle().setBackgroundColor("#FFF");
|
|
addHandlers();
|
|
add(nav);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private void addHandlers() {
|
|
|
|
insertMeta.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
|
|
eventBus.fireEvent(new InsertMetadataEvent());
|
|
}
|
|
});
|
|
|
|
editMeta.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
|
|
eventBus.fireEvent(new InsertMetadataEvent());
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
* Gets the current height.
|
|
*
|
|
* @return the current height
|
|
*/
|
|
public int getCurrentHeight(){
|
|
return this.getOffsetHeight();
|
|
}
|
|
}
|