List of usage examples for com.google.gwt.user.client Timer Timer
Timer
From source file:com.example.jumpnote.web.client.JumpNoteWeb.java
License:Apache License
public static void showMessage(String message, boolean isTransient) { if (sMessagePanel == null) { sMessagePanel = RootPanel.get("messagePanel"); }/*from w ww .j a v a 2s . c om*/ sMessagePanel.setVisible(true); sMessagePanel.getElement().setInnerText(message); if (isTransient) { new Timer() { @Override public void run() { sMessagePanel.setVisible(false); } }.schedule(TRANSIENT_MESSAGE_HIDE_DELAY); } }
From source file:com.extjs.gxt.samples.client.examples.chart.ChartGalleryExample.java
License:Open Source License
private void adjustUpdateSpeed(int newSpeed) { updateSpeed = newSpeed;//from w w w.j a v a 2 s . co m updateCmd.execute(); if (updater != null) updater.cancel(); if (updateSpeed == 0) { return; } updater = new Timer() { public void run() { updateCmd.execute(); } }; updater.scheduleRepeating(updateSpeed); }
From source file:com.extjs.gxt.samples.client.examples.windows.MessageBoxExample.java
License:Open Source License
@Override protected void onRender(Element parent, int pos) { super.onRender(parent, pos); final Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent ce) { Button btn = ce.getButtonClicked(); Info.display("MessageBox", "The '{0}' button was pressed", btn.getText()); }/* ww w . ja va2 s . c om*/ }; final ButtonBar buttonBar = new ButtonBar(); buttonBar.setMinButtonWidth(75); buttonBar.add(new Button("Confirm", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { MessageBox.confirm("Confirm", "Are you sure you want to do that?", l); } })); buttonBar.add(new Button("Prompt", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { final MessageBox box = MessageBox.prompt("Name", "Please enter your name:"); box.addCallback(new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent be) { Info.display("MessageBox", "You entered '{0}'", new Params(be.getValue())); } }); } })); buttonBar.add(new Button("Multiline Prompt", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { MessageBox box = MessageBox.prompt("Address", "Please enter your address:", true); box.addCallback(new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent be) { String v = Format.ellipse(be.getValue(), 80); Info.display("MessageBox", "You entered '{0}'", new Params(v)); } }); } })); buttonBar.add(new Button("Yes/No/Cancel", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { MessageBox box = new MessageBox(); box.setButtons(MessageBox.YESNOCANCEL); box.setIcon(MessageBox.QUESTION); box.setTitle("Save Changes?"); box.addCallback(l); box.setMessage( "You are closing a tab that has unsaved changes. Would you like to save your changes?"); box.show(); } })); buttonBar.add(new Button("Progress", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { final MessageBox box = MessageBox.progress("Please wait", "Loading items...", "Initializing..."); final ProgressBar bar = box.getProgressBar(); final Timer t = new Timer() { float i; @Override public void run() { bar.updateProgress(i / 100, (int) i + "% Complete"); i += 5; if (i > 105) { cancel(); box.close(); Info.display("Message", "Items were loaded", ""); } } }; t.scheduleRepeating(500); } })); buttonBar.add(new Button("Wait", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { final MessageBox box = MessageBox.wait("Progress", "Saving your data, please wait...", "Saving..."); Timer t = new Timer() { @Override public void run() { Info.display("Message", "Your fake data was saved", ""); box.close(); } }; t.schedule(5000); } })); buttonBar.add(new Button("Alert", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { MessageBox.alert("Alert", "Access Denied", l); } })); add(buttonBar, new FlowData(10)); }
From source file:com.extjs.gxt.samples.explorer.client.Explorer.java
License:Open Source License
public void onModuleLoad() { if (!GWT.isScript()) { GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void onUncaughtException(Throwable e) { e.printStackTrace();// ww w .ja va2 s . c o m } }); } ExampleServiceAsync service = (ExampleServiceAsync) GWT.create(ExampleService.class); Registry.register(Examples.SERVICE, service); FileServiceAsync fileservice = (FileServiceAsync) GWT.create(FileService.class); Registry.register(Examples.FILE_SERVICE, fileservice); model = new ExplorerModel(); Registry.register(Examples.MODEL, model); List<Entry> entries = model.getEntries(); for (Entry e : entries) { System.out.println("#" + e.getId().toLowerCase()); } if ("access".equals(GXT.getThemeId())) { Timer t = new Timer() { @Override public void run() { buildApp(); } }; t.schedule(500); } else { buildApp(); } }
From source file:com.extjs.gxt.samples.mail.client.widget.LoginDialog.java
License:Open Source License
protected void onSubmit() { status.show();// w w w .jav a2s . c o m getButtonBar().disable(); Timer t = new Timer() { @Override public void run() { LoginDialog.this.hide(); } }; t.schedule(2000); }
From source file:com.extjs.gxt.ui.client.aria.DefaultHandler.java
License:sencha.com license
@Override public void onEnter(final Component component, final PreviewEvent pe) { if (!isManaged()) return;/*from w ww .j av a 2s . c om*/ Timer t = new Timer() { @Override public void run() { stepInto(component, pe, true); } }; t.schedule(200); }
From source file:com.extjs.gxt.ui.client.dnd.TreeDropTarget.java
License:Open Source License
protected void handleAppend(DNDEvent event, final TreeItem item) { // clear any active append item if (activeItem != null && activeItem != item) { activeItem.el().firstChild().removeStyleName("my-tree-drop"); }/*from ww w . j a v a 2 s . c om*/ status = -1; Insert.get().hide(); event.getStatus().setStatus(true); if (activeItem != null) { activeItem.el().firstChild().removeStyleName("my-tree-drop"); } if (item != appendItem && autoExpand && !item.isExpanded()) { Timer t = new Timer() { @Override public void run() { if (item == appendItem) { item.setExpanded(true); } else { } } }; t.schedule(autoExpandDelay); } appendItem = item; activeItem = item; activeItem.el().firstChild().addStyleName("my-tree-drop"); }
From source file:com.extjs.gxt.ui.client.dnd.TreeGridDropTarget.java
License:sencha.com license
protected void handleAppend(DNDEvent event, final TreeNode item) { // clear any active append item if (activeItem != null && activeItem != item) { clearStyle(activeItem);// ww w . j a va 2 s .co m } status = -1; Insert.get().hide(); event.getStatus().setStatus(true); if (activeItem != null) { clearStyle(activeItem); } if (item != null && item != appendItem && autoExpand && !item.isExpanded()) { Timer t = new Timer() { @Override public void run() { if (item == appendItem) { item.setExpanded(true); } } }; t.schedule(autoExpandDelay); } appendItem = item; activeItem = item; if (activeItem != null) { El.fly(treeGrid.getView().findRow(event.getTarget())).addStyleName("x-ftree2-node-drop"); } }
From source file:com.extjs.gxt.ui.client.dnd.TreePanelDropTarget.java
License:sencha.com license
protected void handleAppend(DNDEvent event, final TreeNode item) { // clear any active append item if (activeItem != null && activeItem != item) { tree.getView().onDropChange(activeItem, false); }// www .j a v a 2 s. c o m status = -1; Insert.get().hide(); event.getStatus().setStatus(true); if (activeItem != null) { tree.getView().onDropChange(activeItem, false); } if (item != null && item != appendItem && autoExpand && !item.isExpanded()) { Timer t = new Timer() { @Override public void run() { if (item == appendItem) { item.setExpanded(true); } else { } } }; t.schedule(autoExpandDelay); } appendItem = item; activeItem = item; if (activeItem != null) { tree.getView().onDropChange(activeItem, true); } }
From source file:com.extjs.gxt.ui.client.GXT.java
License:sencha.com license
/** * Hides the loading panel.//from w w w .j a v a 2 s.c om * * @param id the loading panel id */ public static void hideLoadingPanel(String id) { final Element loading = XDOM.getElementById(id); if (loading != null) { Timer t = new Timer() { @Override public void run() { El.fly(loading).hide(); } }; t.schedule(500); } }