task_21363 #1
|
@ -18,4 +18,6 @@
|
||||||
<source path='client' />
|
<source path='client' />
|
||||||
<source path='shared' />
|
<source path='shared' />
|
||||||
|
|
||||||
|
<stylesheet src='content-moderator-widget.css' />
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.view.client.ListDataProvider;
|
import com.google.gwt.view.client.ListDataProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,17 +56,20 @@ public class CkanContentModeratorWidget {
|
||||||
if (!isContentModeratorEnabled)
|
if (!isContentModeratorEnabled)
|
||||||
throw new Exception("Content Moderator is not enabled in this context");
|
throw new Exception("Content Moderator is not enabled in this context");
|
||||||
|
|
||||||
|
cmsPanel.showLoading(true);
|
||||||
contentModeratorService.getListItemsForStatus(status, ContentModeratorWidgetConstants.ITEMS_PER_PAGE,
|
contentModeratorService.getListItemsForStatus(status, ContentModeratorWidgetConstants.ITEMS_PER_PAGE,
|
||||||
ContentModeratorWidgetConstants.ITEM_START_INDEX, new AsyncCallback<List<CatalogueDataset>>() {
|
ContentModeratorWidgetConstants.ITEM_START_INDEX, new AsyncCallback<List<CatalogueDataset>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<CatalogueDataset> result) {
|
public void onSuccess(List<CatalogueDataset> result) {
|
||||||
|
cmsPanel.showLoading(false);
|
||||||
itemsTable.updateItems(result, true);
|
itemsTable.updateItems(result, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
cmsPanel.showLoading(false);
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -99,7 +102,7 @@ public class CkanContentModeratorWidget {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScrollPanel getPanel(){
|
public Composite getPanel(){
|
||||||
return cmsPanel;
|
return cmsPanel.getPanel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@ public class ContentModeratorWidgetConstants {
|
||||||
|
|
||||||
public static final String NO_DATA = "No data";
|
public static final String NO_DATA = "No data";
|
||||||
|
|
||||||
public static int ITEMS_PER_PAGE = 10;
|
public static int ITEMS_PER_PAGE = 20;
|
||||||
public static int ITEM_START_INDEX = 0;
|
public static int ITEM_START_INDEX = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.FluidRow;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class BaseViewTemplate.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 19, 2015
|
||||||
|
*/
|
||||||
|
public class BaseViewTemplate extends Composite{
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
FluidRow top_container;
|
||||||
|
@UiField
|
||||||
|
FluidRow base_container;
|
||||||
|
@UiField
|
||||||
|
FluidRow bottom_container;
|
||||||
|
|
||||||
|
|
||||||
|
private static BaseViewTemplateUiBinder uiBinder = GWT.create(BaseViewTemplateUiBinder.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface BaseViewTemplateUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 19, 2015
|
||||||
|
*/
|
||||||
|
interface BaseViewTemplateUiBinder extends UiBinder<Widget, BaseViewTemplate> {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new base view template.
|
||||||
|
*/
|
||||||
|
public BaseViewTemplate() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the to top.
|
||||||
|
*
|
||||||
|
* @param widget the widget
|
||||||
|
*/
|
||||||
|
public void addToTop(Widget widget){
|
||||||
|
top_container.add(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the to middle.
|
||||||
|
*
|
||||||
|
* @param widget the widget
|
||||||
|
*/
|
||||||
|
public void addToMiddle(Widget widget){
|
||||||
|
base_container.add(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the to bottom.
|
||||||
|
*
|
||||||
|
* @param widget the widget
|
||||||
|
*/
|
||||||
|
public void addToBottom(Widget widget){
|
||||||
|
bottom_container.add(widget);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
|
||||||
|
<g:FlowPanel>
|
||||||
|
<b:FluidRow ui:field="top_container">
|
||||||
|
</b:FluidRow>
|
||||||
|
<b:FluidRow ui:field="base_container">
|
||||||
|
</b:FluidRow>
|
||||||
|
<b:FluidRow ui:field="bottom_container">
|
||||||
|
</b:FluidRow>
|
||||||
|
</g:FlowPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.ui.Button;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HasText;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class ConentModeratorSystemBasePanel extends Composite implements HasText {
|
||||||
|
|
||||||
|
private static ConentModeratorSystemBasePanelUiBinder uiBinder = GWT
|
||||||
|
.create(ConentModeratorSystemBasePanelUiBinder.class);
|
||||||
|
|
||||||
|
interface ConentModeratorSystemBasePanelUiBinder extends UiBinder<Widget, ConentModeratorSystemBasePanel> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConentModeratorSystemBasePanel() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button button;
|
||||||
|
|
||||||
|
public ConentModeratorSystemBasePanel(String firstName) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
button.setText(firstName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiHandler("button")
|
||||||
|
void onClick(ClickEvent e) {
|
||||||
|
Window.alert("Hello!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
button.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return button.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.important {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<g:DockPanel>
|
||||||
|
|
||||||
|
</g:DockPanel>
|
||||||
|
<g:ScrollPanel ui:field="theCenterPanel">
|
||||||
|
|
||||||
|
</g:ScrollPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -1,6 +1,14 @@
|
||||||
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.ContentModeratorWidgetResources;
|
||||||
|
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,11 +18,41 @@ import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
*
|
*
|
||||||
* Jun 15, 2021
|
* Jun 15, 2021
|
||||||
*/
|
*/
|
||||||
public class ContentModeratorSystemPanel extends ScrollPanel {
|
public class ContentModeratorSystemPanel {
|
||||||
|
|
||||||
|
|
||||||
|
private BaseViewTemplate baseViewTemplate = new BaseViewTemplate();
|
||||||
|
private ScrollPanel centerPanel = new ScrollPanel();
|
||||||
|
|
||||||
|
protected static final HorizontalPanel LOADING_PANEL = new HorizontalPanel();
|
||||||
|
protected static final Image LOADING_IMAGE = ContentModeratorWidgetResources.getIconLoading().createImage();
|
||||||
|
|
||||||
|
static {
|
||||||
|
LOADING_PANEL.getElement().getStyle().setMargin(5.0, Unit.PX);
|
||||||
|
// LOADING_PANEL.setSpacing(3);
|
||||||
|
LOADING_PANEL.add(LOADING_IMAGE);
|
||||||
|
HTML loading = new HTML("Loading...");
|
||||||
|
loading.getElement().getStyle().setPaddingLeft(5.0, Unit.PX);
|
||||||
|
LOADING_PANEL.add(loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ContentModeratorSystemPanel(){
|
public ContentModeratorSystemPanel(){
|
||||||
|
baseViewTemplate.addToTop(LOADING_PANEL);
|
||||||
|
baseViewTemplate.addToMiddle(centerPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showLoading(boolean show) {
|
||||||
|
LOADING_PANEL.setVisible(show);
|
||||||
|
centerPanel.setVisible(!show);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(Widget w){
|
||||||
|
centerPanel.add(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Composite getPanel(){
|
||||||
|
return baseViewTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,6 @@
|
||||||
<source path='client' />
|
<source path='client' />
|
||||||
<source path='shared' />
|
<source path='shared' />
|
||||||
|
|
||||||
|
<stylesheet src='content-moderator-widget.css' />
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
|
|
Loading…
Reference in New Issue