|
|
|
@ -37,8 +37,8 @@ import com.google.gwt.user.client.ui.Widget;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @author "Giancarlo Panichi" <a
|
|
|
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
|
|
|
* @author Giancarlo Panichi
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEventHandler {
|
|
|
|
@ -73,11 +73,10 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
// protected FillToolItem fillSpacingCardMoveToolBar;
|
|
|
|
|
protected WizardMessages msgs;
|
|
|
|
|
protected DeckPanel deckPanel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Node closeEventTarget = null;
|
|
|
|
|
|
|
|
|
|
private int zIndex=-1;
|
|
|
|
|
private int zIndex = -1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new Wizard Window with the specified title.
|
|
|
|
@ -102,17 +101,10 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
|
|
|
|
|
deckPanel = new DeckPanel();
|
|
|
|
|
|
|
|
|
|
backButton = new Button("<div><img class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS()
|
|
|
|
|
.getWizardPreviousButtonIcon()
|
|
|
|
|
+ "' src='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardPrevious24().getSafeUri()
|
|
|
|
|
.asString()
|
|
|
|
|
+ "'/>"
|
|
|
|
|
+ "<span class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS()
|
|
|
|
|
.getWizardPreviousButtonText() + "'>"
|
|
|
|
|
+ msgs.buttonBackLabel() + "</span>" + "</div>");
|
|
|
|
|
backButton = new Button("<div><img class='" + GCResources.INSTANCE.wizardCSS().getWizardPreviousButtonIcon()
|
|
|
|
|
+ "' src='" + GCResources.INSTANCE.wizardPrevious24().getSafeUri().asString() + "'/>" + "<span class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardPreviousButtonText() + "'>" + msgs.buttonBackLabel()
|
|
|
|
|
+ "</span>" + "</div>");
|
|
|
|
|
|
|
|
|
|
backButton.setEnabled(false);
|
|
|
|
|
backButton.setTabIndex(1001);
|
|
|
|
@ -163,15 +155,14 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initHandler() {
|
|
|
|
|
resizeHandlerRegistration = Window
|
|
|
|
|
.addResizeHandler(new ResizeHandler() {
|
|
|
|
|
resizeHandlerRegistration = Window.addResizeHandler(new ResizeHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onResize(ResizeEvent event) {
|
|
|
|
|
center();
|
|
|
|
|
@Override
|
|
|
|
|
public void onResize(ResizeEvent event) {
|
|
|
|
|
center();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -184,7 +175,6 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
this.originalTitle = title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Shows the next available card.
|
|
|
|
|
*/
|
|
|
|
@ -279,7 +269,7 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
/**
|
|
|
|
|
* Returns the number of available cards.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* @return the number of available cards
|
|
|
|
|
*/
|
|
|
|
|
public int getCardStackSize() {
|
|
|
|
|
return cardStack.size();
|
|
|
|
@ -288,7 +278,7 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
/**
|
|
|
|
|
* Returns the current active card.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* @return active card position
|
|
|
|
|
*/
|
|
|
|
|
public int getCurrentCard() {
|
|
|
|
|
int index = deckPanel.getVisibleWidget();
|
|
|
|
@ -309,13 +299,10 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
* Sets the label of next button to "Finish" value
|
|
|
|
|
*/
|
|
|
|
|
public void setNextButtonToFinish() {
|
|
|
|
|
nextButton.setHTML("<div><span class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardNextButtonText()
|
|
|
|
|
+ "'>" + msgs.buttonFinishLabel() + "</span>" + "<img class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardNextButtonIcon()
|
|
|
|
|
+ "'" + " src='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardGo24().getSafeUri().asString()
|
|
|
|
|
+ "'/></div>");
|
|
|
|
|
nextButton.setHTML("<div><span class='" + GCResources.INSTANCE.wizardCSS().getWizardNextButtonText() + "'>"
|
|
|
|
|
+ msgs.buttonFinishLabel() + "</span>" + "<img class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardNextButtonIcon() + "'" + " src='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardGo24().getSafeUri().asString() + "'/></div>");
|
|
|
|
|
// nextButton.setIcon(GCResources.INSTANCE.wizardGo());
|
|
|
|
|
// nextButton.setIconAlign(IconAlign.RIGHT);
|
|
|
|
|
/*
|
|
|
|
@ -327,13 +314,10 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setNextButtonToDefault() {
|
|
|
|
|
nextButton.setHTML("<div><span class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardNextButtonText()
|
|
|
|
|
+ "'>" + msgs.buttonNextLabel() + "</span>" + "<img class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardNextButtonIcon()
|
|
|
|
|
+ "'" + " src='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardNext24().getSafeUri().asString()
|
|
|
|
|
+ "'/></div>");
|
|
|
|
|
nextButton.setHTML("<div><span class='" + GCResources.INSTANCE.wizardCSS().getWizardNextButtonText() + "'>"
|
|
|
|
|
+ msgs.buttonNextLabel() + "</span>" + "<img class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardNextButtonIcon() + "'" + " src='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardNext24().getSafeUri().asString() + "'/></div>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -402,6 +386,7 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
* Set the card list.
|
|
|
|
|
*
|
|
|
|
|
* @param cards
|
|
|
|
|
* set the card list
|
|
|
|
|
*/
|
|
|
|
|
public void setCards(ArrayList<WizardCard> cards) {
|
|
|
|
|
for (WizardCard card : cards) {
|
|
|
|
@ -477,6 +462,7 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
* Sets visible next button.
|
|
|
|
|
*
|
|
|
|
|
* @param visible
|
|
|
|
|
* true if next button is visible
|
|
|
|
|
*/
|
|
|
|
|
protected void setNextButtonVisible(boolean visible) {
|
|
|
|
|
nextButton.setVisible(visible);
|
|
|
|
@ -486,6 +472,7 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
* Sets visible back button.
|
|
|
|
|
*
|
|
|
|
|
* @param visible
|
|
|
|
|
* true if back button is visible
|
|
|
|
|
*/
|
|
|
|
|
protected void setBackButtonVisible(boolean visible) {
|
|
|
|
|
backButton.setVisible(visible);
|
|
|
|
@ -516,20 +503,16 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
public ArrayList<WizardCard> getCardStack() {
|
|
|
|
|
return cardStack;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void showErrorAndHide(final String title, final String message) {
|
|
|
|
|
showErrorAndHide(title, message,
|
|
|
|
|
new Throwable());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void showErrorAndHide(final String title, final String message,
|
|
|
|
|
final Throwable throwable) {
|
|
|
|
|
final WizardEvent event=new WizardEvent(WizardEventType.Failed);
|
|
|
|
|
showErrorAndHide(title, message, new Throwable());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void showErrorAndHide(final String title, final String message, final Throwable throwable) {
|
|
|
|
|
final WizardEvent event = new WizardEvent(WizardEventType.Failed);
|
|
|
|
|
event.setErrorMessage(message);
|
|
|
|
|
event.setException(new Exception(throwable));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GWTMessages.alert(title, message, getZIndex(), new Callback<Void, Void>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -550,24 +533,15 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void addToolIcon() {
|
|
|
|
|
|
|
|
|
|
// get the "dialogTopRight" class td
|
|
|
|
|
Element dialogTopRight = getCellElement(0, 2);
|
|
|
|
|
|
|
|
|
|
// close button image html
|
|
|
|
|
dialogTopRight.setInnerHTML("<div class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardToolButtonText()
|
|
|
|
|
+ "'>"
|
|
|
|
|
+ "<img src='"
|
|
|
|
|
+ GCResources.INSTANCE.toolButtonClose20().getSafeUri()
|
|
|
|
|
.asString() + "' class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardToolButtonIcon()
|
|
|
|
|
+ "' /></div>");
|
|
|
|
|
dialogTopRight.setInnerHTML("<div class='" + GCResources.INSTANCE.wizardCSS().getWizardToolButtonText() + "'>"
|
|
|
|
|
+ "<img src='" + GCResources.INSTANCE.toolButtonClose20().getSafeUri().asString() + "' class='"
|
|
|
|
|
+ GCResources.INSTANCE.wizardCSS().getWizardToolButtonIcon() + "' /></div>");
|
|
|
|
|
|
|
|
|
|
// set the event target
|
|
|
|
|
closeEventTarget = dialogTopRight.getChild(0).getChild(0);
|
|
|
|
@ -577,9 +551,8 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
protected void onPreviewNativeEvent(NativePreviewEvent event) {
|
|
|
|
|
NativeEvent nativeEvent = event.getNativeEvent();
|
|
|
|
|
|
|
|
|
|
if (!event.isCanceled() && (event.getTypeInt() == Event.ONCLICK)
|
|
|
|
|
&& isCloseEvent(nativeEvent)) {
|
|
|
|
|
final WizardEvent wizardEvent=new WizardEvent(WizardEventType.Aborted);
|
|
|
|
|
if (!event.isCanceled() && (event.getTypeInt() == Event.ONCLICK) && isCloseEvent(nativeEvent)) {
|
|
|
|
|
final WizardEvent wizardEvent = new WizardEvent(WizardEventType.Aborted);
|
|
|
|
|
fireEvent(wizardEvent);
|
|
|
|
|
this.hide();
|
|
|
|
|
}
|
|
|
|
@ -601,15 +574,14 @@ public class WizardWindow extends DialogBox implements WizardEvent.HasWizardEven
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setZIndex(int zIndex) {
|
|
|
|
|
this.zIndex=zIndex;
|
|
|
|
|
this.zIndex = zIndex;
|
|
|
|
|
getGlassElement().getStyle().setZIndex(zIndex);
|
|
|
|
|
getElement().getStyle().setZIndex(zIndex+1);
|
|
|
|
|
|
|
|
|
|
getElement().getStyle().setZIndex(zIndex + 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getZIndex(){
|
|
|
|
|
|
|
|
|
|
public int getZIndex() {
|
|
|
|
|
return zIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|