Java 类com.google.gwt.user.client.Timer 实例源码

项目:empiria.player    文件:NavigationButtonModule.java   
@Override
public void onPlayerEvent(PlayerEvent event) {
    if (testMode) {
        return;
    }

    if (event.getType() == PAGE_LOADED) {
        Timer timer = new Timer() {
            @Override
            public void run() {
                setEnabled(!isEnd());
                setStyleName();
            }
        };
        timer.schedule(300);
    } else if (event.getType() == BEFORE_FLOW) {
        setEnabled(false);
        setStyleName();
    }
}
项目:empiria.player    文件:VideoControlHideTimer.java   
@Inject
public VideoControlHideTimer(@Assisted VideoFullScreenView view, EventsBus eventsBus) {
    this.view = view;
    this.eventsBus = eventsBus;
    view.getContainer().addDomHandler(this, TouchEndEvent.getType());
    view.getContainer().addDomHandler(this, ClickEvent.getType());
    view.getContainer().addDomHandler(this, MouseMoveEvent.getType());
    controlsHideTimer = new Timer() {

        @Override
        public void run() {
            hideCotrols();
        }
    };
    controlsHideTimer.schedule(CONTROLS_SHOW_TIME);
}
项目:unitimes    文件:CurriculumProjectionRulesPage.java   
public MyFlexTable() {
    super();
    setCellPadding(2);
    setCellSpacing(0);
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);
    sinkEvents(Event.ONCLICK);
    sinkEvents(Event.ONKEYDOWN);
    setStylePrimaryName("unitime-MainTable");
    iTimer = new Timer() {
        @Override
        public void run() {
            saveOrder();
        }
    };
}
项目:unitimes    文件:HorizontalPanelWithHint.java   
public HorizontalPanelWithHint(Widget hint) {
    super();
    iHint = new PopupPanel();
    iHint.setWidget(hint);
    iHint.setStyleName("unitime-PopupHint");
    sinkEvents(Event.ONMOUSEOVER);
    sinkEvents(Event.ONMOUSEOUT);
    sinkEvents(Event.ONMOUSEMOVE);
    iShowHint = new Timer() {
        @Override
        public void run() {
            iHint.show();
        }
    };
    iHideHint = new Timer() {
        @Override
        public void run() {
            iHint.hide();
        }
    };
}
项目:unitimes    文件:EventAdd.java   
public CourseRelatedObjectsTable(AcademicSessionProvider session) {
    iSession = session;
    setStyleName("unitime-EventOwners");

    List<Widget> header = new ArrayList<Widget>();
    header.add(new UniTimeTableHeader(MESSAGES.colSubject()));
    header.add(new UniTimeTableHeader(MESSAGES.colCourseNumber()));
    header.add(new UniTimeTableHeader(MESSAGES.colConfigOrSubpart()));
    header.add(new UniTimeTableHeader(MESSAGES.colClassNumber()));
    header.add(new UniTimeTableHeader("&nbsp;"));

    addRow(null, header);

    iChangeTimer = new Timer() {
        @Override
        public void run() {
            List<RelatedObjectInterface> value = getValue();
            if (iLastChange != null && iLastChange.equals(value)) return;
            iLastChange = value;
            ValueChangeEvent.fire(CourseRelatedObjectsTable.this, value);
        }
    };
}
项目:unitimes    文件:MobileNotifications.java   
protected void addNotification(final Notification notification) {
    for (Iterator<Notification> i = iNotifications.iterator(); i.hasNext(); ) {
        Notification n = i.next();
        if (n.getText().equals(notification.getText())) {
            i.remove();
        }
    }
    iNotifications.add(notification);
    populate("slideup");

    Timer timer = new Timer() {
        @Override
        public void run() {
            iNotifications.remove(notification);
            populate(null);
        }
    };
    timer.schedule(10000);
}
项目:unitimes    文件:UniTimePageHeader.java   
private UniTimePageHeader() {
    iHeader = new PageHeader();

    getLeft().setCallback(new Callback() {
        @Override
        public void execute(Callback callback) {
            reloadSolverInfo(true, callback);
        }
    });

    reloadSessionInfo();
    reloadUserInfo();
    iTimer = new Timer() {
        @Override
        public void run() {
            reloadSolverInfo(getLeft().isPopupShowing(), null);
        }
    };
    iTimer.schedule(1000);
}
项目:optashift-employee-rostering    文件:Calendar.java   
private Calendar(Integer tenantId, Fetchable<Collection<I>> dataProvider, Fetchable<List<G>> groupProvider,
        DataProvider<G,
                I> instanceCreator, SyncBeanManager beanManager) {
    this.beanManager = beanManager;
    this.tenantId = tenantId;

    shifts = new HashMap<>();
    didTenantChange = true;

    setInstanceCreator(instanceCreator);
    setGroupProvider(groupProvider);
    setDataProvider(dataProvider);

    timer = new Timer() {

        @Override
        public void run() {
            forceUpdate();
        }
    };

    refresh();

}
项目:appinventor-extensions    文件:EditorManager.java   
/**
 * Creates the editor manager.
 */
public EditorManager() {
  openProjectEditors = Maps.newHashMap();

  dirtyProjectSettings = new HashSet<ProjectSettings>();
  dirtyFileEditors = new HashSet<FileEditor>();

  autoSaveTimer = new Timer() {
    @Override
    public void run() {
      // When the timer goes off, save all dirtyProjectSettings and
      // dirtyFileEditors.
      Ode.getInstance().lockScreens(true); // Lock out changes
      saveDirtyEditors(new Command() {
          @Override
          public void execute() {
            Ode.getInstance().lockScreens(false); // I/O finished, unlock
          }
        });
    }
  };
}
项目:gwt-promptly    文件:DemoUI.java   
private void executeCommandPause(final PromptlyPanel panel) {
   panel.setBlockingHyperlinks(true);
   panel.append("Pausing for 3 seconds (all input ignored) ....");
   panel.setCommandLineMode(false /* is command line mode */, false /* is collect key events */, false /* is collect mouse events */);

   Timer t = new Timer() {

      @Override
      public void run() {
         panel.append("... and we are back !");
         panel.setBlockingHyperlinks(false);
         panel.setCommandLineMode(true /* is command line mode */, true /* is collect key events */, true /* is collect mouse events */);
      }
   };

   t.schedule(3000);
}
项目:gwt-history    文件:HistoryTest.java   
/** Verify that no events are issued via newItem if there were not reqeuested. */
public void testNoEvents() {
  delayTestFinish(5000);

  addHistoryListenerImpl(event -> fail("onHistoryChanged should not have been called"));

  History.newItem("testNoEvents", false);

  timer =
      new Timer() {
        @Override
        public void run() {
          finishTest();
        }
      };
  timer.schedule(500);
}
项目:gwt-history    文件:HistoryTest.java   
/**
 * Test to make sure that there is no double unescaping of hash values. See
 * https://bugzilla.mozilla.org/show_bug.cgi?id=483304
 */
@DoNotRunWith(Platform.HtmlUnitUnknown)
public void testNoDoubleTokenUnEscaping() {
  final String shouldBeEncoded = "abc%20abc";

  delayTestFinish(5000);

  History.newItem(shouldBeEncoded);
  History.newItem("someOtherToken");
  History.back();
  // allow browser to update the url
  timer =
      new Timer() {
        @Override
        public void run() {
          // make sure that value in url actually matches the original token
          assertEquals(shouldBeEncoded, History.getToken());
          finishTest();
        }
      };
  timer.schedule(200);
}
项目:LAS    文件:Print.java   
public static void it(String html) {
try {
    buildFrame(html);

    if (USE_TIMER) {
    Timer timer = new Timer() {
        public void run() {
            printFrame();
        }
        };
    timer.schedule(TIMER_DELAY * 1000);
    } else {
    DeferredCommand.addCommand(new Command() {
        public void execute() {
            printFrame();
        }
        });
    }

} catch (Throwable exc) {
    Window.alert(exc.getMessage());
}
   }
项目:gwt-material-patterns    文件:GoogleDriveView.java   
@Inject
GoogleDriveView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));
    splash.show();
    Timer t = new Timer() {
        @Override
        public void run() {
            splash.hide();
        }
    };
    t.schedule(5000);
    search.addCloseHandler(event -> {
        appNav.setVisible(true);
        searchNav.setVisible(false);
    });
    search.addKeyUpHandler(event -> {
        List<DriveDTO> filteredFiles = DataHelper.getAllDrives().stream().filter(dto -> dto.getFileName().toLowerCase().contains(search.getText().toLowerCase())).collect(Collectors.toList());
        populateFiles(filteredFiles);
    });
    populateFiles(DataHelper.getAllDrives());
}
项目:gwt-material-patterns    文件:GoogleContactsView.java   
@Inject
GoogleContactsView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));
    splash.show();
    Timer t = new Timer() {
        @Override
        public void run() {
            splash.hide();
        }
    };
    t.schedule(5000);
    search.addCloseHandler(event -> {
        appNav.setVisible(true);
        searchNav.setVisible(false);
    });
    search.addKeyUpHandler(event -> {
        List<UserDTO> filteredUser = DataHelper.getAllUsers().stream().filter(dto -> dto.getName().toLowerCase().contains(search.getText().toLowerCase())).collect(Collectors.toList());
        populateUsers(filteredUser);
    });
    populateUsers(DataHelper.getAllUsers());
}
项目:document-management-system    文件:TabFolderWorkflow.java   
@Override
public void onChange(FolderEventConstant event) {
    if (event.equals(HasFolderEvent.FOLDER_CHANGED)) {
        Workflow.get().setTabFolderSelected();
        workflowManager.findProcessInstancesByNode(Workflow.get().getUuid());
    } else if (event.equals(HasFolderEvent.TAB_CHANGED)) {
        if (TabFolderComunicator.isWidgetExtensionVisible(this)) {
            Timer timer = new Timer() {
                @Override
                public void run() {
                    workflowManager.fillWidth();
                }
            };
            timer.schedule(100);
        }
    }
}
项目:document-management-system    文件:TabDocumentWorkflow.java   
@Override
public void onChange(DocumentEventConstant event) {
    if (event.equals(HasDocumentEvent.DOCUMENT_CHANGED)) {
        Workflow.get().setTabDocumentSelected();
        workflowManager.findProcessInstancesByNode(Workflow.get().getUuid());
    } else if (event.equals(HasDocumentEvent.TAB_CHANGED)) {
        if (TabDocumentComunicator.isWidgetExtensionVisible(this)) {
            Timer timer = new Timer() {
                @Override
                public void run() {
                    workflowManager.fillWidth();
                }
            };
            timer.schedule(100);
        }
    }
}
项目:document-management-system    文件:TabMailWorkflow.java   
@Override
public void onChange(MailEventConstant event) {
    if (event.equals(HasMailEvent.MAIL_CHANGED)) {
        Workflow.get().setTabMailSelected();
        workflowManager.findProcessInstancesByNode(Workflow.get().getUuid());
    } else if (event.equals(HasMailEvent.TAB_CHANGED)) {
        if (TabMailComunicator.isWidgetExtensionVisible(this)) {
            Timer timer = new Timer() {
                @Override
                public void run() {
                    workflowManager.fillWidth();
                }
            };
            timer.schedule(100);
        }
    }
}
项目:document-management-system    文件:MsgPopup.java   
/**
 * logout
 */
private void logout(final HTML countDown, final int seconds) {
    Timer timer = new Timer() {
        @Override
        public void run() {
            countDown.setHTML(Main.i18n("ui.logout") + " " + secondsToHTML(seconds));

            if (seconds > 1) {
                logout(countDown, seconds - 1);
            } else {
                hide();
                Main.get().logoutPopup.logout();
            }
        }
    };

    timer.schedule(1000);
}
项目:document-management-system    文件:LogoutPopup.java   
/**
 * logoutAfterChat();
 */
private void logoutAfterChat() {
    Timer timer = new Timer() {
        @Override
        public void run() {
            if (!Main.get().mainPanel.bottomPanel.userInfo.isPendingToClose()) {
                authService.logout(callbackLogout);
            } else {
                logoutAfterChat();
            }
        }
    };

    timer.schedule(100); // Each minute seconds refreshing connected users
    Log.debug("Logout: void");
}
项目:document-management-system    文件:ChatRoomPopup.java   
/**
 * refreshUsersInRoom()
 */
private void refreshUsersInRoom(final String room) {
    if (chatRoomActive) {
        chatService.usersInRoom(room, new AsyncCallback<String>() {

            @Override
            public void onSuccess(String result) {
                usersInRoomText.setHTML("(" + result + ") " + Main.i18n("chat.users.in.room"));
                Timer timer = new Timer() {
                    @Override
                    public void run() {
                        refreshUsersInRoom(room);
                    }
                };

                timer.schedule(DELAY_USERS_IN_ROOM);
            }

            @Override
            public void onFailure(Throwable caught) {
                Main.get().showError("UsersInRoom", caught);
            }
        });
    }
}
项目:document-management-system    文件:FuturamaWalking.java   
/**
 * Evaluate
 */
public void evaluate(String name) {
    if (name.equals("futurama")) {
        left = -180;
        top = Window.getClientHeight() - 80 - 21;
        show();
        setPopupPosition(left, top);

        move = new Timer() {
            public void run() {
                left += 2;
                setPopupPosition(left, top);

                if (left < Window.getClientWidth() + 180) {
                    move.schedule(40);
                } else {
                    move.cancel();
                    hide();
                }
            }
        };

        move.schedule(40);
    }
}
项目:cuba    文件:CubaFileDownloaderConnector.java   
public void downloadFileById(String resourceId) {
    final String url = getResourceUrl(resourceId);
    if (url != null && !url.isEmpty()) {
        final IFrameElement iframe = Document.get().createIFrameElement();

        Style style = iframe.getStyle();
        style.setVisibility(Style.Visibility.HIDDEN);
        style.setHeight(0, Style.Unit.PX);
        style.setWidth(0, Style.Unit.PX);

        iframe.setFrameBorder(0);
        iframe.setTabIndex(-1);
        iframe.setSrc(url);
        RootPanel.getBodyElement().appendChild(iframe);

        Timer removeTimer = new Timer() {
            @Override
            public void run() {
                iframe.removeFromParent();
            }
        };
        removeTimer.schedule(60 * 1000);
    }
}
项目:Wiab.pro    文件:SearchPresenter.java   
SearchPresenter(TimerService scheduler, Search search,
    SearchesService searchPatternsService,
    SearchPanelView searchUi, WaveActionHandler actionHandler,
    SearchesModifyHandler searchesModifyHandler) {
  this.search = search;
  this.searchesService = searchPatternsService;
  this.searchUi = searchUi;
  this.scheduler = scheduler;
  this.actionHandler = actionHandler;
  this.searchesModifyHandler = searchesModifyHandler;

  digestsUpdateTimer = new Timer() {

    @Override
    public void run() {
      digestUis.each(new IdentityMap.ProcV<DigestView, Digest>() {

        @Override
        public void apply(DigestView digestView, Digest digest) {
          digestView.update();
        }
      });
    }
  };
}
项目:ontobrowser    文件:HistoryPopup.java   
@Override
public void onKeyDown(KeyDownEvent event) {
    int keyCode = event.getNativeKeyCode();
    if((keyCode == KEY_BACKSPACE || keyCode >= KEY_DELETE) 
            && keyCode != 91 && keyCode != 93) { // Command/Window keyboard keys
        cancelTimer();
        timer = new Timer() {
            public void run() {
                dataProvider.setFilter(filterTextBox.getValue());
            }
        };

        timer.schedule(TIMEOUT);
    } else if(keyCode == KEY_ENTER) {
        cancelTimer();
        dataProvider.setFilter(filterTextBox.getValue());
    }
}
项目:ontobrowser    文件:ApproveRejectComposite.java   
@Override
public void onKeyDown(KeyDownEvent event) {
    int keyCode = event.getNativeKeyCode();
    if((keyCode == KEY_BACKSPACE || keyCode >= KEY_DELETE) 
            && keyCode != 91 && keyCode != 93) { // Command/Window keyboard keys
        cancelTimer();
        timer = new Timer() {
            public void run() {
                dataProvider.setFilter(filterTextBox.getValue());
            }
        };

        timer.schedule(TIMEOUT);
    } else if(keyCode == KEY_ENTER) {
        cancelTimer();
        dataProvider.setFilter(filterTextBox.getValue());
    }
}
项目:umlet    文件:Notification.java   
private static void fade(final Element element, final float startOpacity, final float endOpacity, final int totalTimeMillis) {
    final int numberOfSteps = 30;
    int stepLengthMillis = totalTimeMillis / numberOfSteps;
    stepCount = 0;
    final float deltaOpacity = (endOpacity - startOpacity) / numberOfSteps;
    timerFader = new Timer() {
        @Override
        public void run() {
            float opacity = startOpacity + stepCount * deltaOpacity;
            DOM.setStyleAttribute(element, "opacity", Float.toString(opacity));

            stepCount++;
            if (stepCount == numberOfSteps) {
                DOM.setStyleAttribute(element, "opacity", Float.toString(endOpacity));
                cancel();
            }
        }
    };
    timerFader.scheduleRepeating(stepLengthMillis);
}
项目:playn    文件:WebGLDemo.java   
@Override
public void onModuleLoad() {
  canvas = Document.get().createElement("canvas").cast();
  Document.get().getBody().appendChild(canvas);
  canvas.setWidth(CANVAS_WIDTH);
  canvas.setHeight(CANVAS_HEIGHT);

  gl = WebGLRenderingContext.getContext(canvas);
  gl.viewport(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);

  init();

  new Timer() {
    @Override
    public void run() {
      draw();
    }
  }.scheduleRepeating(100);
}
项目:firefly    文件:IrsaCatalogTask.java   
private void handleBackgrounding(final MonitorItem monItem) {
    DefaultWorkingWidget working= new DefaultWorkingWidget((ClickHandler)null);
    working.setText("Backgrounding...");
    final MaskPane maskPane = new MaskPane(getMaskWidget(), working);
    maskPane.show();
    Timer t= new Timer() {
        @Override
        public void run() {
            BackgroundMonitor monitor= Application.getInstance().getBackgroundMonitor();
            if (doAnimation) {
                Application.getInstance().getBackgroundManager().animateToManager(_animationX, _animationY, 1300);
            }
            monItem.setWatchable(true);
            monItem.setImmediately(showImmediately);
            monitor.addItem(monItem);
            _response.status(CatalogSearchResponse.RequestStatus.BACKGROUNDING);
            maskPane.hide();
        }
    };
    t.schedule(1000);
}
项目:listmaker    文件:ItemsTable.java   
protected void expando(final FlowPanel div2, final DivElement[] notes)
{
    Timer t = new Timer()
    {
        int i = 0;
        final int last = notes.length;

        @Override
        public void run()
        {
            if (i >= last)
                this.cancel();
            else
                div2.getElement().appendChild(notes[i++]);
        }
    };
    // Eye candy
    t.scheduleRepeating(10);
}
项目:gwt-material    文件:MaterialToastTest.java   
public void testToastWithCallback() {
    final boolean[] isCallbackFired = new boolean[1];
    new MaterialToast(() -> {
        isCallbackFired[0] = true;
    }).toast("callback", 1000);
    Timer t = new Timer() {
        @Override
        public void run() {
            assertTrue(isCallbackFired[0]);
        }
    };
    t.schedule(1000);
    Element toastContainer = $("body").find("#toast-container").asElement();
    assertNotNull(toastContainer);
    toastContainer.setInnerHTML("");
}
项目:forplay    文件:WebGLDemo.java   
@Override
public void onModuleLoad() {
  canvas = Document.get().createElement("canvas").cast();
  Document.get().getBody().appendChild(canvas);
  canvas.setWidth(CANVAS_WIDTH);
  canvas.setHeight(CANVAS_HEIGHT);

  gl = WebGLRenderingContext.getContext(canvas);
  gl.viewport(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);

  init();

  new Timer() {
    @Override
    public void run() {
      draw();
    }
  }.scheduleRepeating(100);
}
项目:guava-libraries    文件:MapMaker.java   
private void scheduleRemoval(final K key, final V value) {
  // from MapMaker
  /*
   * TODO: Keep weak reference to map, too. Build a priority queue out of the entries themselves
   * instead of creating a task per entry. Then, we could have one recurring task per map (which
   * would clean the entire map and then reschedule itself depending upon when the next
   * expiration comes). We also want to avoid removing an entry prematurely if the entry was set
   * to the same value again.
   */
  Timer timer = new Timer() {
    @Override
    public void run() {
      remove(key, value);
    }
  };
  timer.schedule((int) expirationMillis);
}
项目:wbi    文件:SeriesView.java   
/**
 * Set whether scrollbars are enabled.
 *
 * @param enabled Whether scrollbars are enabled.
 */
public void setScrollEnabled(final boolean enabled) {
    final Element element = getElement();
    boolean scrollEnabled = element.hasClassName(CLASS_NAME_SCROLL);

    if ((scrollEnabled && !enabled) || (!scrollEnabled && enabled)) {
        if (enabled) {
            (new Timer() {
                @Override
                public void run() {
                    element.addClassName(CLASS_NAME_SCROLL);
                }
            }).schedule(SCROLL_DELAY);
        } else {
            element.removeClassName(CLASS_NAME_SCROLL);
        }
    }
}
项目:che    文件:DelayableWebSocketConnection.java   
@Override
public void open() {
  final int delay = propertyManager.getConnectionDelay(url);

  if (isClosed() || isClosing()) {
    if (delay == 0) {
      webSocketJsoWrapper = WebSocketJsoWrapper.connect(url, endpoint);
    } else {
      new Timer() {
        @Override
        public void run() {
          webSocketJsoWrapper = WebSocketJsoWrapper.connect(url, endpoint);
        }
      }.schedule(delay);
    }
  } else {
    Log.warn(getClass(), "Opening already opened or connecting web socket.");
  }
}
项目:che    文件:PopupLoaderImpl.java   
@Override
public void setSuccess() {
  // Stop animation timer
  playTimer.cancel();

  // Start hide animation
  getElement().addClassName("outDown");

  // Remove from the parent
  new Timer() {
    @Override
    public void run() {
      removeFromParent();
    }
  }.schedule(1000);
}
项目:che    文件:TooltipHint.java   
private void close() {
  opacity = 10;

  // Hide animation
  new Timer() {
    @Override
    public void run() {
      opacity--;
      if (opacity <= 0) {
        cancel();
        getElement().getParentElement().removeChild(getElement());
      } else {
        getElement().getStyle().setProperty("opacity", "0." + opacity);
      }
    }
  }.scheduleRepeating(50);
}
项目:che    文件:FullTextSearchViewImpl.java   
@Override
public void showDialog() {
  acceptButton.setEnabled(false);
  isUseFileMask.setValue(false);
  filesMask.setEnabled(false);
  isUseDirectory.setValue(false);
  wholeWordsOnly.setValue(false);
  directory.setEnabled(false);
  selectPathButton.setEnabled(false);
  directory.setText("");
  filesMask.setText("*.*");
  directory.setText("/");
  errLabel.setText("");

  new Timer() {
    @Override
    public void run() {
      text.setFocus(true);
    }
  }.schedule(100);

  super.show();
}
项目:che    文件:OpenFileAction.java   
private void scrollToLine(EditorPartPresenter editor, String lineParam) {
  if (!(editor instanceof TextEditor)) {
    return;
  }
  new Timer() {
    @Override
    public void run() {
      try {
        int lineNumber = parseInt(lineParam);
        TextEditor textEditor = (TextEditor) editor;
        textEditor.getDocument().setCursorPosition(new TextPosition(lineNumber - 1, 0));
      } catch (NumberFormatException e) {
        Log.error(getClass(), localization.fileToOpenLineIsNotANumber());
      }
    }
  }.schedule(300);
}
项目:viaja-facil    文件:M.java   
private void showSelectFromMap() {
    if(!showedSelectFromMapOnce) {
        showedSelectFromMapOnce = true;
        final DecoratedPopupPanel simplePopup = new DecoratedPopupPanel(true);
        simplePopup.setWidth("150px");
        simplePopup.setWidget(new HTML(CONSTANTS.selectFromMap()));
        simplePopup.addStyleName("popup");
        simplePopup.center();
        Timer t = new Timer() {
            public void run() {
                simplePopup.hide();
            }
        };
        t.schedule(2000);
    }
}