コード例 #1
0
 /////////////////////////////////////////////////////////
 // Tablegroups
 private void onSelectAllTables() {
   for (JInternalFrame f : _desktopPane.getAllFrames()) {
     if (f instanceof TableFrame) {
       _desktopPane.addGroupFrame((TableFrame) f);
     }
   }
 }
コード例 #2
0
 private void onEdgesGraphComponentChanged(EdgesGraphComponent edgesGraphComponent, boolean put) {
   if (put) {
     _desktopPane.putGraphComponents(new GraphComponent[] {edgesGraphComponent});
   } else {
     _desktopPane.removeGraphComponents(new GraphComponent[] {edgesGraphComponent});
   }
   _desktopPane.repaint();
 }
コード例 #3
0
  public void removeConstraintViews(ConstraintView[] constraintViews, boolean keepFoldingPoints) {
    _desktopPane.removeGraphComponents(constraintViews);

    if (false == keepFoldingPoints) {
      for (int i = 0; i < constraintViews.length; i++) {
        constraintViews[i].removeAllFoldingPoints();
      }
    }
  }
コード例 #4
0
  private void onSelectTablesByName() {
    String namePattern =
        JOptionPane.showInputDialog(
            _desktopPane,
            s_stringMgr.getString("graph.selectTablesByName.message"),
            s_stringMgr.getString("graph.selectTablesByName.title"),
            JOptionPane.QUESTION_MESSAGE);

    if (null == namePattern || 0 == namePattern.trim().length()) {
      return;
    }

    _desktopPane.clearGroupFrames();
    for (JInternalFrame f : _desktopPane.getAllFrames()) {
      if (f instanceof TableFrame) {
        TableFrame tf = (TableFrame) f;
        if (tf.getTitle().matches(namePattern.replace('?', '.').replace("*", ".*"))) {
          _desktopPane.addGroupFrame(tf);
        }
      }
    }
  }
コード例 #5
0
  private ConstraintHitData findHit(MouseEvent e) {
    Vector<GraphComponent> graphComponents = _desktopPane.getGraphComponents();

    for (int i = 0; i < graphComponents.size(); i++) {
      GraphComponent graphComponent = graphComponents.elementAt(i);

      if (graphComponent instanceof ConstraintView) {
        ConstraintView constraintView = (ConstraintView) graphComponents.elementAt(i);
        ConstraintHit constraintHit = constraintView.hitMe(e);
        if (ConstraintHit.NONE != constraintHit) {
          return new ConstraintHitData(constraintView, constraintHit);
        }
      }
    }
    return new ConstraintHitData(null, ConstraintHit.NONE);
  }
コード例 #6
0
  private void refreshSelection(ConstraintView hitOne, boolean allowDeselect) {
    if (allowDeselect) {
      hitOne.setSelected(!hitOne.isSelected());
    } else if (false == hitOne.isSelected()) {
      hitOne.setSelected(true);
    }

    Vector<GraphComponent> graphComponents = _desktopPane.getGraphComponents();

    for (int i = 0; i < graphComponents.size(); i++) {
      if (false == graphComponents.elementAt(i) instanceof ConstraintView) {
        continue;
      }

      ConstraintView constraintView = (ConstraintView) graphComponents.elementAt(i);
      if (false == constraintView.equals(hitOne)) {
        constraintView.setSelected(false);
      }
    }
  }
コード例 #7
0
 public void addFrame(JInternalFrame frame) {
   _desktopPane.hideStartupImage();
   _desktopPane.add(frame);
 }
コード例 #8
0
 public void repaint() {
   _desktopPane.repaint();
 }
コード例 #9
0
  public GraphDesktopController(
      GraphDesktopListener listener,
      ISession session,
      GraphPlugin plugin,
      ModeManager modeManager,
      boolean showDndDesktopImageAtStartup) {
    _listener = listener;
    _session = session;
    _plugin = plugin;
    _graphPluginResources = new GraphPluginResources(_plugin);

    ImageIcon startUpImage = null;

    if (showDndDesktopImageAtStartup) {
      startUpImage = _graphPluginResources.getIcon(GraphPluginResources.IKeys.DND);
    }

    _desktopPane = new GraphDesktopPane(_session.getApplication(), startUpImage);
    _desktopPane.setBackground(Color.white);

    _modeManager = modeManager;

    DropTarget dt = new DropTarget();

    try {
      dt.addDropTargetListener(
          new DropTargetAdapter() {
            public void drop(DropTargetDropEvent dtde) {
              onTablesDroped(dtde);
            }
          });
    } catch (TooManyListenersException e) {
      throw new RuntimeException(e);
    }

    _desktopPane.setDropTarget(dt);

    _desktopPane.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            onMouseClicked(e);
          }

          public void mousePressed(MouseEvent e) {
            onMousePressed(e);
          }

          public void mouseReleased(MouseEvent e) {
            onMouseReleased(e);
          }
        });

    _desktopPane.addMouseMotionListener(
        new MouseMotionAdapter() {
          public void mouseDragged(MouseEvent e) {
            onMouseDragged(e);
          }
        });

    createPopUp();
  }
コード例 #10
0
 /** It's called put because it adds unique, like a Hashtable. */
 public void putConstraintViews(ConstraintView[] constraintViews) {
   _desktopPane.putGraphComponents(constraintViews);
 }