コード例 #1
0
  /**
   * <code>init</code> - wait for instance to become displayable, determine appropriate font
   * metrics, and render the JGo navigator, and slot widgets
   *
   * <p>These functions are not done in the constructor to avoid: "Cannot measure text until a
   * JGoView exists and is part of a visible window". called by componentShown method on the JFrame
   * JGoView.setVisible( true) must be completed -- use SwingWorker in constructor
   */
  public final void init() {
    // wait for NavigatorView instance to become displayable
    if (!ViewGenerics.displayableWait(NavigatorView.this)) {
      closeView(this);
      return;
    }
    this.computeFontMetrics(this);

    jGoDocument = jGoView.getDocument();
    jGoDocument.addDocumentListener(createDocListener());
    renderInitialNode();

    NavigatorViewLayout layout = new NavigatorViewLayout(jGoDocument, startTimeMSecs);
    layout.performLayout();

    MDIInternalFrame contentFilterFrame = viewSet.getContentSpecWindow();
    int contentFilterMaxY =
        (int) (contentFilterFrame.getLocation().getY() + contentFilterFrame.getSize().getHeight());
    int delta =
        Math.min(
            ViewConstants.INTERNAL_FRAME_X_DELTA_DIV_4
                * ((PartialPlanViewSet) viewSet).getNavigatorFrameCnt(),
            (int)
                (PlanWorks.getPlanWorks().getSize().getHeight()
                    - contentFilterMaxY
                    - (ViewConstants.MDI_FRAME_DECORATION_HEIGHT * 2)));
    navigatorFrame.setLocation(
        (ViewConstants.INTERNAL_FRAME_X_DELTA / 2) + delta, contentFilterMaxY + delta);

    //     Rectangle documentBounds = jGoView.getDocument().computeBounds();
    //     jGoView.getDocument().setDocumentSize( (int) documentBounds.getWidth() +
    //                                            (ViewConstants.TIMELINE_VIEW_X_INIT * 2),
    //                                            (int) documentBounds.getHeight() +
    //                                            (ViewConstants.TIMELINE_VIEW_Y_INIT * 2));
    int maxViewWidth = (int) jGoView.getDocumentSize().getWidth();
    int maxViewHeight = (int) jGoView.getDocumentSize().getHeight();

    //     navigatorFrame.setSize
    //       ( maxViewWidth + ViewConstants.MDI_FRAME_DECORATION_WIDTH,
    //         maxViewHeight + ViewConstants.MDI_FRAME_DECORATION_HEIGHT);

    expandViewFrame(navigatorFrame, maxViewWidth, maxViewHeight);

    long stopTimeMSecs = System.currentTimeMillis();
    System.err.println(
        "   ... "
            + ViewConstants.NAVIGATOR_VIEW
            + " elapsed time: "
            + (stopTimeMSecs - startTimeMSecs)
            + " msecs.");
    startTimeMSecs = 0L;
    isLayoutNeeded = false;
    focusNode = null;
    // print out info for created nodes
    // iterateOverJGoDocument(); // slower - many more nodes to go thru
    // iterateOverNodes();
  } // end init