List of usage examples for com.google.gwt.core.client Scheduler get
public static Scheduler get()
From source file:at.ac.fhcampuswien.atom.client.gui.attributes.components.slider.SliderBar.java
License:Apache License
/** * Create a slider bar./*from www. j a va2 s. com*/ * * @param minValue the minimum value in the range * @param maxValue the maximum value in the range * @param labelFormatter the label formatter * @param images the images to use for the slider */ public SliderBar(double minValue, double maxValue, LabelFormatter labelFormatter, SliderBarImages images) { super(); images.sliderBarCss().ensureInjected(); this.minValue = minValue; this.maxValue = maxValue; this.images = images; setLabelFormatter(labelFormatter); // Create the outer shell DOM.setStyleAttribute(getElement(), "position", "relative"); setStyleName("gwt-SliderBar-shell"); // Create the line lineElement = DOM.createDiv(); DOM.appendChild(getElement(), lineElement); DOM.setStyleAttribute(lineElement, "position", "absolute"); DOM.setElementProperty(lineElement, "className", "gwt-SliderBar-line"); // Create the knob knobImage.setResource(images.slider()); Element knobElement = knobImage.getElement(); DOM.appendChild(getElement(), knobElement); DOM.setStyleAttribute(knobElement, "position", "absolute"); DOM.setElementProperty(knobElement, "className", "gwt-SliderBar-knob"); sinkEvents(Event.MOUSEEVENTS | Event.KEYEVENTS | Event.FOCUSEVENTS); // workaround to render properly when parent Widget does not // implement ProvidesResize since DOM doesn't provide element // height and width until onModuleLoad() finishes. Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { onResize(); } }); }
From source file:at.ait.dme.yuma.suite.apps.core.client.treeview.AnnotationPanel.java
License:EUPL
public void editAnnotation(AnnotationTreeNode annotation, AnnotationTreeNode parent, boolean showFragmentEditor) { scrollPosition = scrollPanel.getScrollPosition(); annotateButton.setEnabled(false);/*from w ww . jav a2 s.c o m*/ editForm = editForm.newInstance(this, annotation, parent); if (annotation == null && parent == null) { // New annotation at root level editFormPanel.add(editForm); if (showFragmentEditor) mediaViewer.editAnnotation(null); } else { if (annotation == null) { // New reply annotationTree.showAnnotationEditForm(parent, editForm); if (showFragmentEditor) mediaViewer.editAnnotation(null); } else { // Update existing annotation (root or reply) annotationTree.showAnnotationEditForm(annotation, editForm); if (showFragmentEditor) { mediaViewer.editAnnotation(annotation.getAnnotation()); mediaViewer.hideAnnotation(annotation.getAnnotation()); } } Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { scrollPanel.ensureVisible(editForm); } }); } layout(); }
From source file:at.ait.dme.yuma.suite.apps.core.client.treeview.AnnotationPanel.java
License:EUPL
/** * Hides the annotation form, again either from above the annotation tree or from * underneath a tree node, also hides the active fragment panel. if in case of * an update the operation was canceled we have to restore a possible fragment. * //from www .j a v a 2s .c o m * @param annotationTreeNode * @param canceled true if the user canceled the operation, otherwise false * @see #showAnnotationForm(ImageAnnotationTreeNode, boolean, boolean) */ public void stopEditing(AnnotationTreeNode parent, Annotation created, boolean canceled) { if (parent == null) { editFormPanel.clear(); } else { annotationTree.hideAnnotationEditForm(parent); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { scrollPanel.setScrollPosition(scrollPosition); } }); } annotateButton.setEnabled(true); annotateFragmentButton.setEnabled(true); mediaViewer.stopEditing(); if (!canceled && created != null && created.getFragment() != null) { // Updated or created new annotation -> add to media viewer mediaViewer.showAnnotation(created); } else if (canceled && parent != null) { // Canceled editing of existing annotation -> add previous state to media viewer mediaViewer.showAnnotation(parent.getAnnotation()); } layout(); }
From source file:at.ait.dme.yuma.suite.apps.core.client.treeview.AnnotationTree.java
License:EUPL
public void selectAnnotation(Annotation annotation, boolean selected) { final AnnotationTreeNode node = nodes.get(annotation); if (node == null) return;//from w w w .j a va 2s .co m if (selected) { node.select(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { setSelectedItem(node.getTreeItem()); ensureSelectedItemVisible(); } }); } else { node.deselect(); } }
From source file:at.ait.dme.yuma.suite.apps.image.core.client.treeview.ImageAnnotationEditForm.java
License:EUPL
/** * Workaround: for some reason, radio buttons are reset during GUI layout. * This workaround restores their state directly after layout. */// ww w .j a va2 s . com @Override public void layout() { if (rdPublic != null) { final boolean pub = rdPublic.getValue(); final boolean prv = rdPrivate.getValue(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { rdPublic.setValue(pub); rdPrivate.setValue(prv); } }); } }
From source file:at.ait.dme.yuma.suite.apps.map.client.widgets.MapPopup.java
License:EUPL
public MapPopup(String title, String html, LonLat lonlat, Map map, ClickHandler closeHandler) { this.lonlat = lonlat; this.map = map; this.setStyleName("mapPopup"); FlowPanel header = new FlowPanel(); header.setStyleName("title"); header.add(new InlineHTML(title)); PushButton closeButton = new PushButton("X"); closeButton.setStyleName("close"); closeButton.addClickHandler(closeHandler); header.add(closeButton);/*from w w w. j av a 2s . co m*/ FlowPanel inner = new FlowPanel(); inner.setStyleName("inner"); inner.add(new InlineHTML(html)); moveListener = new EventListener() { @Override public void onEvent(LonLat ll, Pixel p, String tagname) { updatePosition(); } }; map.registerMapEventListener(moveListener, Map.EVENT_MOVE); FlowPanel panel = new FlowPanel(); panel.add(header); panel.add(inner); this.setWidget(panel); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { updatePosition(); } }); }
From source file:burrito.client.Burrito.java
License:Apache License
public static void setCurrentEditForm(EditForm current) { currentEditForm = current;/* w ww . j av a 2 s . c om*/ setCurrentCtrlSaveHandler(current); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { updateEditFormButtons(); } }); }
From source file:burrito.client.crud.CrudEntityEdit.java
License:Apache License
@Override public void focus() { if (firstField == null) { return;//from w ww. j a v a 2 s.c o m } Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { firstField.setFocus(true); firstField.selectAll(); } }); }
From source file:burrito.client.crud.CrudPanel.java
License:Apache License
public CrudPanel() { History.addValueChangeHandler(this); wrapper.add(top, DockPanel.NORTH);//w w w .j av a2s.c o m content.addStyleName("k5-CrudPanel-content"); top.addStyleName("k5-CrudPanel-top"); wrapper.add(content, DockPanel.CENTER); initWidget(wrapper); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { History.fireCurrentHistoryState(); } }); addStyleName("k5-CrudPanel"); setWidth("100%"); }
From source file:cc.alcina.framework.gwt.client.ClientNotificationsImpl.java
License:Apache License
@Override public void showDialog(String captionHTML, Widget captionWidget, String msg, MessageType messageType, List<Button> extraButtons, String containerStyle) { ensureImages();//from www. j av a 2 s.c o m HorizontalAlignmentConstant align = messageType == MessageType.ERROR ? HasHorizontalAlignment.ALIGN_LEFT : HasHorizontalAlignment.ALIGN_CENTER; if (dialogBox != null) { dialogBox.hide(); } String title = CommonUtils.friendlyConstant(messageType); dialogBox = new GlassDialogBox(); dialogBox.setAnimationEnabled(dialogAnimationEnabled); AbstractImagePrototype aip = null; String text = ""; switch (messageType) { case INFO: aip = AbstractImagePrototype.create(images.info()); text = "Information"; break; case WARN: aip = AbstractImagePrototype.create(images.warning()); text = "Warning"; break; case ERROR: aip = AbstractImagePrototype.create(images.error()); text = "Problem notification"; break; } dialogBox.setText(text); FlexTable ft = new FlexTable(); containerStyle = containerStyle != null ? containerStyle : (messageType == MessageType.ERROR || !CommonUtils.isNullOrEmpty(msg)) ? "medium" : "narrow"; ft.setCellSpacing(4); ft.setStyleName("alcina-Notification"); ft.addStyleName(containerStyle); FlexCellFormatter cf = (FlexCellFormatter) ft.getCellFormatter(); ft.setWidget(0, 0, aip.createImage()); cf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); cf.setWidth(0, 0, "40px"); FlowPanel fp = new FlowPanel(); fp.setStyleName("text"); Widget capWidget = captionHTML != null ? new HTML(captionHTML) : captionWidget; if (captionHTML != null) { capWidget.setStyleName("caption"); } fp.add(capWidget); if (!CommonUtils.isNullOrEmpty(msg)) { Link nh = new Link("View detail"); nh.addStyleName("pad-5"); dialogHtml = new HTML("<span class='logboxpre'>" + msg.replace("\n", "<br>") + "</span>", true); final ScrollPanel sp = new ScrollPanel(dialogHtml); sp.setStyleName("logbox"); sp.setVisible(containerStyle.equals("wide")); nh.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { sp.setVisible(!sp.isVisible()); } }); if (LooseContext.getBoolean(ClientNotifications.CONTEXT_AUTOSHOW_DIALOG_DETAIL)) { sp.setVisible(true); } fp.add(nh); fp.add(sp); } ft.setWidget(0, 1, fp); cf.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(8); Button closeButton = new Button("Close"); hp.add(closeButton); if (extraButtons != null) { for (Button b : extraButtons) { hp.add(b); } } ft.setWidget(1, 0, hp); cf.setColSpan(1, 0, 2); cf.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogBox.setWidget(ft); dialogBox.center(); dialogBox.show(); Scheduler.get().scheduleDeferred(() -> closeButton.setFocus(true)); }