Example usage for com.google.gwt.user.client Timer schedule

List of usage examples for com.google.gwt.user.client Timer schedule

Introduction

In this page you can find the example usage for com.google.gwt.user.client Timer schedule.

Prototype

public synchronized void schedule(int delayMs) 

Source Link

Document

Schedules a timer to elapse in the future.

Usage

From source file:org.jboss.seam.example.ticketmonster.client.categories.CategoryList.java

License:Apache License

public CategoryList() {
    super(new BoxLayout(BoxLayout.Orientation.VERTICAL));
    setPadding(0);/*from   w w w . j a  va 2 s. c o m*/

    // toolbar
    final ToolBar toolBar = new ToolBar();
    ClickHandler clickHandler = new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            refresh();
        }
    };

    toolBar.add(new Button("Refresh", clickHandler));
    toolBar.addSeparator();
    toolBar.add(new Button("New Category", new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            newCategory();
        }
    }));

    // listbox
    listBox = createListBox();

    // assembly
    this.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
    this.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));

    // register with bus
    bus.subscribe("CategoryList", this);

    Timer t = new Timer() {
        @Override
        public void run() {
            refresh();
        }
    };

    t.schedule(150);

}

From source file:org.jboss.seam.example.ticketmonster.client.events.EventList.java

License:Apache License

public EventList() {
    super();//w  w w.  j av  a 2  s.com
    setPadding(0);

    LayoutPanel listing = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
    listing.setPadding(0);

    // ------------------------------------

    // toolbar
    final ToolBar toolBar = new ToolBar();
    ClickHandler clickHandler = new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            refresh();
        }
    };

    toolBar.add(new Button("Refresh", clickHandler));
    toolBar.addSeparator();
    toolBar.add(new Button("New Event", new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            newEvent();
        }
    }));

    // listbox
    listBox = createListBox();

    // ------------------------------------

    toolBox = new LayoutPanel();
    toolBox.setPadding(0);
    toolBox.setWidgetSpacing(0);
    toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));
    toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));

    // filter
    LayoutPanel filterPanel = new LayoutPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
    filterPanel.setStyleName("mosaic-ToolBar");
    dropBox = new com.google.gwt.user.client.ui.ListBox(false);
    dropBox.getElement().setAttribute("style", "font-size:10px;");
    dropBox.addItem("Select a category:");

    dropBox.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            refresh();
        }
    });
    filterPanel.add(dropBox);

    toolBox.add(filterPanel, new BoxLayoutData(BoxLayoutData.FillStyle.VERTICAL));

    // ------------------------------------

    // assembly
    listing.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
    listing.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));

    this.add(listing);

    // register with bus
    bus.subscribe("EventList", this);

    Timer t = new Timer() {
        @Override
        public void run() {
            init();
        }
    };

    t.schedule(150);

}

From source file:org.kaaproject.avro.ui.gwt.client.widget.FormPopup.java

License:Apache License

@Override
public void show() {
    if (resizeHandlerRegistration == null) {
        resizeHandlerRegistration = Window.addResizeHandler(new ResizeHandler() {
            public void onResize(ResizeEvent event) {
                windowWidth = event.getWidth();
            }//  w w w .  j a  va 2  s  .co m
        });
    }
    Timer timer = new Timer() {
        public void run() {
            getElement().getStyle().setProperty("clip", "auto");
        }
    };
    timer.schedule(300);

    super.show();
}

From source file:org.kie.workbench.common.stunner.core.client.canvas.util.CanvasHighlightVisitor.java

License:Apache License

private void animate(final int index, final Command callback) {
    if (index < shapes.size()) {
        final Shape shape = shapes.get(index);
        shape.applyState(ShapeState.HIGHLIGHT);
        final Timer t = new Timer() {

            @Override//from   ww w. ja  va  2  s .  co  m
            public void run() {
                animate(index + 1, callback);
            }
        };
        t.schedule(TIMER_DELAY);
    } else {
        callback.execute();
    }
}

From source file:org.kie.workbench.common.stunner.core.client.canvas.util.CanvasLayoutUtils.java

License:Apache License

public static void fireElementSelectedEvent(final Event<CanvasSelectionEvent> selectionEvent,
        final CanvasHandler canvasHandler, final String uuid) {
    canvasHandler.getCanvas().getLayer().disableHandlers();
    selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, uuid));
    final Timer t = new Timer() {
        @Override//from   w w  w  . ja  v a 2 s  .co m
        public void run() {
            canvasHandler.getCanvas().getLayer().enableHandlers();
        }
    };
    t.schedule(500);
}

From source file:org.kie.workbench.common.stunner.core.client.components.toolbox.actions.AbstractToolboxAction.java

License:Apache License

public static void fireElementSelectedEvent(final Event<CanvasSelectionEvent> selectionEvent,
        final AbstractCanvasHandler canvasHandler, final String uuid) {
    canvasHandler.getCanvas().getLayer().disableHandlers();
    selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, uuid));
    final Timer t = new Timer() {
        @Override//from   w ww  .j a v  a2 s .c o  m
        public void run() {
            canvasHandler.getCanvas().getLayer().enableHandlers();
        }
    };
    t.schedule(500);
}

From source file:org.kie.workbench.common.stunner.core.client.util.CanvasHighlightVisitor.java

License:Apache License

private void animate(final int index, final Command callback) {

    if (index < shapes.size()) {

        final Shape shape = shapes.get(index);

        shape.applyState(ShapeState.HIGHLIGHT);

        final Timer t = new Timer() {

            @Override// w w  w.  j av  a 2 s. c  o  m
            public void run() {

                animate(index + 1, callback);

            }

        };

        t.schedule(TIMER_DELAY);

    } else {

        callback.execute();

    }

}

From source file:org.kuali.continuity.admin.main.client.ListControl.java

License:Educational Community License

void flashDone() {
    showDone(true);/*from ww  w .ja va  2  s.c  o m*/
    Timer t = new Timer() {
        public void run() {
            showDone(false);
        }

    };

    // delay running for 2 seconds
    t.schedule(2000);
}

From source file:org.kuali.student.core.statement.ui.client.widgets.rules.RuleTableManipulationWidget.java

License:Educational Community License

private void showRuleBeforeSimplify(StatementVO unsimplified) {
    rule.setStatementVO(unsimplified);//from  ww  w .  java  2 s.  com
    rule.setSimplifying(true);
    redraw(rule.getStatementVO().getStatementTreeViewInfo(), false, false);
    // sleep for a while to show the user how the rule looks like before simplification
    Timer simplifyingTimer = new Timer() {
        public void run() {
            rule.setSimplifying(false);
            rule.setStatementVO(rule.getEditHistory().getLastHistoricStmtVO());
            redraw(rule.getStatementVO().getStatementTreeViewInfo(), false, true);
        }
    };
    simplifyingTimer.schedule(1000);
}