类com.google.gwt.core.client.Scheduler源码实例Demo

下面列出了怎么用com.google.gwt.core.client.Scheduler的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: core   文件: SearchTool.java
public void showPopup() {

        popup.setWidth(640);
        popup.setHeight(480);
        popup.setModal(true);
        popup.setGlassEnabled(true);
        popup.center();

        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
            @Override
            public void execute() {
                if (index.isEmpty()) {
                    popup.index();
                } else {
                    popup.showSearchPage();
                }
            }
        });
    }
 
源代码2 项目: gwtbootstrap3-extras   文件: Animate.java
/**
 * Animate any element with specific animation. Animation is done by CSS and runs multiple times.
 *
 * Animation is started when element is appended to the DOM or new (not same) animation is added
 * to already displayed element. Animation runs on hidden elements too and is not paused/stopped
 * when element is set as hidden.
 *
 * @param widget Widget to apply animation to.
 * @param animation Custom CSS class name used as animation.
 * @param count Number of animation repeats. 0 disables animation, any negative value set repeats to infinite.
 * @param duration Animation duration in ms. 0 disables animation, any negative value keeps default of original animation.
 * @param delay Delay before starting the animation loop in ms. Value <= 0 means no delay.
 * @param <T> Any object extending UIObject class (typically Widget).
 * @return Animation's CSS class name, which can be removed to stop animation.
 */
public static <T extends UIObject> String animate(final T widget, final String animation, final int count, final int duration, final int delay) {

    if (widget != null && animation != null) {
        // on valid input
        if (widget.getStyleName().contains(animation)) {
            // animation is present, remove it and run again.
            stopAnimation(widget, animation);
            Scheduler.get().scheduleFixedDelay(new Scheduler.RepeatingCommand() {
                @Override
                public boolean execute() {
                    styleElement(widget.getElement(), animation, count, duration, delay);
                    return false;
                }
            }, 200);
            return animation + " " + getStyleNameFromAnimation(animation,count,duration,delay);
        } else {
            // animation was not present, run immediately
            return styleElement(widget.getElement(), animation, count, duration, delay);
        }
    } else {
        return null;
    }

}
 
源代码3 项目: cuba   文件: CubaFileUploadProgressWindow.java
@Override
protected void onAttach() {
    super.onAttach();

    /*
     * When this window gets reattached, set the tabstop to the previous
     * state.
     */
    setTabStopEnabled(doTabStop);

    // Fix for #14413. Any pseudo elements inside these elements are not
    // visible on initial render unless we shake the DOM.
    if (BrowserInfo.get().isIE8()) {
        closeBox.getStyle().setDisplay(Style.Display.NONE);
        Scheduler.get().scheduleFinally(new Command() {
            @Override
            public void execute() {
                closeBox.getStyle().clearDisplay();
            }
        });
    }
}
 
源代码4 项目: unitime   文件: PinDialog.java
public void checkEligibility(boolean online, boolean sectioning, Long sessionId, Long studentId, PinCallback callback, AcademicSessionInfo session) {
	iOnline = online;
	iSectioning = sectioning;
	iSessionId = sessionId;
	iStudentId = studentId;
	iCallback = callback;
	if (session != null) {
		setText(MESSAGES.dialogPinForSession(session.getTerm(), session.getYear()));
		iPinLabel.setText(MESSAGES.pinForSession(session.getTerm(), session.getYear()));
	} else {
		setText(MESSAGES.dialogPin());
		iPinLabel.setText(MESSAGES.pin());
	}
	iPin.setText("");
	center();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iPin.setFocus(true);
		}
	});
}
 
源代码5 项目: cuba   文件: CubaMaskedFieldWidget.java
@Override
public void onFocus(FocusEvent event) {
    super.onFocus(event);

    if (!this.focused) {
        this.focused = true;

        if (!isReadOnly() && isEnabled()) {
            if (mask != null && nullRepresentation != null && nullRepresentation.equals(super.getText())) {
                addStyleName("c-focus-move");

                Scheduler.get().scheduleDeferred(() -> {
                    if (!isReadOnly() && isEnabled() && focused) {
                        setSelectionRange(getPreviousPos(0), 0);
                    }

                    removeStyleName("c-focus-move");
                });
            }
        }
    }
}
 
源代码6 项目: proarc   文件: DigitalObjectChildrenEditor.java
private void initOnEdit() {
//        LOG.info("initOnEdit");
        originChildren = null;
        lastClicked = null;
        updateReorderUi(false);
        attachListResultSet();
        // select first
        if (!childrenListGrid.getOriginalResultSet().isEmpty()) {
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    // defer the select as it is ignored after refresh in onDataArrived
                    selectChildFromHistory();
                }
            });
        }
    }
 
源代码7 项目: core   文件: Bootstrapper.java
private void prepareSecurityContext(Scheduler.ScheduledCommand andThen) {
    // creates an empty (always true) security context for the bootstrap steps
    /*securityFramework.createSecurityContext(null, Collections.<String>emptySet(), false,
            new AsyncCallback<SecurityContext>() {
                @Override
                public void onFailure(Throwable caught) {
                    andThen.execute();
                }

                @Override
                public void onSuccess(SecurityContext result) {
                    andThen.execute();
                }
            });*/
    andThen.execute();
}
 
源代码8 项目: core   文件: DomainDeploymentFinderView.java
@Override
public void setPreview(final SafeHtml html) {
    Scheduler.get().scheduleDeferred(() -> {
        contentCanvas.clear();
        contentCanvas.add(new ScrollPanel(new HTML(html)));
    });
}
 
源代码9 项目: core   文件: DataSourceFinder.java
public void verifyConnection(final DataSource dataSource, boolean xa, boolean existing,
        Scheduler.ScheduledCommand onCreated) {
    VerifyConnectionOp vop = new VerifyConnectionOp(dataSourceStore, dispatcher, beanFactory,
            currentProfileSelection.getName());
    vop.execute(dataSource, xa, existing, new SimpleCallback<VerifyConnectionOp.VerifyResult>() {
        @Override
        public void onSuccess(final VerifyConnectionOp.VerifyResult result) {
            getView().showVerifyConncectionResult(dataSource.getName(), result);
            if (result.wasCreated() && onCreated != null) {
                Scheduler.get().scheduleDeferred(onCreated);
            }
        }
    });
}
 
源代码10 项目: core   文件: DataSourceFinderView.java
@Override
public void setPreview(final SafeHtml html) {

    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            previewCanvas.clear();
            previewCanvas.add(new ScrollPanel(new HTML(html)));
        }
    });

}
 
源代码11 项目: core   文件: DataProviderFilter.java
public Widget asWidget() {


        filter.setMaxLength(30);
        filter.setVisibleLength(20);
        filter.getElement().setAttribute("style", "width:120px;");

        filter.addKeyUpHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent keyUpEvent) {

                Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {

                    @Override
                    public void execute() {
                        String prefix = filter.getText();

                        if (prefix != null && !prefix.equals("")) {
                            // filter by prefix
                            filterByPrefix(prefix);
                        } else {
                            clearFilter();
                        }
                    }

                });
            }
        });
        HorizontalPanel panel = new HorizontalPanel();
        Label label = new Label(Console.CONSTANTS.common_label_filter() + ": ");
        panel.add(label);
        panel.add(filter);

        label.getElement().setAttribute("style", "padding-top:8px;margin-right:8px");
        return panel;
    }
 
源代码12 项目: core   文件: SearchPopup.java
void showSearchPage() {
    deck.showWidget(1);
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            textBox.setFocus(true);
        }
    });
}
 
源代码13 项目: appinventor-extensions   文件: YaProjectEditor.java
private void callLoadProject() {
  Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
    @Override
    public void execute() {
      if (!readyToLoadProject()) { // wait till project is processed
        Scheduler.get().scheduleDeferred(this);
      } else {
        loadProject();
      }
    }
  });
}
 
源代码14 项目: cuba   文件: CubaFileUploadWidget.java
public void setPasteZone(final Widget pasteZone) {
    if (pasteZone != null) {
        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
            @Override
            public void execute() {
                fileUpload.setPasteZone(pasteZone.getElement());
            }
        });
    } else {
        fileUpload.setPasteZone(null);
    }
}
 
源代码15 项目: core   文件: LogFilePanel.java
public void onResize() {
    Scheduler.get().scheduleDeferred(() -> {
        int panelHeight = panel.getElement().getParentElement().getOffsetHeight();
        int editorHeight = panelHeight - HEADER_HEIGHT - TOOLS_HEIGHT - MARGIN_BOTTOM;

        if (panelHeight > 0) {
            editor.setHeight(editorHeight + "px");
        }
    });
}
 
源代码16 项目: cuba   文件: CubaTooltip.java
protected void showTooltip(boolean forceShow) {
    // Schedule timer for showing the tooltip according to if it
    // was recently closed or not.
    int timeout = 0;
    if (!forceShow) {
        timeout = justClosed ? getQuickOpenDelay() : getOpenDelay();
    }
    if (timeout == 0) {
        Scheduler.get().scheduleDeferred(this::showTooltip);
    } else {
        showTimer.schedule(timeout);
        opening = true;
    }
}
 
源代码17 项目: core   文件: PicketLinkFinderView.java
@Override
public void setPreview(final SafeHtml html) {
    Scheduler.get().scheduleDeferred(() -> {
        previewCanvas.clear();
        previewCanvas.add(new ScrollPanel(new HTML(html)));
    });
}
 
源代码18 项目: cuba   文件: CubaSuggestionFieldWidget.java
protected void showSuggestions(boolean userOriginated) {
    Scheduler.get().scheduleDeferred(() -> {
        suggestionsContainer.clearItems();

        for (Suggestion suggestion : suggestions) {
            SuggestionItem menuItem = new SuggestionItem(suggestion);
            menuItem.setScheduledCommand(this::selectSuggestion);

            String styleName = suggestion.getStyleName();
            if (styleName != null && !styleName.isEmpty()) {
                menuItem.addStyleName(suggestion.getStyleName());
            }

            suggestionsContainer.addItem(menuItem);
        }
        suggestionsContainer.selectItem(0);

        suggestionsPopup.removeAutoHidePartner(getElement());
        suggestionsPopup.addAutoHidePartner(getElement());

        if ((isFocused() || !userOriginated)
                && (!suggestionsPopup.isAttached() || !suggestionsPopup.isVisible())) {
            suggestionsPopup.showPopup();
        }

        suggestionsPopup.updateWidth();
    });
}
 
源代码19 项目: gantt   文件: GanttConnector.java
@Override
public void onElementResize(ElementResizeEvent e) {
    final int height = e.getElement().getClientHeight();
    final int width = e.getElement().getClientWidth();
    if (previousHeight != height) {
        previousHeight = height;

        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            @Override
            public void execute() {
                getWidget().notifyHeightChanged(height);
                updateDelegateTargetHeight();
            }
        });
    }
    if (previousWidth != width) {
        previousWidth = width;
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            @Override
            public void execute() {
                getWidget().notifyWidthChanged(width);
                updateAllStepsPredecessors();
                updateDelegateTargetHeight();
            }
        });
    }
}
 
源代码20 项目: core   文件: WebServiceRuntimePresenter.java
@Override
protected void onAction(Action action) {
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            loadEndpoints(false);

        }
    });    }
 
源代码21 项目: core   文件: ElytronFinderView.java
@Override
public void setPreview(SafeHtml html) {
    Scheduler.get().scheduleDeferred(() -> {
        previewCanvas.clear();
        previewCanvas.add(new ScrollPanel(new HTML(html)));
    });
}
 
源代码22 项目: cuba   文件: CubaGroupTableWidget.java
private void setSpannedRowWidthAfterDOMFullyInited() {
    // Defer setting width on spanned columns to make sure that
    // they are added to the DOM before trying to calculate
    // widths.
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            calcAndSetWidthForSpannedCell();
        }
    });
}
 
源代码23 项目: cuba   文件: Tools.java
@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
    super.onPreviewNativeEvent(event);

    NativeEvent nativeEvent = event.getNativeEvent();
    Element target = Element.as(nativeEvent.getEventTarget());

    if (Event.ONCLICK == event.getTypeInt()) {
        if (getElement().isOrHasChild(target)) {
            Scheduler.get().scheduleDeferred(this::hide);
        }
    }

    previewTableContextMenuEvent(event);
}
 
源代码24 项目: swellrt   文件: ServerlessEntryPoint.java
@JsIgnore
@Override
public void onModuleLoad() {

  // Model factory is used in remote Waves
  ModelFactory.instance = null;
  ServiceConfig.configProvider = getConfigProvider();
  getEditorConfigProvider();

  GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

    @Override
    public void onUncaughtException(Throwable e) {
      Console.log("Uncaught Exception: " + e.getMessage());
      String string = "";
      for (StackTraceElement element : e.getStackTrace()) {
        string += element + "\n";
      }
      Console.log("Trace: ");
      Console.log(string);

    }
  });

  Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
    @Override
    public void execute() {

      service = new ServerlessFrontend();
      notifyOnLoadHandlers(service);

    }
  });

}
 
源代码25 项目: putnami-web-toolkit   文件: CollapseHelper.java
public void doCollapse(final boolean collapse) {
	if (collapse != this.collapsed) {
		EventBus.get().fireEventFromSource(new CollapseEvent(CollapseHelper.this, collapse), CollapseHelper.this);

		this.collapsableElement.getStyle().setHeight(this.collapsableElement.getOffsetHeight(), Unit.PX);

		StyleUtils.removeStyle(this.collapsableElement, CollapseHelper.STYLE_COLLAPSE);
		StyleUtils.removeStyle(this.collapsableElement, CollapseHelper.STYLE_VISIBLE);
		StyleUtils.addStyle(this.collapsableElement, CollapseHelper.STYLE_COLLAPSING);

		final int endHeight = collapse ? 0 : this.collapsableElement.getScrollHeight();

		Scheduler.get().scheduleDeferred(new ScheduledCommand() {

			@Override
			public void execute() {
				CollapseHelper.this.collapsableElement.getStyle().setHeight(endHeight, Unit.PX);
			}
		});

		Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

			@Override
			public boolean execute() {
				CollapseHelper.this.collapsableElement.getStyle().clearHeight();
				StyleUtils.removeStyle(CollapseHelper.this.collapsableElement, CollapseHelper.STYLE_COLLAPSING);
				StyleUtils.addStyle(CollapseHelper.this.collapsableElement, CollapseHelper.STYLE_COLLAPSE);
				StyleUtils.toggleStyle(CollapseHelper.this.collapsableElement, CollapseHelper.STYLE_VISIBLE, !collapse);
				return false;
			}
		}, 350);
		this.collapsed = collapse;
	}
}
 
源代码26 项目: core   文件: JPAMetricPresenter.java
@Override
protected void onAction(Action action) {
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            refresh(true);
        }
    });
}
 
源代码27 项目: cuba   文件: CubaVerticalSplitPanelConnector.java
@Override
public void postLayout() {
    // Have to re-layout after parent layout expand hack applied
    // to avoid split position glitch.
    if (updateLayout) {
        Scheduler.get().scheduleFinally(this::layout);
        updateLayout = false;
    }
}
 
源代码28 项目: cuba   文件: CubaTreeGridWidget.java
protected Scheduler.ScheduledCommand getSelectAllCommand() {
    return () -> {
        for (Column column : getColumns()) {
            if (column.isHidden()) {
                column.setHidden(false);
            }
        }
    };
}
 
源代码29 项目: core   文件: StandaloneDeploymentFinderView.java
@Override
public void setPreview(final SafeHtml html) {
    Scheduler.get().scheduleDeferred(() -> {
        contentCanvas.clear();
        contentCanvas.add(new ScrollPanel(new HTML(html)));
    });
}
 
源代码30 项目: core   文件: RepositoryView.java
@Override
public void setFullScreen(final boolean fullscreen) {
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            layout.setWidgetHidden(nav, fullscreen);

            editor.updateEditorConstraints();
        }
    });

}