Example #1
0
  /**
   * Handling MouseOver event.
   *
   * @param tr - element to be processed.
   */
  protected void onRowHovered(Element tr) {
    if (tr == hoveredTR) {
      return;
    }

    setStyleNormal(hoveredTR);
    if (subPopupAnchor != null) {
      setStyleHovered(subPopupAnchor);
    }

    if (!isRowEnabled(tr)) {
      hoveredTR = null;
      return;
    }

    hoveredTR = tr;
    setStyleHovered(tr);

    int itemIndex = Integer.parseInt(tr.getAttribute("item-index"));
    Action menuItem = list.get(itemIndex);
    openSubPopupTimer.cancel();
    if (menuItem instanceof ActionGroup
        && !(((ActionGroup) menuItem).canBePerformed()
            && !Utils.hasVisibleChildren(
                (ActionGroup) menuItem,
                presentationFactory,
                actionManager,
                managerProvider.get()))) {
      openSubPopupTimer.schedule(300);
    } else {
      closeSubPopupTimer.cancel();
      closeSubPopupTimer.schedule(200);
    }
  }
Example #2
0
  void show(int delayMilliseconds) {

    ///// transtimer

    Timer t1 =
        new Timer() {
          @Override
          public void run() {
            panel.addStyleName("notificationShowed");
            // Notification.this.setVisible(false);
            // Notification.this.removeFromParent();

          }
        };

    // Schedule the timer to close the popup in 3 seconds.
    t1.schedule(119);

    ////////////////

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

            Notification.this.setVisible(false);
            Notification.this.removeFromParent();
          }
        };

    // Schedule the timer to close the popup in 3 seconds.
    t.schedule(delayMilliseconds);
  }
  @NotNull
  private Runner launchRunner(@NotNull Runner runner) {
    if (runActionPermit.isAllowed()) {

      CurrentProject currentProject = appContext.getCurrentProject();

      if (currentProject == null) {
        throw new IllegalStateException(
            "Can't launch runner for current project. Current project is absent...");
      }

      selectedEnvironment = null;

      panelState.setState(RUNNERS);
      view.showOtherButtons();

      history.addRunner(runner);

      runnerInQueueTimer.schedule(ONE_SEC.getValue());

      CheckRamAndRunAction checkRamAndRunAction = actionFactory.createCheckRamAndRun();
      checkRamAndRunAction.perform(runner);

      runnerActions.put(runner, checkRamAndRunAction);

      runner.resetCreationTime();
      runnerTimer.schedule(ONE_SEC.getValue());
    } else {
      runActionDenyAccessDialog.show();
    }
    return runner;
  }
Example #4
0
  public void showFile(FileSystemItem file, String commitId, String contents) {
    commitId_ = commitId;
    targetFile_ = file;

    docDisplay_.setCode(contents, false);

    adaptToFileType(fileTypeRegistry_.getTextTypeForFile(file));

    // header widget has icon + label
    HorizontalPanel panel = new HorizontalPanel();

    Image imgFile = new Image(fileTypeRegistry_.getIconForFile(file));
    imgFile.addStyleName(RES.styles().captionIcon());
    panel.add(imgFile);

    Label lblCaption = new Label(file.getPath() + " @ " + commitId);
    lblCaption.addStyleName(RES.styles().captionLabel());
    panel.add(lblCaption);

    popupPanel_ = new FullscreenPopupPanel(panel, asWidget(), false);
    popupPanel_.center();

    // set focus to the doc display after 100ms
    Timer timer =
        new Timer() {
          public void run() {
            docDisplay_.focus();
          }
        };
    timer.schedule(100);
  }
  @Override
  public void getElements(final AsyncCallback<List<SignalingElement>> callback) {
    final List<SignalingElement> result = new ArrayList<SignalingElement>(3);
    SignalingElement element = new SignalingElement();
    element.setEnabled(true);
    element.setAlarm(false);
    element.setId(1);
    element.setTitle("Window sensor 1");
    element.setLabelAddress(238925926L);
    element.setKeyAddress(3457383838L);
    result.add(element);

    element = new SignalingElement();
    element.setEnabled(true);
    element.setAlarm(false);
    element.setId(2);
    element.setTitle("Window sensor 2");
    element.setLabelAddress(2381325926L);
    element.setKeyAddress(34573483838L);
    result.add(element);

    final Timer timer =
        new Timer() {
          @Override
          public void run() {
            callback.onSuccess(result);
            //                callback.onFailure(new Throwable());
          }
        };
    timer.schedule(1000);
  }
 @Override
 public void showAt(int x, int y) {
   if (disabled) return;
   lastActive = new Date();
   clearTimers();
   super.showAt(x, y);
   if (toolTipConfig.getAnchor() != null) {
     anchorEl.show();
     syncAnchor();
   } else {
     anchorEl.hide();
   }
   if (toolTipConfig.getDismissDelay() > 0
       && toolTipConfig.isAutoHide()
       && !toolTipConfig.isCloseable()) {
     dismissTimer =
         new Timer() {
           @Override
           public void run() {
             hide();
           }
         };
     dismissTimer.schedule(toolTipConfig.getDismissDelay());
   }
 }
  @Override
  public void initializePhoneGap(final int timeoutInMs) {

    final long end = System.currentTimeMillis() + timeoutInMs;
    if (isPhoneGapInitialized()) {

      firePhoneGapAvailable();

    } else {
      Timer timer =
          new Timer() {

            @Override
            public void run() {
              if (isPhoneGapInitialized()) {
                firePhoneGapAvailable();
                return;
              }

              if (System.currentTimeMillis() - end > 0) {
                handlerManager.fireEvent(new PhoneGapTimeoutEvent());
              } else {
                schedule(INIT_TICK);
              }
            }
          };

      timer.schedule(INIT_TICK);
    }
  }
Example #8
0
  public void onMessage(final Message message) {
    if (!message.isTransient()) {

      // update the visible message count
      reflectMessageCount();

      if (message.isSticky()) // sticky messages override each other like this
      {
        lastSticky = message;
        displayNotification(message);
      } else if (null == lastSticky
          || Message.Severity.Error == message.getSeverity()
          || Message.Severity.Fatal
              == message.getSeverity()) // regular message don't replace sticky ones
      {
        clearSticky();

        displayNotification(message);

        Timer hideTimer =
            new Timer() {
              @Override
              public void run() {
                // hide message
                messageDisplay.clear();
                if (displayPopup != null) displayPopup.hide();
              }
            };

        hideTimer.schedule(5000);
      }
    }
  }
  public TeachersUI() {
    setScrollMode(Scroll.AUTO);
    setId("centerPanelBackground");
    addStyleName("uiContainer");
    setHeaderVisible(false);

    image = Resources.ICONS.image();
    add(image.createImage());

    String text = "<br><center><font color='orange' size='5px'>Teachers</font></center>";
    text += "<h2>Teachers directions here </h2> ";
    label = new Label();
    label.setText(text);
    add(label);

    videoPanel = new ContentPanel();
    videoPanel.setId("jwplayer");
    videoPanel.setHeaderVisible(false);
    videoPanel.setBodyBorder(false);
    add(videoPanel);

    Timer timer =
        new Timer() {

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

    timer.schedule(50);
  }
Example #10
0
  @Inject
  public MainPanel(
      final MessagesImpl messages,
      final ConstantsImpl constants,
      final GlobalResources resources,
      final NewPostGadgetService service,
      final VegaUtils utils) {
    initWidget(uiBinder.createAndBindUi(this));
    resources.globalCSS().ensureInjected();
    this.service = service;
    this.messages = messages;
    this.constants = constants;
    this.resources = resources;
    this.utils = utils;
    //		dsAboutPnl.setHeader()
    try {
      setForumInfoIntoGadget(messages, utils);
    } catch (Exception e) {
      Log.debug(e.getMessage());
    }
    Timer timer =
        new Timer() {

          @Override
          public void run() {
            try {
              setForumInfoIntoGadget(messages, utils);
            } catch (Exception e) {
              Log.debug(e.getMessage());
            }
          }
        };
    timer.schedule(1000);
    utils.reportPageview("/newpost/");
  }
 /** Registers the given @{link ConnectivityListener}. */
 public void addConnectivityListener(ConnectivityListener listener) {
   connectivityListeners.add(listener);
   if (connectivityListeners.size() == 1) {
     createConnectivityTimers();
     contactTimer.schedule(CONTACT_REQUEST_TIMER_DELAY);
   }
 }
  /**
   * Adds already running runner.
   *
   * @param processDescriptor The descriptor of new runner
   * @return instance of new runner
   */
  @NotNull
  public Runner addRunner(@NotNull ApplicationProcessDescriptor processDescriptor) {
    RunOptions runOptions = dtoFactory.createDto(RunOptions.class);
    Runner runner = modelsFactory.createRunner(runOptions);

    String environmentId = processDescriptor.getEnvironmentId();

    if (environmentId != null && environmentId.startsWith(PROJECT_PREFIX)) {
      runner.setScope(PROJECT);
    }

    runnersId.add(processDescriptor.getProcessId());

    runner.setProcessDescriptor(processDescriptor);
    runner.setRAM(processDescriptor.getMemorySize());
    runner.setStatus(Runner.Status.DONE);
    runner.resetCreationTime();

    history.addRunner(runner);

    onSelectionChanged(RUNNER);

    runnerTimer.schedule(ONE_SEC.getValue());

    LaunchAction launchAction = actionFactory.createLaunch();
    runnerActions.put(runner, launchAction);

    launchAction.perform(runner);

    selectHistoryTab();

    return runner;
  }
Example #13
0
  public void showModal() {
    if (mainWidget_ == null) {
      mainWidget_ = createMainWidget();

      // get the main widget to line up with the right edge of the buttons.
      mainWidget_.getElement().getStyle().setMarginRight(3, Unit.PX);

      mainPanel_.insert(mainWidget_, 0);
    }

    originallyActiveElement_ = DomUtils.getActiveElement();
    if (originallyActiveElement_ != null) originallyActiveElement_.blur();

    // position the dialog
    positionAndShowDialog();

    // defer shown notification to allow all elements to render
    // before attempting to interact w/ them programatically (e.g. setFocus)
    Timer timer =
        new Timer() {
          public void run() {
            onDialogShown();
          }
        };
    timer.schedule(100);
  }
Example #14
0
  /** Test load simple association */
  protected void testLoadMessage(final Integer id) {
    // Setup an asynchronous event handler.
    Timer timer =
        new Timer() {
          public void run() {
            // Call remote loading service
            LoadingServiceAsync<Message> remoteService =
                (LoadingServiceAsync<Message>) GWT.create(LoadingService.class);
            remoteService.loadEntity(
                Message.class.getName(),
                new IntegerParameter(id),
                new AsyncCallback<Message>() {
                  public void onFailure(Throwable caught) {
                    fail(caught.toString());

                    // tell the test system the test is now done
                    finishTest();
                  }

                  public void onSuccess(Message result) {
                    assertNotNull(result);
                    assertEquals(id, Integer.valueOf(result.getId()));

                    // tell the test system the test is now done
                    finishTest();
                  }
                });
          }
        };

    // Schedule the event and return control to the test system.
    timer.schedule(100);
  }
    public void onCellOver(CellOverEvent event) {
      ListGridField gridField = AttributeListGrid.this.getField(event.getColNum());
      if (gridField.getName().equals(attributeInfo.getName())) {
        ListGridRecord record = event.getRecord();
        String value = record.getAttribute(attributeInfo.getName());
        if (event.getRowNum() != row) {
          if (img != null) {
            cleanup();
          }
          img = new Img(value);
          img.setMaxWidth(300);
          img.setMaxHeight(300);
          img.setKeepInParentRect(true);
          img.setShowEdges(true);
          img.setLeft(AttributeListGrid.this.getAbsoluteLeft() + 10);
          img.setTop(AttributeListGrid.this.getAbsoluteTop() + 10);
          img.draw();
          killTimer =
              new Timer() {

                public void run() {
                  img.destroy();
                }
              };
          killTimer.schedule(Math.round(3000));
          row = event.getRowNum();
        }
      }
    }
  @Override
  protected void onReveal() {

    Map<AlertType, String> alMap = getView().checkPermission();

    if (!alMap.isEmpty()) {
      for (Entry<AlertType, String> entry : alMap.entrySet()) {
        fireEvent(new ShowAlertEvent(entry.getKey(), entry.getValue(), false));

        getView().hideAlert(3000);
      }
    }

    Timer timer =
        new Timer() {

          @Override
          public void run() {
            boolean mineOnly = getView().getChkMineOnly().getValue();

            if (mineOnly) {
              fireEvent(
                  new ShowAlertEvent(AlertType.INFO, "You are viewing filterd content", false));
              getView().hideAlert(3000);
            }
          }
        };

    timer.schedule(3500);

    super.onReveal();
  }
  /** Tests submitting an alternate frame. TODO: Investigate intermittent failures with HtmlUnit. */
  @DoNotRunWith(Platform.HtmlUnitUnknown)
  public void testSubmitFrame() {
    System.out.println("testSubmitFrame");
    final NamedFrame frame = new NamedFrame("myFrame");
    FormPanel form = new FormPanel(frame);
    form.setMethod(FormPanel.METHOD_POST);
    form.setAction(GWT.getModuleBaseURL() + "formHandler?sendHappyHtml");
    RootPanel.get().add(form);
    RootPanel.get().add(frame);

    delayTestFinish(TEST_DELAY);
    form.submit();
    Timer t =
        new Timer() {
          @Override
          public void run() {
            // Make sure the frame got the contents we expected.
            assertTrue(isHappyDivPresent(frame.getElement()));
            finishTest();
          }
        };

    // Wait 5 seconds before checking the results.
    t.schedule(TEST_DELAY - 2000);
  }
Example #18
0
  /** Test loading of a list association */
  public void testLoadSetAssociation() {
    //	1. Load test user
    //
    // Setup an asynchronous event handler.
    Timer timer =
        new Timer() {
          public void run() {
            // Call remote init service
            StatelessInitServiceAsync remoteService =
                (StatelessInitServiceAsync) GWT.create(StatelessInitService.class);
            remoteService.loadTestUser(
                new AsyncCallback<User>() {
                  public void onFailure(Throwable caught) {
                    fail(caught.toString());
                    finishTest();
                  }

                  public void onSuccess(User result) {
                    testLoadSetAssociation(result);
                  }
                });
          }
        };

    // Set a delay period significantly longer than the
    // event is expected to take.
    delayTestFinish(60000);

    // Schedule the event and return control to the test system.
    timer.schedule(100);
  }
  /**
   * Check GeoPlatformGridWidget Status
   *
   * @param widget
   * @param title
   * @param message
   */
  public static void checkGridWidgetStatus(
      final IGeoPlatformGrid<GeoPlatformBeanModel> widget,
      final String title,
      final String message) {

    Timer timer =
        new Timer() {

          @Override
          public void run() {
            if (widget.getGrid().getView().getBody().isMasked()) {
              MessageBox.confirm(
                  title,
                  message,
                  new Listener<MessageBoxEvent>() {

                    @Override
                    public void handleEvent(MessageBoxEvent be) {
                      if (Dialog.YES.equals(be.getButtonClicked().getItemId())) {
                        widget.getGrid().getView().getBody().unmask();
                        widget.getGrid().getView().refresh(false);
                      } else {
                        schedule(15000);
                      }
                    }
                  });
            }
          }
        };
    timer.schedule(15000);
  }
Example #20
0
  /** Test load list association */
  protected void testLoadSetAssociation(final User user) {
    // Setup an asynchronous event handler.
    Timer timer =
        new Timer() {
          public void run() {
            // Call remote loading service
            LoadingServiceAsync<User> remoteService =
                (LoadingServiceAsync<User>) GWT.create(LoadingService.class);
            remoteService.loadSetAssociation(
                user,
                "messageList",
                new AsyncCallback<Set<Message>>() {
                  public void onFailure(Throwable caught) {
                    fail(caught.toString());

                    // tell the test system the test is now done
                    finishTest();
                  }

                  public void onSuccess(Set<Message> result) {
                    assertNotNull(result);
                    assertFalse(result.isEmpty());

                    // tell the test system the test is now done
                    finishTest();
                  }
                });
          }
        };

    // Schedule the event and return control to the test system.
    timer.schedule(100);
  }
Example #21
0
  public void geodecode(
      final Geocoder geo, final Triple<String, Interval, String> event, final int delay) {
    Timer t =
        new Timer() {
          public void run() {
            if (!event.get1().equals("")) {
              geo.getLatLng(
                  event.get1(),
                  new LatLngCallback() {
                    @Override
                    public void onFailure() {
                      System.out.println("Failed geocoder for   " + "---" + event + " ");
                      geodecode(geo, event, delay + 1000);
                    }

                    @Override
                    public void onSuccess(LatLng point) {
                      GeoStoryItem gsi =
                          new GeoStoryItem(event.get2(), event.get1(), point, event.get3());
                      Window.alert("Item is " + gsi);
                      types.itemAdded.shareEvent(gsi);
                      types.centerEvent.shareEvent(null);
                    }
                  });
            }
          }
        };
    t.schedule(delay);
  }
Example #22
0
  /** Test load simple association */
  protected void testLoadSimpleAssociation(final Message message) {
    // Setup an asynchronous event handler.
    Timer timer =
        new Timer() {
          public void run() {
            // Call remote loading service
            LoadingServiceAsync<Message> remoteService =
                (LoadingServiceAsync<Message>) GWT.create(LoadingService.class);
            remoteService.loadEntityAssociation(
                message,
                "author",
                new AsyncCallback<User>() {
                  public void onFailure(Throwable caught) {
                    fail(caught.toString());

                    // tell the test system the test is now done
                    finishTest();
                  }

                  public void onSuccess(User result) {
                    assertNotNull(result);

                    // tell the test system the test is now done
                    finishTest();
                  }
                });
          }
        };

    // Schedule the event and return control to the test system.
    timer.schedule(100);
  }
Example #23
0
  private void handleLockFailure(final LockInfo lockInfo) {

    if (lockInfo != null) {
      updateLockInfo(lockInfo);
      lockNotification.fire(
          new NotificationEvent(
              WorkbenchConstants.INSTANCE.lockedMessage(lockInfo.lockedBy()),
              NotificationEvent.NotificationType.INFO,
              true,
              lockTarget.getPlace(),
              20));
    } else {
      lockNotification.fire(
          new NotificationEvent(
              WorkbenchConstants.INSTANCE.lockError(),
              NotificationEvent.NotificationType.ERROR,
              true,
              lockTarget.getPlace(),
              20));
    }
    // Delay reloading slightly in case we're dealing with a flood of events
    if (reloadTimer == null) {
      reloadTimer =
          new Timer() {

            public void run() {
              reload();
            }
          };
    }

    if (!reloadTimer.isRunning()) {
      reloadTimer.schedule(250);
    }
  }
Example #24
0
 @UiHandler("clearSessionFiltersButton")
 void handleClearSessionFiltersButtonClick(ClickEvent e) {
   sessionsTo.setValue(null, true);
   sessionsFrom.setValue(null, true);
   sessionIdsTextBox.setText(null);
   stopTypingSessionIdsTimer.schedule(10);
 }
Example #25
0
 private void deferTextChangeEvent() {
   if (textChangeEventMode.equals(TEXTCHANGE_MODE_TIMEOUT) && scheduled) {
     return;
   } else {
     textChangeEventTrigger.cancel();
   }
   textChangeEventTrigger.schedule(getTextChangeEventTimeout());
   scheduled = true;
 }
Example #26
0
  private void reconcilerDocumentChanged() {
    for (String key : strategies.keySet()) {
      ReconcilingStrategy reconcilingStrategy = strategies.get(key);
      reconcilingStrategy.setDocument(documentHandle.getDocument());
    }

    autoSaveTimer.cancel();
    autoSaveTimer.schedule(DELAY);
  }
Example #27
0
 /**
  * Updates the schedule of the heartbeat to match the set interval. A negative interval disables
  * the heartbeat.
  */
 public void schedule() {
   if (interval > 0) {
     getLogger().fine("Scheduling heartbeat in " + interval + " seconds");
     timer.schedule(interval * 1000);
   } else {
     getLogger().fine("Disabling heartbeat");
     timer.cancel();
   }
 }
Example #28
0
 @Override
 public void onDocumentChange(final DocumentChangeEvent event) {
   if (documentHandle == null || !documentHandle.isSameAs(event.getDocument())) {
     return;
   }
   createDirtyRegion(event);
   autoSaveTimer.cancel();
   autoSaveTimer.schedule(DELAY);
 }
  private void drawUnifyingChartsAndTables(
      final String[] intervals,
      final HashMap<String, Integer[]> userValues,
      final boolean showCharts) {

    final String[] allNames = new String[userValues.size()];
    final Integer[] allValues = new Integer[userValues.size()];

    int index = 0;
    for (String user : userValues.keySet()) {

      allNames[index] = user;

      int sumCount = 0;
      for (int value : userValues.get(user)) {
        sumCount += value;
      }
      allValues[index++] = sumCount;
    }

    if (showCharts) {
      setHeight(userValues.size() * 30 + 280);
    } else {
      setHeight(userValues.size() * 25 + 30);
      redraw();
    }

    Timer timer =
        new Timer() {

          @Override
          public void run() {
            if (showCharts) {
              ChartUtils.drawPieChart(
                  JSOHelper.convertToJavaScriptArray(allNames),
                  JSOHelper.convertToJavaScriptArray(allValues),
                  allNames.length,
                  PIE_CHART_NESTED_DIV_ID + userId,
                  (int) (UserStatisticsLayout.this.getWidth() * PIE_SIZE_CONVERSION));

              ChartUtils.drawBarChart(
                  JSOHelper.convertToJavaScriptArray(allNames),
                  JSOHelper.convertToJavaScriptArray(allValues),
                  allNames.length,
                  LINE_CHART_NESTED_DIV_ID + userId,
                  (int) (UserStatisticsLayout.this.getWidth() * LINE_BAR_SIZE_CONVERSION));
            }
            if (table == null) {
              table = new TableListGrid(intervals, userValues);
              addMember(table);
            }
          }
        };
    timer.schedule(100);
  }
Example #30
0
 /** Dispatch a run component call async. */
 private void runComponentAsync(final Component target) {
   Timer t =
       new Timer() {
         @Override
         public void run() {
           running = target;
           target.run();
         }
       };
   t.schedule(1); // Async run this.
 }