Fixed OnEsc error
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-wizard-widget@101670 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2e902b3a79
commit
de664ce16d
|
@ -11,7 +11,10 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.core.client.Callback;
|
import com.google.gwt.core.client.Callback;
|
||||||
|
import com.google.gwt.event.dom.client.KeyCodes;
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.Element;
|
||||||
|
import com.google.gwt.user.client.Event;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||||
|
@ -42,11 +45,10 @@ public class WizardWindow extends Window {
|
||||||
protected String WIZARDHEIGHT = "520px";
|
protected String WIZARDHEIGHT = "520px";
|
||||||
protected boolean WIZARRESIZABLE = false;
|
protected boolean WIZARRESIZABLE = false;
|
||||||
protected boolean WIZARDCOLLAPSIBLE = true;
|
protected boolean WIZARDCOLLAPSIBLE = true;
|
||||||
protected String BUTTONBACKLABEL="Back";
|
protected String BUTTONBACKLABEL = "Back";
|
||||||
protected String BUTTONNEXTLABEL="Next";
|
protected String BUTTONNEXTLABEL = "Next";
|
||||||
protected String BUTTONFINISHLABEL="Finish";
|
protected String BUTTONFINISHLABEL = "Finish";
|
||||||
|
|
||||||
|
|
||||||
protected ArrayList<WizardCard> cardStack = new ArrayList<WizardCard>();
|
protected ArrayList<WizardCard> cardStack = new ArrayList<WizardCard>();
|
||||||
|
|
||||||
protected TextButton backButton;
|
protected TextButton backButton;
|
||||||
|
@ -68,11 +70,11 @@ public class WizardWindow extends Window {
|
||||||
protected ArrayList<WizardListener> listeners;
|
protected ArrayList<WizardListener> listeners;
|
||||||
|
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
|
|
||||||
protected ToolBar cardMoveToolBar;
|
|
||||||
|
|
||||||
protected FillToolItem fillSpacingCardMoveToolBar;
|
|
||||||
|
|
||||||
|
protected ToolBar cardMoveToolBar;
|
||||||
|
|
||||||
|
protected FillToolItem fillSpacingCardMoveToolBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Wizard Window with the specified title.
|
* Create a new Wizard Window with the specified title.
|
||||||
*
|
*
|
||||||
|
@ -81,9 +83,9 @@ public class WizardWindow extends Window {
|
||||||
*/
|
*/
|
||||||
public WizardWindow(String title) {
|
public WizardWindow(String title) {
|
||||||
this(title, new SimpleEventBus());
|
this(title, new SimpleEventBus());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WizardWindow(String title, EventBus eventBus) {
|
public WizardWindow(String title, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
@ -111,13 +113,13 @@ public class WizardWindow extends Window {
|
||||||
backButton = new TextButton(BUTTONBACKLABEL);
|
backButton = new TextButton(BUTTONBACKLABEL);
|
||||||
backButton.setIcon(ResourceBundle.INSTANCE.wizardPrevious());
|
backButton.setIcon(ResourceBundle.INSTANCE.wizardPrevious());
|
||||||
backButton.setIconAlign(IconAlign.LEFT);
|
backButton.setIconAlign(IconAlign.LEFT);
|
||||||
|
|
||||||
backButton.setEnabled(false);
|
backButton.setEnabled(false);
|
||||||
backButton.setTabIndex(1001);
|
backButton.setTabIndex(1001);
|
||||||
cardMoveToolBar.add(backButton,new BoxLayoutData(new Margins(1)));
|
cardMoveToolBar.add(backButton, new BoxLayoutData(new Margins(1)));
|
||||||
|
|
||||||
fillSpacingCardMoveToolBar=new FillToolItem();
|
fillSpacingCardMoveToolBar = new FillToolItem();
|
||||||
|
|
||||||
cardMoveToolBar.add(fillSpacingCardMoveToolBar);
|
cardMoveToolBar.add(fillSpacingCardMoveToolBar);
|
||||||
|
|
||||||
nextButton = new TextButton(BUTTONNEXTLABEL);
|
nextButton = new TextButton(BUTTONNEXTLABEL);
|
||||||
|
@ -131,7 +133,6 @@ public class WizardWindow extends Window {
|
||||||
|
|
||||||
SelectHandler selectionHandler = new SelectHandler() {
|
SelectHandler selectionHandler = new SelectHandler() {
|
||||||
|
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
TextButton button = (TextButton) event.getSource();
|
TextButton button = (TextButton) event.getSource();
|
||||||
String btnID = button.getId();
|
String btnID = button.getId();
|
||||||
|
@ -159,7 +160,6 @@ public class WizardWindow extends Window {
|
||||||
setWidget(container);
|
setWidget(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -169,7 +169,6 @@ public class WizardWindow extends Window {
|
||||||
|
|
||||||
closeBtn.addSelectHandler(new SelectHandler() {
|
closeBtn.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
fireAborted();
|
fireAborted();
|
||||||
hide();
|
hide();
|
||||||
|
@ -178,6 +177,20 @@ public class WizardWindow extends Window {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onKeyPress(Event we) {
|
||||||
|
int keyCode = we.getKeyCode();
|
||||||
|
|
||||||
|
boolean t = getElement().isOrHasChild(
|
||||||
|
we.getEventTarget().<Element> cast());
|
||||||
|
boolean key = true;
|
||||||
|
if (key && super.isClosable() && super.isOnEsc() && keyCode == KeyCodes.KEY_ESCAPE && t) {
|
||||||
|
fireAborted();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void addListener(WizardListener listener) {
|
public void addListener(WizardListener listener) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
@ -452,37 +465,36 @@ public class WizardWindow extends Window {
|
||||||
|
|
||||||
public void showErrorAndHide(final String title, final String message,
|
public void showErrorAndHide(final String title, final String message,
|
||||||
final Throwable throwable) {
|
final Throwable throwable) {
|
||||||
UtilsGXT3.alert(title, message, new Callback<Component,Void>() {
|
UtilsGXT3.alert(title, message, new Callback<Component, Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Void reason) {
|
public void onFailure(Void reason) {
|
||||||
hide();
|
hide();
|
||||||
fireFailed(title, message, throwable);
|
fireFailed(title, message, throwable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Component result) {
|
public void onSuccess(Component result) {
|
||||||
hide();
|
hide();
|
||||||
fireAborted();
|
fireAborted();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fireCompleted(TRId id) {
|
public void fireCompleted(TRId id) {
|
||||||
for (WizardListener listener : listeners)
|
for (WizardListener listener : listeners)
|
||||||
listener.completed(id);
|
listener.completed(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void firePutInBackground() {
|
public void firePutInBackground() {
|
||||||
for (WizardListener listener : listeners)
|
for (WizardListener listener : listeners)
|
||||||
listener.putInBackground();
|
listener.putInBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void fireAborted() {
|
public void fireAborted() {
|
||||||
for (WizardListener listener : listeners)
|
for (WizardListener listener : listeners)
|
||||||
listener.aborted();
|
listener.aborted();
|
||||||
|
|
Loading…
Reference in New Issue