Enhancements on the GUI-side
This commit is contained in:
parent
20eee57584
commit
68970848a5
|
@ -6,7 +6,13 @@ import java.util.List;
|
|||
import com.github.gwtbootstrap.client.ui.Pager;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||
import com.github.gwtbootstrap.client.ui.TabPanel.ShownEvent.Handler;
|
||||
import com.github.gwtbootstrap.client.ui.event.ShowEvent;
|
||||
import com.github.gwtbootstrap.client.ui.event.ShowHandler;
|
||||
import com.github.gwtbootstrap.client.ui.event.ShownEvent;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
|
@ -14,14 +20,14 @@ import com.google.gwt.uibinder.client.UiField;
|
|||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public abstract class BasicTabPanel extends Composite {
|
||||
public class BasicTabPanel extends Composite {
|
||||
|
||||
private static BasicTabPanelUiBinder uiBinder = GWT.create(BasicTabPanelUiBinder.class);
|
||||
|
||||
interface BasicTabPanelUiBinder extends UiBinder<Widget, BasicTabPanel> {
|
||||
}
|
||||
|
||||
public abstract void checkTabVisited();
|
||||
//public abstract void checkTabVisited();
|
||||
|
||||
@UiField
|
||||
Tab acc_basic_info;
|
||||
|
@ -46,24 +52,6 @@ public abstract class BasicTabPanel extends Composite {
|
|||
listActivatedTab.add(acc_basic_info.isActive());
|
||||
listActivatedTab.add(acc_files.isActive());
|
||||
|
||||
acc_basic_info.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
listActivatedTab.set(0, true);
|
||||
checkTabVisited();
|
||||
}
|
||||
});
|
||||
|
||||
acc_files.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
listActivatedTab.set(1, true);
|
||||
checkTabVisited();
|
||||
}
|
||||
});
|
||||
|
||||
pager.getRight().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -81,8 +69,37 @@ public abstract class BasicTabPanel extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
managePager(null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
class ShownEventHandler implements com.github.gwtbootstrap.client.ui.TabPanel.ShownEvent.Handler{
|
||||
|
||||
@Override
|
||||
public void onShow(com.github.gwtbootstrap.client.ui.TabPanel.ShownEvent shownEvent) {
|
||||
GWT.log("tab shownEvent fired");
|
||||
managePager(null);
|
||||
}
|
||||
}
|
||||
|
||||
ShownEventHandler handler = new ShownEventHandler();
|
||||
|
||||
// com.github.gwtbootstrap.client.ui.TabPanel.ShowEvent.Handler myHadler = new com.github.gwtbootstrap.client.ui.TabPanel.ShowEvent.Handler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onShow(com.github.gwtbootstrap.client.ui.TabPanel.ShowEvent showEvent) {
|
||||
//
|
||||
// GWT.log("showEvent fired");
|
||||
// }
|
||||
// };
|
||||
|
||||
tabPanel.addShownHandler(handler);
|
||||
}
|
||||
|
||||
public Tab getAcc_basic_info() {
|
||||
return acc_basic_info;
|
||||
|
@ -92,42 +109,37 @@ public abstract class BasicTabPanel extends Composite {
|
|||
return acc_files;
|
||||
}
|
||||
|
||||
// public Tab getAcc_license() {
|
||||
// return acc_license;
|
||||
// }
|
||||
|
||||
public boolean allTabVisited() {
|
||||
for (Boolean value : listActivatedTab) {
|
||||
if (!value)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public TabPanel getTabPanel() {
|
||||
return tabPanel;
|
||||
}
|
||||
|
||||
private void managePager(PAGER direction){
|
||||
public void managePager(PAGER direction){
|
||||
int selectTab = tabPanel.getSelectedTab();
|
||||
pager.getLeft().setVisible(true);
|
||||
pager.getRight().setVisible(true);
|
||||
GWT.log("selectTab tab: "+selectTab);
|
||||
GWT.log("tabPanel.getWidgetCount(): "+tabPanel.getWidgetCount());
|
||||
|
||||
if(selectTab==0) {
|
||||
pager.getLeft().setVisible(false);
|
||||
}
|
||||
|
||||
if(selectTab==tabPanel.getWidgetCount()) {
|
||||
pager.getRight().setVisible(false);
|
||||
}
|
||||
checkPagerVisibility(selectTab);
|
||||
|
||||
if(direction!=null) {
|
||||
int newSelectTabIndex = direction.equals(PAGER.BACK)?selectTab-1:selectTab+1;
|
||||
GWT.log("selecting index: "+newSelectTabIndex);
|
||||
|
||||
GWT.log("newSelectTabIndex: "+newSelectTabIndex);
|
||||
tabPanel.selectTab(newSelectTabIndex);
|
||||
checkPagerVisibility(newSelectTabIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPagerVisibility(int index) {
|
||||
pager.getLeft().setVisible(true);
|
||||
pager.getRight().setVisible(true);
|
||||
|
||||
//first tab
|
||||
if(index<=0) {
|
||||
pager.getLeft().setVisible(false);
|
||||
}
|
||||
//last tab
|
||||
if(index>=tabPanel.getWidgetCount()-1) {
|
||||
pager.getRight().setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
.padding-left-10 {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.to-publish-hr {
|
||||
margin-top: 1px;
|
||||
}
|
||||
.to-padding{
|
||||
padding: 3px;
|
||||
}
|
||||
</ui:style>
|
||||
|
||||
<b:ControlGroup>
|
||||
|
@ -16,8 +23,9 @@
|
|||
<g:VerticalPanel>
|
||||
<b:TextBox name="File Name" ui:field="field_file_name">
|
||||
</b:TextBox>
|
||||
<g:HorizontalPanel>
|
||||
<b:Label type="INFO">publish</b:Label>
|
||||
<g:HorizontalPanel
|
||||
addStyleNames="{style.to-publish-hr}">
|
||||
<b:Label type="INFO" addStyleNames="{style.to-padding}">Publish</b:Label>
|
||||
<citem:SwitchButton ui:field="switchButton"
|
||||
addStyleNames="{style.padding-left-10}"></citem:SwitchButton>
|
||||
</g:HorizontalPanel>
|
||||
|
|
|
@ -42,14 +42,7 @@ public class Ckan2ZenodoViewManager {
|
|||
|
||||
Modal modal = new Modal(true);
|
||||
|
||||
basicTabPanel = new BasicTabPanel() {
|
||||
|
||||
@Override
|
||||
public void checkTabVisited() {
|
||||
buttonPublish.setEnabled(basicTabPanel.allTabVisited());
|
||||
}
|
||||
|
||||
};
|
||||
basicTabPanel = new BasicTabPanel();
|
||||
|
||||
boolean isUpdate = false;
|
||||
if(zenodoItem.getMetadata()!=null) {
|
||||
|
@ -89,7 +82,7 @@ public class Ckan2ZenodoViewManager {
|
|||
modal.add(basicTabPanel);
|
||||
|
||||
|
||||
buttonPublish.setEnabled(false);
|
||||
//buttonPublish.setEnabled(false);
|
||||
|
||||
buttonPublish.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
|
|
@ -24,16 +24,22 @@
|
|||
height: 645px;
|
||||
}
|
||||
|
||||
.ckan2zenodo-modal-style .nav-tabs {
|
||||
height: 645px;
|
||||
}
|
||||
|
||||
.ckan2zenodo-modal-style .pager {
|
||||
margin-right: 10px;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
margin-left: 140px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.legend-style {
|
||||
width: auto;
|
||||
padding: 10px;
|
||||
margin-bottom: 0px;
|
||||
font-size: 16px;
|
||||
font-size: 18px;
|
||||
color: gray;
|
||||
text-align: right;
|
||||
}
|
||||
|
@ -47,7 +53,7 @@
|
|||
}
|
||||
|
||||
.form-font-size label {
|
||||
font-size: 15px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.authors-table-spacing td {
|
||||
|
|
Loading…
Reference in New Issue