List of usage examples for com.google.gwt.user.client Timer Timer
Timer
From source file:com.calclab.emiteuimodule.client.dialog.MultiChatPanel.java
License:Open Source License
private void configureBottomInfoTimer() { bottomInfoTimer = new Timer() { @Override/*ww w .ja v a2 s . co m*/ public void run() { setBottomInfoMessage(""); } }; }
From source file:com.calclab.emiteuimodule.client.dialog.MultiChatPanel.java
License:Open Source License
private FormPanel createInputPanel() { inputForm = new FormPanel(); inputForm.setLayout(new FormLayout()); inputForm.setHideLabels(true);//from ww w. ja va 2 s. co m inputForm.setBorder(false); input = new TextArea("Input", "input"); input.setHeight(47); input.setEnterIsSpecial(true); final EventCallback inputKeyPressListener = new EventCallback() { public void execute(final EventObject e) { DeferredCommand.addCommand(new Command() { public void execute() { presenter.onComposing(); } }); } }; input.addKeyPressListener(inputKeyPressListener); final FieldListenerAdapter inputMainListener = new FieldListenerAdapter() { private final Timer stillFocusedTimer = new Timer() { @Override public void run() { if (inputFocused) { presenter.onInputFocus(); } } }; private final Timer stillUnfocusedTimer = new Timer() { @Override public void run() { if (!inputFocused) { presenter.onInputUnFocus(); } } }; @Override public void onBlur(final Field field) { inputFocused = false; stillFocusedTimer.cancel(); stillUnfocusedTimer.schedule(1000); } @Override public void onFocus(final Field field) { inputFocused = true; stillUnfocusedTimer.cancel(); stillFocusedTimer.schedule(1000); } @Override public void onSpecialKey(final Field field, final EventObject e) { if (e.getKey() == 13) { doSend(e); } } }; input.addListener(inputMainListener); input.setId(INPUT_ID); inputForm.add(input); return inputForm; }
From source file:com.cgxlib.core.CGXComponentBase.java
License:Apache License
public CGXComponentBase<V> emulateTransitionEnd(final int duration) { defineTransitionEnd();//from ww w. java 2 s.c o m final XQ $el = this; final TransitionStatus status = new TransitionStatus(); Function f = new Function() { public void f() { status.done = true; } }; onceWhenTransitionEnds(f); Timer timer = new Timer() { @Override public void run() { if (!status.done) { $el.trigger(browserTransitionEnd); } } }; timer.schedule(duration); return this; }
From source file:com.cgxlib.core.component.affix.Affix.java
License:Apache License
protected void checkPositionWithEventLoop() { Timer timer = new Timer() { @Override/*from w w w.j a v a2 s. c o m*/ public void run() { affixCheckPosition(); } }; timer.schedule(1); }
From source file:com.cgxlib.core.component.carousel.Carousel.java
License:Apache License
protected void cycle(boolean e) { if (!e) {//w ww .j a va 2 s .c o m this.paused = false; } if (interval != null) { interval.cancel(); } if (options.interval() > 0 && !paused) { if (interval == null) { interval = new Timer() { @Override public void run() { Carousel.this.carouselNext(); } }; } interval.scheduleRepeating(options.interval()); } }
From source file:com.cgxlib.core.component.tooltip.SingleTooltip.java
License:Apache License
protected static XQ enter(final SingleTooltip self, boolean isEvent) { if (isEvent) { if ("focusin".equals(self.type)) { self.inState.focus = true;//from ww w. j a v a 2 s . c o m } else { self.inState.hover = true; } } if (self.tip().hasClass("in") || self.hoverState == HoverState.IN) { self.hoverState = HoverState.IN; return self; } if (self.timeout != null) { self.timeout.cancel(); } self.hoverState = HoverState.IN; boolean willShow = self.options.delay() < 1 || self.options.showDelay() < 1; if (willShow) { return self.doShow(); } self.timeout = new Timer() { @Override public void run() { if (self.hoverState == HoverState.IN) { self.doShow(); } } }; self.timeout.schedule(self.options.showDelay()); return self; }
From source file:com.cgxlib.core.component.tooltip.SingleTooltip.java
License:Apache License
protected static SingleTooltip leave(final SingleTooltip self, boolean isEvent) { if (isEvent) { if ("focusin".equals(self.type)) { self.inState.focus = false;//from w w w. j a v a 2 s .c o m } else { self.inState.hover = false; } } if (self.inState.isAnyStateTrue()) { return self; } if (self.timeout != null) { self.timeout.cancel(); } self.hoverState = HoverState.OUT; if (self.options.delay() < 1 || self.options.hideDelay() < 1) { self.tooltipHide(null); } else { self.timeout = new Timer() { @Override public void run() { if (self.hoverState == HoverState.OUT) { self.tooltipHide(null); } } }; self.timeout.schedule(self.options.hideDelay()); } return self; }
From source file:com.cgxlib.xq.client.plugins.effects.TransitionsAnimation.java
License:Apache License
public void run(int duration) { // Calculate all Fx values for this animation onStart();// w w w . j a v a2s. c o m // Compute initial properties Properties p = getFxProperties(true); t.css(p); // Some browsers need re-flow after setting initial properties (FF 24.4.0). t.offset(); // Compute final properties p = getFxProperties(false); // Save old transition value oldTransitionValue = t.css(Transitions.transition); // Set new transition value String newTransitionValue = ""; List<String> transProps = Transitions.filterTransitionPropertyNames(p); String attribs = duration + "ms" + " " + easing + " " + delay + "ms"; for (String s : transProps) { newTransitionValue += (newTransitionValue.isEmpty() ? "" : ", ") + s + " " + attribs; } t.css(Transitions.transition, newTransitionValue); // Set new css properties so as the element is animated t.css(p); // Wait until transition has finished to run finish animation and dequeue new Timer() { public void run() { onComplete(); } }.schedule(delay + duration); }
From source file:com.ciplogic.web.codeeditor.dialog.CodeEditorDialog.java
License:Open Source License
@Override public void show() { super.show(); new Timer() { @Override//from w w w.j av a 2s .co m public void run() { codeEditor.onResize(null, null); } }.scheduleRepeating(1000); }
From source file:com.clouway.gwtphonegap.client.channel.ChannelFactory.java
License:Apache License
/** * Creates a {@link Channel} with the given client ID, passing it to the given * {@link ChannelCreatedCallback}.// ww w . j a v a2s . c o m * * <p> * If a Channel has already been created, this will immediately be passed to * the callback, so only one Channel will ever be created by this method. * </p> */ public static void createChannel(final String clientId, final ChannelCreatedCallback callback) { ScriptElement script = Document.get().createScriptElement(); script.setSrc(CHANNEL_SRC); Document.get().getElementsByTagName("head").getItem(0).appendChild(script); new Timer() { @Override public void run() { if (scriptLoaded()) { channel = createChannelImpl(clientId); callback.onChannelCreated(channel); this.cancel(); } } }.scheduleRepeating(100); }