Esempio n. 1
0
  public Couple<String> setText(@Nullable final String text, @Nullable final String requestor) {
    if (StringUtil.isEmpty(text)
        && !Comparing.equal(requestor, myCurrentRequestor)
        && !EventLog.LOG_REQUESTOR.equals(requestor)) {
      return Couple.of(myInfoPanel.getText(), myCurrentRequestor);
    }

    boolean logMode = myInfoPanel.updateText(EventLog.LOG_REQUESTOR.equals(requestor) ? "" : text);
    myCurrentRequestor = logMode ? EventLog.LOG_REQUESTOR : requestor;
    return Couple.of(text, requestor);
  }
Esempio n. 2
0
 public void simulationStarted(
     int realSimID,
     String type,
     long startTime,
     long endTime,
     String timeUnitName,
     int timeUnitCount) {
   // Close any old open dialog
   closeDialog();
   statusPanel.simulationStarted(realSimID, type, startTime, endTime, timeUnitName, timeUnitCount);
   viewer.simulationStarted(realSimID, type, startTime, endTime, timeUnitName, timeUnitCount);
   setStatusMessage("Game " + realSimID + " is running");
 }
Esempio n. 3
0
 // -1, 0 if no more simulations scheduled
 public void nextSimulation(int realSimID, long startTime) {
   if (startTime > 0L) {
     StringBuffer sb = new StringBuffer();
     sb.append("Next game ");
     if (realSimID > 0) {
       sb.append(realSimID).append(' ');
     }
     sb.append("starts at ");
     statusPanel.appendTime(sb, startTime);
     setStatusMessage(sb.toString());
   } else {
     setStatusMessage("No future games scheduled");
   }
 }
Esempio n. 4
0
  public void buildGUI() {
    // Initializes frame
    JFrame frame = new JFrame("Team 610 Scouting Application");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setPreferredSize(new Dimension(1200, 900));
    frame.setResizable(false);
    frame.setLayout(null);

    // Initialize components
    buttonPanel = new ButtonPanel(this);
    paintPanel = new PaintPanel(this);
    statusPanel = new StatusPanel(this);
    scoutForm = new ScoutForm(this);
    JSeparator vertSeparator = new JSeparator(SwingConstants.VERTICAL);
    JSeparator horizSeparator = new JSeparator(SwingConstants.HORIZONTAL);
    JSeparator horizSeparatorB = new JSeparator(SwingConstants.HORIZONTAL);

    // Set component positions
    buttonPanel.setBounds(0, 650, 745, 200);
    paintPanel.setBounds(0, 0, 745, 324);
    statusPanel.setBounds(0, 328, 745, 320);
    scoutForm.setBounds(747, 0, 420, 900);
    vertSeparator.setBounds(745, 0, 2, 900);
    horizSeparator.setBounds(0, 325, 745, 2);
    horizSeparatorB.setBounds(0, 648, 745, 2);

    // Additional setup
    paintPanel.setBackgroundImage();
    paintPanel.requestFocusInWindow();

    // Adds components to the frame
    frame.getContentPane().add(buttonPanel);
    frame.getContentPane().add(paintPanel);
    frame.getContentPane().add(statusPanel);
    frame.getContentPane().add(scoutForm);
    frame.getContentPane().add(vertSeparator);
    frame.getContentPane().add(horizSeparator);
    frame.getContentPane().add(horizSeparatorB);

    // Pack frame
    frame.pack();

    // Make frame visible
    frame.setVisible(true);
  }
Esempio n. 5
0
 public void updateStatusPanel(DetailPanel contributionPanel) {
   statusPanel.update(contributionPanel);
 }
Esempio n. 6
0
  private void buildInInlineIndicator(@NotNull final InlineProgressIndicator inline) {
    removeAll();
    setLayout(new InlineLayout());
    add(myRefreshAndInfoPanel);

    final JPanel inlinePanel = new JPanel(new BorderLayout());

    inline.getComponent().setBorder(new EmptyBorder(1, 0, 0, 2));
    final JComponent inlineComponent = inline.getComponent();
    inlineComponent.setOpaque(false);
    inlinePanel.add(inlineComponent, BorderLayout.CENTER);

    // myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
    inlinePanel.add(myProgressIcon, BorderLayout.WEST);

    inline.updateProgressNow();
    inlinePanel.setOpaque(false);

    add(inlinePanel);

    myRefreshAndInfoPanel.revalidate();
    myRefreshAndInfoPanel.repaint();

    if (UISettings.getInstance().PRESENTATION_MODE) {
      final JRootPane pane = myInfoPanel.getRootPane();
      final RelativePoint point = new RelativePoint(pane, new Point(pane.getWidth() - 250, 60));
      final PresentationModeProgressPanel panel = new PresentationModeProgressPanel(inline);
      final MyInlineProgressIndicator delegate =
          new MyInlineProgressIndicator(true, inline.getInfo(), inline) {
            @Override
            protected void updateProgress() {
              super.updateProgress();
              panel.update();
            }
          };

      Disposer.register(inline, delegate);

      JBPopupFactory.getInstance()
          .createBalloonBuilder(panel.getRootPanel())
          .setFadeoutTime(0)
          .setFillColor(Gray.TRANSPARENT)
          .setShowCallout(false)
          .setBorderColor(Gray.TRANSPARENT)
          .setBorderInsets(new Insets(0, 0, 0, 0))
          .setAnimationCycle(0)
          .setCloseButtonEnabled(false)
          .setHideOnClickOutside(false)
          .setDisposable(inline)
          .setHideOnFrameResize(false)
          .setHideOnKeyOutside(false)
          .setBlockClicksThroughBalloon(true)
          .setHideOnAction(false)
          .createBalloon()
          .show(
              new PositionTracker<Balloon>(pane) {
                @Override
                public RelativePoint recalculateLocation(Balloon object) {
                  final EditorComponentImpl editorComponent =
                      UIUtil.findComponentOfType(pane, EditorComponentImpl.class);
                  if (editorComponent != null) {
                    return new RelativePoint(
                        editorComponent.getParent().getParent(),
                        new Point(
                            editorComponent.getParent().getParent().getWidth() - 150,
                            editorComponent.getParent().getParent().getHeight() - 70));
                  }
                  return point;
                }
              },
              Balloon.Position.above);
    }
  }
Esempio n. 7
0
 public void simulationStopped(int realSimID) {
   setStatusMessage("Game " + realSimID + " has finished");
   statusPanel.simulationStopped(realSimID);
   viewer.simulationStopped(realSimID);
 }
Esempio n. 8
0
 /**
  * ******************************************************************* ViewerConnection API
  * ********************************************************************
  */
 public void nextTimeUnit(int timeUnit) {
   statusPanel.nextTimeUnit(timeUnit);
   viewer.nextTimeUnit(timeUnit);
 }
Esempio n. 9
0
 public void updateStatus() {
   for (StatusPanel panel : statusPanels) {
     panel.updateStatus();
   }
 }