public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   ListTableModel model = getDataModel();
   ICFInternetVersionObj o = (ICFInternetVersionObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = null;
   String classCode = o.getClassCode();
   if (classCode.equals("VERN")) {
     frame = swingSchema.getVersionFactory().newViewEditJInternalFrame(o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else if (classCode.equals("MJVR")) {
     frame =
         swingSchema
             .getMajorVersionFactory()
             .newViewEditJInternalFrame((ICFInternetMajorVersionObj) o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingMajorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else if (classCode.equals("MNVR")) {
     frame =
         swingSchema
             .getMinorVersionFactory()
             .newViewEditJInternalFrame((ICFInternetMinorVersionObj) o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingMinorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else {
     frame = null;
   }
   if (frame == null) {
     return;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFAccSchemaObj schemaObj = swingSchema.getSchema();
   if (schemaObj == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj");
   }
   ICFSecurityServiceObj selectedInstance = getSwingFocusAsService();
   if (selectedInstance != null) {
     String classCode = selectedInstance.getClassCode();
     if ("HSVC".equals(classCode)) {
       JInternalFrame frame =
           swingSchema.getServiceFactory().newAskDeleteJInternalFrame(selectedInstance);
       ((ICFAccSwingServiceJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
       frame.addInternalFrameListener(getViewEditInternalFrameListener());
       Container cont = getParent();
       while ((cont != null) && (!(cont instanceof JInternalFrame))) {
         cont = cont.getParent();
       }
       if (cont != null) {
         JInternalFrame myInternalFrame = (JInternalFrame) cont;
         myInternalFrame.getDesktopPane().add(frame);
         frame.setVisible(true);
         frame.show();
       }
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFAccServiceObj");
     }
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFInternetSchemaObj schemaObj = swingSchema.getSchema();
   ICFInternetMajorVersionObj obj =
       (ICFInternetMajorVersionObj) schemaObj.getMajorVersionTableObj().newInstance();
   JInternalFrame frame = swingSchema.getMajorVersionFactory().newViewEditJInternalFrame(obj);
   frame.addInternalFrameListener(getViewEditInternalFrameListener());
   ICFInternetMajorVersionEditObj edit = (ICFInternetMajorVersionEditObj) (obj.beginEdit());
   if (edit == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "edit");
   }
   ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
   edit.setRequiredOwnerTenant(secTenant);
   ICFInternetRealProjectObj container = (ICFInternetRealProjectObj) (getSwingContainer());
   if (container == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "SwingContainer");
   }
   edit.setRequiredContainerParent(container);
   ICFInternetSwingMajorVersionJPanelCommon jpanelCommon =
       (ICFInternetSwingMajorVersionJPanelCommon) frame;
   jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add);
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFCrmSchemaObj schemaObj = swingSchema.getSchema();
   if (schemaObj == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj");
   }
   ICFSecurityServiceTypeObj selectedInstance = getSwingFocusAsServiceType();
   if (selectedInstance != null) {
     String classCode = selectedInstance.getClassCode();
     if ("SVCT".equals(classCode)) {
       JInternalFrame frame =
           swingSchema.getServiceTypeFactory().newViewEditJInternalFrame(selectedInstance);
       frame.addInternalFrameListener(getViewEditInternalFrameListener());
       ((ICFCrmSwingServiceTypeJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.Edit);
       getDesktopPane().add(frame);
       frame.setVisible(true);
       frame.show();
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "selectedInstance",
               selectedInstance,
               "ICFCrmServiceTypeObj");
     }
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFBamSchemaObj schemaObj = swingSchema.getSchema();
   ICFBamAuditActionObj obj =
       (ICFBamAuditActionObj) schemaObj.getAuditActionTableObj().newInstance();
   JInternalFrame frame = swingSchema.getAuditActionFactory().newViewEditJInternalFrame(obj);
   frame.addInternalFrameListener(getViewEditInternalFrameListener());
   ICFBamAuditActionEditObj edit = (ICFBamAuditActionEditObj) (obj.beginEdit());
   if (edit == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "edit");
   }
   ICFBamSwingAuditActionJPanelCommon jpanelCommon = (ICFBamSwingAuditActionJPanelCommon) frame;
   jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add);
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFSecuritySchemaObj schemaObj = swingSchema.getSchema();
   if (schemaObj == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj");
   }
   ICFSecurityHostNodeObj obj =
       (ICFSecurityHostNodeObj) schemaObj.getHostNodeTableObj().newInstance();
   ICFSecurityHostNodeEditObj edit = (ICFSecurityHostNodeEditObj) (obj.beginEdit());
   if (edit == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "edit");
   }
   ICFSecurityClusterObj secCluster = schemaObj.getSecCluster();
   edit.setRequiredContainerCluster(secCluster);
   JInternalFrame frame = swingSchema.getHostNodeFactory().newViewEditJInternalFrame(obj);
   frame.addInternalFrameListener(getViewEditInternalFrameListener());
   ICFSecuritySwingHostNodeJPanelCommon jpanelCommon =
       (ICFSecuritySwingHostNodeJPanelCommon) frame;
   jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add);
   getDesktopPane().add(frame);
   frame.setVisible(true);
   frame.show();
 }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   ListTableModel model = getDataModel();
   ICFBamTopProjectObj o = (ICFBamTopProjectObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = swingSchema.getTopProjectFactory().newViewEditJInternalFrame(o);
   frame.addInternalFrameListener(getViewEditInternalFrameListener());
   ((ICFBamSwingTopProjectJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   if (frame == null) {
     return;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
예제 #8
0
  public Object showWindow(final MkWindow macWindow, String title, boolean isModal) {
    listMkWindow.add(macWindow);
    if (isModal) {
      JDialog modalFrame = new JDialog(this, title, true);
      // macWindow.setJanela(modalFrame);
      final MkRun onCloseWindow = macWindow.onCloseWindow;
      modalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
      modalFrame.addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              if (onCloseWindow != null) {
                onCloseWindow.execute();
              }
              disposeWindow(macWindow);
            }
          });
      modalFrame.setLayout(new BorderLayout());
      modalFrame.add(macWindow, BorderLayout.CENTER);
      modalFrame.pack();
      Dimension desktopSize = desktopPane.getSize();
      int x = (desktopSize.width - modalFrame.getWidth()) / 2;
      int y = (desktopSize.height - modalFrame.getHeight()) / 2;
      modalFrame.setLocation((x < 0 ? 0 : x), (y < 0 ? 0 : y));
      if (macWindow.panelButton != null) {
        modalFrame.getRootPane().setDefaultButton((JButton) macWindow.panelButton.getComponent(0));
      }
      modalFrame.setVisible(true);
      return modalFrame;
    } else {
      JInternalFrame internalFrame = new JInternalFrame(title, true, true, true, true);
      internalFrame.setContentPane(macWindow);
      internalFrame.pack();
      //            internalFrame.setBounds(internalFrame.getBounds()); //pq?
      desktopPane.add(internalFrame);

      internalFrame.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
      final MkRun onCloseWindow = macWindow.onCloseWindow;
      if (onCloseWindow != null) {
        internalFrame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);

        internalFrame.addInternalFrameListener(
            new InternalFrameAdapter() {
              public void internalFrameClosing(InternalFrameEvent e) {
                onCloseWindow.execute();
              }
            });
      }

      Dimension desktopSize = desktopPane.getSize();
      int x = (desktopSize.width - internalFrame.getWidth()) / 2;
      int y = (desktopSize.height - internalFrame.getHeight()) / 2;
      internalFrame.setLocation((x < 0 ? 0 : x), (y < 0 ? 0 : y));
      internalFrame.setVisible(true);
      return internalFrame;
    }
  }
예제 #9
0
  public static void createInternalFrameListeners(ActionContext actionContext) {
    Thing self = (Thing) actionContext.get("self");
    JInternalFrame parent = (JInternalFrame) actionContext.get("parent");

    for (Thing child : self.getChilds()) {
      InternalFrameListener c = (InternalFrameListener) child.doAction("create", actionContext);
      if (c != null) {
        parent.addInternalFrameListener(c);
      }
    }
  }
 private void displayNewWindow() {
   try {
     frame = new DefaultQuarantineWindow(getGuiContext(), guiData, userId, new ListDataSource());
     frame.addInternalFrameListener(cleanUpListener);
     getDesktopPane().add(frame);
     frame.pack();
     frame.setVisible(true);
     frame.setSelected(true);
   } catch (Exception ex) {
     ErrorDialog.show(getDesktopPane(), "Impossible d'afficher la liste", ex);
   }
 }
예제 #11
0
 @Override
 protected JComponent createControl() {
   JComponent pageComponentControl = getPageComponent().getControl();
   if (pageComponentControl.getName() == null) {
     nameComponent(pageComponentControl, "Control");
   }
   internalFrame = new JInternalFrame();
   configureControl();
   internalFrame.getContentPane().add(pageComponentControl, BorderLayout.CENTER);
   internalFrame.addInternalFrameListener(new InternalFrameHandler());
   nameComponent(internalFrame, "Pane");
   return internalFrame;
 }
예제 #12
0
 private void setClosingBehaviour(final LayerManagerProxy internalFrame) {
   final JInternalFrame i = (JInternalFrame) internalFrame;
   i.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
   i.addInternalFrameListener(
       new InternalFrameAdapter() {
         public void internalFrameClosing(InternalFrameEvent e) {
           if (1
               == getInternalFramesAssociatedWith((LayerManager) internalFrame.getLayerManager())
                   .size()) {
             if (confirmClose(
                 "Close Task",
                 internalFrame.getLayerManager().getLayersWithModifiedFeatureCollections())) {
               GUIUtil.dispose(i, desktopPane);
               internalFrame.getLayerManager().dispose();
             }
           } else {
             GUIUtil.dispose(i, desktopPane);
           }
         }
       });
 }
 /**
  * Open the internal frame for the given {@link BuildOutput} (or bring it to the front, if it is
  * already open)
  *
  * @param buildOutput The {@link BuildOutput}
  */
 private void openBuildOutputFrame(BuildOutput buildOutput) {
   JInternalFrame buildOutputFrame = openedBuildOutputFrames.get(buildOutput);
   if (buildOutputFrame != null) {
     buildOutputFrame.toFront();
     return;
   }
   buildOutputFrame = new JInternalFrame(buildOutput.getProjectName(), true, true, true, true);
   openedBuildOutputFrames.put(buildOutput, buildOutputFrame);
   buildOutputFrame.addInternalFrameListener(
       new InternalFrameAdapter() {
         @Override
         public void internalFrameClosed(InternalFrameEvent e) {
           openedBuildOutputFrames.remove(buildOutput);
         }
       });
   buildOutputFrame.getContentPane().add(new BuildOutputPanel(buildOutput));
   desktopPane.add(buildOutputFrame);
   buildOutputFrame.setLocation(0, 0);
   buildOutputFrame.setSize(desktopPane.getSize());
   buildOutputFrame.setVisible(true);
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFCrmSchemaObj schemaObj = swingSchema.getSchema();
   if (schemaObj == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj");
   }
   ICFCrmServiceTypeObj obj =
       (ICFCrmServiceTypeObj) schemaObj.getServiceTypeTableObj().newInstance();
   ICFCrmServiceTypeEditObj edit = (ICFCrmServiceTypeEditObj) (obj.beginEdit());
   if (edit == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "edit");
   }
   JInternalFrame frame = swingSchema.getServiceTypeFactory().newViewEditJInternalFrame(obj);
   frame.addInternalFrameListener(getViewEditInternalFrameListener());
   ICFCrmSwingServiceTypeJPanelCommon jpanelCommon = (ICFCrmSwingServiceTypeJPanelCommon) frame;
   jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add);
   getDesktopPane().add(frame);
   frame.setVisible(true);
   frame.show();
 }
예제 #15
0
  public JInternalFrame employeeFrame() {
    JInternalFrame f = new JInternalFrame();

    f =
        new JInternalFrame(
            "Employee Database",
            false, // Resizable
            true, // Closable
            true, // Maximizable
            true); // Iconifiable
    f.setLayout(new BorderLayout());

    JScrollPane sp = new JScrollPane(employeeTable());
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sp.setBorder(BorderFactory.createTitledBorder("Employees"));

    f.add(buttonPanel(false), BorderLayout.NORTH);
    f.add(sp);

    //		f.setLocation(loc);
    f.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
    f.setFrameIcon(images.loadImage("Images/menubar/database_icon.png"));
    f.addInternalFrameListener(this);

    if (osp.isLowResolution()) f.setSize(550, 282);
    else if (osp.isMidResolution()) f.setSize(550, 282);
    else f.setSize(850, 500); // Width, Height
    f.setVisible(true);

    try {
      f.setSelected(true);
    } catch (PropertyVetoException e1) {
      e1.printStackTrace();
    }

    return f;
  }
예제 #16
0
  public JunctionLinkDataFrame(final JunctionLink jl) {
    super(
        jl.getCurrName() + " properties",
        false, // resizable
        false, // closable
        false, // maximizable
        true); // iconifiable
    // PSRender.onHold();
    super.setBackground(back_color);
    super.addInternalFrameListener(
        new InternalFrameAdapter() {
          public void internalFrameActivated(InternalFrameEvent e) {
            reload();
            SelectedObject.setSelectedObject(jl);
          }
        });
    PSRender.moveToTop(jl.getBound(), 0.5);
    ml = jl;
    setLocation(50, 50);
    dataModelMain = new HeadTable(jl);
    tableMain = new JTable(dataModelMain);
    tableMain.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
    tableMain.setPreferredScrollableViewportSize(new Dimension(500, 20));
    //        tableMain.setBackground(back_color);

    // code
    TableColumn column_code = tableMain.getColumn("Code");
    DefaultTableCellRenderer rendererCode = new DefaultTableCellRenderer();
    rendererCode.setToolTipText("Enter new code for this path");
    column_code.setCellRenderer(rendererCode);
    column_code.setCellEditor(new TextFieldEditor());
    // name
    TableColumn column_name = tableMain.getColumn("Name");
    LanguageButtonRender render_name = new LanguageButtonRender();
    render_name.setToolTipText("Path name. Press for change name");
    column_name.setCellRenderer(render_name);
    LanguageButtonEditor editor_name = new LanguageButtonEditor(new JCheckBox());
    column_name.setCellEditor(editor_name);
    // junction 1
    TableColumn column_junc_1 = tableMain.getColumn("Junction 1");
    MLButtonRenderer rendererJunc_1 = new MLButtonRenderer();
    rendererJunc_1.setToolTipText("Code of first Junction, click for open properties");
    column_junc_1.setCellRenderer(rendererJunc_1);
    MLButtonEditor editorJunc = new MLButtonEditor(new JCheckBox());
    column_junc_1.setCellEditor(editorJunc);
    // junction 2
    TableColumn column_junc_2 = tableMain.getColumn("Junction 2");
    MLButtonRenderer rendererJunc_2 = new MLButtonRenderer();
    rendererJunc_2.setToolTipText("Code of second Junction, click for open properties");
    column_junc_2.setCellRenderer(rendererJunc_2);
    column_junc_2.setCellEditor(editorJunc);
    // type
    JComboBox comboBoxType = new JComboBox();
    String roadNames[] = jl.getTypeNames();
    for (int i = 0, len = roadNames.length; i < len; i++) {
      comboBoxType.addItem(roadNames[i]);
    }
    TableColumn column_type = tableMain.getColumn("Type");
    DefaultTableCellRenderer rendererType = new DefaultTableCellRenderer();
    rendererType.setToolTipText("To change road type click for combo box");
    column_type.setCellRenderer(rendererType);
    column_type.setCellEditor(new DefaultCellEditor(comboBoxType));
    // legth
    TableColumn column_length = tableMain.getColumn("Length");
    DefaultTableCellRenderer rendererLen = new DefaultTableCellRenderer();
    rendererLen.setToolTipText("The path length in meters");
    column_length.setCellRenderer(rendererLen);

    scrollpaneMain = new JScrollPane(tableMain);
    scrollpaneMain.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollpaneMain.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    scrollpaneMain.setPreferredSize(new Dimension(500, 50));

    Container contentPane = super.getContentPane();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    contentPane.setLayout(gridbag);

    c.ipady = 0; // make this component tall
    c.weightx = 0.5;
    c.gridwidth = 4;
    c.gridx = 0;
    c.gridy = 0;
    gridbag.setConstraints(scrollpaneMain, c);
    //        scrollpaneMain.setBackground(back_color);
    //        scrollpaneMain.setForeground(back_color);
    contentPane.add(scrollpaneMain);

    TableModel dataModelPoints = new PointTableModel(jl);
    tablePoints = new JTable(dataModelPoints);
    tablePoints.setPreferredScrollableViewportSize(
        new Dimension(200, dataModelPoints.getRowCount() * tablePoints.getRowHeight()));
    ListModel lm =
        new AbstractListModel() {
          public int getSize() {
            return 1000;
          }

          public Object getElementAt(int index) {
            return "" + index;
          }
        };
    JList rowHeader = new JList(lm);
    rowHeader.setFixedCellWidth(20);

    rowHeader.setFixedCellHeight(tablePoints.getRowHeight());
    // + tablePoints.getRowMargin());

    rowHeader.setCellRenderer(new RowHeaderRenderer(tablePoints));

    scrollPanePoints = new JScrollPane(tablePoints);
    scrollPanePoints.setWheelScrollingEnabled(true);
    scrollPanePoints.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPanePoints.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    int mh;
    if (dataModelPoints.getRowCount() * tablePoints.getRowHeight() > 100) {
      mh = 100;
    } else {
      mh = dataModelPoints.getRowCount() * tablePoints.getRowHeight();
    }
    scrollPanePoints.setPreferredSize(new Dimension(200, mh));
    scrollPanePoints.setRowHeaderView(rowHeader);

    c.ipadx = 200;
    c.weightx = 0.5;
    c.gridwidth = 3;
    c.gridx = 1;
    c.gridy = 1;
    gridbag.setConstraints(scrollPanePoints, c);
    //        scrollPanePoints.setBackground(back_color);
    contentPane.add(scrollPanePoints);

    button_ok = new JButton("Ok");
    button_ok.addActionListener(this);
    JPanel buttonPane = new JPanel(null);
    buttonPane.setPreferredSize(new Dimension(500, 100));
    button_ok.setBounds(205, 40, 90, 40);
    buttonPane.add(button_ok);
    c.ipady = 10; // make this component tall
    c.ipadx = 10;
    c.weightx = 0.5;
    c.gridwidth = 4;
    c.gridx = 2;
    c.gridy = 2;
    gridbag.setConstraints(buttonPane, c);
    buttonPane.setBackground(back_color);
    contentPane.add(buttonPane);

    super.pack();
    super.setVisible(true);

    // MapApplication.getDesktop().setSelectedFrame(this);

  }
예제 #17
0
  /** Contains a CyNetworkView. */
  protected void createContainer(final CyNetworkView view) {
    if (networkViewMap.containsKey(view.getNetwork().getIdentifier())) return;

    // create a new InternalFrame and put the CyNetworkViews Component into
    // it
    final JInternalFrame iframe = new JInternalFrame(view.getTitle(), true, true, true, true);
    iframe.addInternalFrameListener(
        new InternalFrameAdapter() {
          public void internalFrameClosing(InternalFrameEvent e) {
            Cytoscape.destroyNetworkView(view);
          }
        });
    desktopPane.add(iframe);

    // code added to support layered canvas for each CyNetworkView
    if (view instanceof DGraphView) {
      final InternalFrameComponent internalFrameComp =
          new InternalFrameComponent(iframe.getLayeredPane(), (DGraphView) view);

      iframe.getContentPane().add(internalFrameComp);
      internalFrameComponentMap.put(view.getNetwork().getIdentifier(), internalFrameComp);
    } else {
      logger.info("NetworkViewManager.createContainer() - DGraphView not found!");
      iframe.getContentPane().add(view.getComponent());
    }

    iframe.pack();

    int x = 0;
    int y = 0;
    JInternalFrame refFrame = null;
    JInternalFrame[] allFrames = desktopPane.getAllFrames();

    if (allFrames.length > 1) {
      refFrame = allFrames[0];
    }

    if (refFrame != null) {
      x = refFrame.getLocation().x + 20;
      y = refFrame.getLocation().y + 20;
    }

    if (x > (desktopPane.getWidth() - MINIMUM_WIN_WIDTH)) {
      x = desktopPane.getWidth() - MINIMUM_WIN_WIDTH;
    }

    if (y > (desktopPane.getHeight() - MINIMUM_WIN_HEIGHT)) {
      y = desktopPane.getHeight() - MINIMUM_WIN_HEIGHT;
    }

    if (x < 0) {
      x = 0;
    }

    if (y < 0) {
      y = 0;
    }

    iframe.setBounds(x, y, 400, 400);

    // maximize the frame if the specified property is set
    try {
      String max = CytoscapeInit.getProperties().getProperty("maximizeViewOnCreate");

      if ((max != null) && Boolean.parseBoolean(max)) iframe.setMaximum(true);
    } catch (PropertyVetoException pve) {
      logger.warn("Unable to maximize internal frame: " + pve.getMessage());
    }

    iframe.setVisible(true);
    iframe.addInternalFrameListener(this);
    iframe.setResizable(true);

    networkViewMap.put(view.getNetwork().getIdentifier(), iframe);
    componentMap.put(iframe, view.getNetwork().getIdentifier());

    firePropertyChange(
        CytoscapeDesktop.NETWORK_VIEW_FOCUSED, null, view.getNetwork().getIdentifier());
  }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFInternetSchemaObj schemaObj = swingSchema.getSchema();
   if (schemaObj == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj");
   }
   ICFInternetVersionObj selectedInstance = getSwingFocusAsVersion();
   if (selectedInstance != null) {
     String classCode = selectedInstance.getClassCode();
     if ("VERN".equals(classCode)) {
       JInternalFrame frame =
           swingSchema.getVersionFactory().newViewEditJInternalFrame(selectedInstance);
       frame.addInternalFrameListener(getViewEditInternalFrameListener());
       ((ICFInternetSwingVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.Edit);
       Container cont = getParent();
       while ((cont != null) && (!(cont instanceof JInternalFrame))) {
         cont = cont.getParent();
       }
       if (cont != null) {
         JInternalFrame myInternalFrame = (JInternalFrame) cont;
         myInternalFrame.getDesktopPane().add(frame);
         frame.setVisible(true);
         frame.show();
       }
     } else if ("MJVR".equals(classCode)) {
       ICFInternetMajorVersionObj obj = (ICFInternetMajorVersionObj) selectedInstance;
       JInternalFrame frame =
           swingSchema.getMajorVersionFactory().newViewEditJInternalFrame(obj);
       frame.addInternalFrameListener(getViewEditInternalFrameListener());
       ((ICFInternetSwingMajorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.Edit);
       Container cont = getParent();
       while ((cont != null) && (!(cont instanceof JInternalFrame))) {
         cont = cont.getParent();
       }
       if (cont != null) {
         JInternalFrame myInternalFrame = (JInternalFrame) cont;
         myInternalFrame.getDesktopPane().add(frame);
         frame.setVisible(true);
         frame.show();
       }
     } else if ("MNVR".equals(classCode)) {
       ICFInternetMinorVersionObj obj = (ICFInternetMinorVersionObj) selectedInstance;
       JInternalFrame frame =
           swingSchema.getMinorVersionFactory().newViewEditJInternalFrame(obj);
       frame.addInternalFrameListener(getViewEditInternalFrameListener());
       ((ICFInternetSwingMinorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.Edit);
       Container cont = getParent();
       while ((cont != null) && (!(cont instanceof JInternalFrame))) {
         cont = cont.getParent();
       }
       if (cont != null) {
         JInternalFrame myInternalFrame = (JInternalFrame) cont;
         myInternalFrame.getDesktopPane().add(frame);
         frame.setVisible(true);
         frame.show();
       }
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "selectedInstance",
               selectedInstance,
               "ICFInternetVersionObj, ICFInternetMajorVersionObj, ICFInternetMinorVersionObj");
     }
   }
 }
예제 #19
0
  /**
   * Constructor: The one we're working on right now.
   *
   * @param id
   * @param label
   * @param desktop
   */
  public kCodeWindow(String id, String label, JDesktopPane desktop) {

    this.id = id;
    this.desktop = desktop;

    // make the editor portions

    TextAreaDefaults editareaSettings = new PdeTextAreaDefaults();
    editareaSettings.rows = TEXTAREA_DEFAULT_ROWS;
    editareaSettings.cols = TEXTAREA_DEFAULT_COLS;
    textarea = new JEditTextArea(editareaSettings);
    textarea.getDocument().setTokenMarker(Editor.pdeTokenMarker);
    textarea.setEventsEnabled(
        false); // suppress JEditTextArea events (not that anyone is listening to it)
    textarea.setEditable(true);
    textarea.setHorizontalOffset(TEXTAREA_HORIZ_OFFSET);
    textarea.getPainter().setLineHighlightEnabled(false); // else looks funny
    textarea.getPainter().setBackground(kConstants.CODE_WINDOW_COLOR);
    setShortcutKeystrokes();
    JScrollPane scrollPane = new JScrollPane(textarea);
    scrollPane.setBorder(null);
    //    scrollPane.setOpaque(true);

    editFrame = new JInternalFrame(label, true, false, false, false);
    editFrame.setContentPane(textarea);
    editFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    editFrame.setSize(editFrame_DEFAULT_WIDTH, editFrame_DEFAULT_HEIGHT);
    editFrame.setBorder(null);
    editFrame.setOpaque(true);

    // make the triangle
    triangleFrame = new JInternalFrame("", false, false, false, false);
    triangleFrame.setOpaque(false);
    triangleFrame
        .getRootPane()
        .setBackground(new Color(0, 0, 0, 0)); // needs this to actually do the trick
    triangleFrame.setContentPane(
        new Triangle("SE", 0, TRIANGLE_BASE, TRIANGLE_DEFAULT_HEIGHT, TRIANGLE_BASE));
    triangleFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    triangleFrame.setSize(TRIANGLE_BASE, TRIANGLE_DEFAULT_HEIGHT);
    triangleFrame.setBorder(null);

    // remove the ability to move the triangle iframe
    MouseMotionListener[] actions =
        (MouseMotionListener[]) triangleFrame.getListeners(MouseMotionListener.class);
    for (int i = 0; i < actions.length; i++) triangleFrame.removeMouseMotionListener(actions[i]);

    // make the buttons
    moveButton = new JButton(Base.getImageIcon("codewindow-activ-move.gif", desktop));
    moveButton.setDisabledIcon(Base.getImageIcon("codewindow-inact-move.gif", desktop));
    moveButton.setVisible(true);
    moveButton.setBorder(null);
    moveButton.setOpaque(false);
    moveButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    closeButton = new JButton(Base.getImageIcon("codewindow-activ-close.gif", desktop));
    closeButton.setDisabledIcon(Base.getImageIcon("codewindow-inact-close.gif", desktop));
    closeButton.setVisible(true);
    closeButton.setBorder(null);
    closeButton.setOpaque(false);
    closeButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
    buttonPanel.setBorder(null);
    buttonPanel.setOpaque(false);
    buttonPanel.add(moveButton);
    buttonPanel.add(closeButton);

    buttonFrame = new JInternalFrame("", false, false, false, false);
    buttonFrame.setContentPane(buttonPanel);
    buttonFrame.setOpaque(false);
    buttonFrame.getRootPane().setBackground(new Color(0, 0, 0, 0));
    buttonFrame.setSize(BUTTON_ICON_WIDTH * 2 + BUTTON_GAP, BUTTON_ICON_HEIGHT);
    buttonFrame.setBorder(null);

    // myriad event handling

    installFocusHandlers(buttonPanel);

    // hide code window when escape key is hit
    textarea.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ESCAPE) setVisible(false);
          }
        });
    // add dragging function of the move button,
    // reset the triangle after mouse release, and shift the editFrame
    // along with the mouse when the user is moving the window
    mxMouseControl moveListener = createMoveListener();
    moveButton.addMouseListener(moveListener);
    moveButton.addMouseMotionListener(moveListener);
    closeButton.addMouseListener(createCloseListener());
    // listens to resizing of editFrame and adjusts the position of the
    // buttons and the shape of the triangle accordingly
    editFrame.addComponentListener(createResizeListener());
    // when code windows are on top of each other, layers them correctly
    // such that when the user clicks on any part of a code window
    // all three component internal frames are brought to the top
    // so they appear "focused" also
    InternalFrameListener iframeListener =
        new InternalFrameAdapter() {
          public void internalFrameActivated(InternalFrameEvent e) {
            moveToFrontLayer();
          }

          public void internalFrameDeactivated(InternalFrameEvent e) {
            moveToBackLayer();
          }
        };
    editFrame.addInternalFrameListener(iframeListener);
    buttonFrame.addInternalFrameListener(iframeListener);
    triangleFrame.addInternalFrameListener(iframeListener);

    // add everything to desktop

    desktop.add(editFrame);
    desktop.add(buttonFrame);
    desktop.add(triangleFrame);
    moveToBackLayer();
  }
예제 #20
0
  // REVISAR: No parece necesario evitar el JInternalFrame
  // public void addInternalFrame(final TaskComponent internalFrame,
  public void addInternalFrame(
      final JInternalFrame internalFrame, boolean alwaysOnTop, boolean autoUpdateToolBar) {
    if (internalFrame instanceof LayerManagerProxy) {
      setClosingBehaviour((LayerManagerProxy) internalFrame);
      installTitleBarModifiedIndicator((LayerManagerProxy) internalFrame);
    }

    // <<TODO:IMPROVE>> Listen for when the frame closes, and when it does,
    // activate the topmost frame. Because Swing does not seem to do this
    // automatically. [Jon Aquino]
    internalFrame.setFrameIcon(icon);

    // Call JInternalFrame#setVisible before JDesktopPane#add; otherwise,
    // the
    // TreeLayerNamePanel starts too narrow (100 pixels or so) for some
    // reason.
    // <<TODO>>Investigate. [Jon Aquino]
    internalFrame.setVisible(true);
    desktopPane.add(
        (Component) internalFrame,
        alwaysOnTop ? JLayeredPane.PALETTE_LAYER : JLayeredPane.DEFAULT_LAYER);
    if (autoUpdateToolBar) {
      internalFrame.addInternalFrameListener(
          new InternalFrameListener() {
            public void internalFrameActivated(InternalFrameEvent e) {
              toolBar.updateEnabledState();

              // Associate current cursortool with the new frame [Jon
              // Aquino]
              toolBar.reClickSelectedCursorToolButton();
            }

            public void internalFrameClosed(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameClosing(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameDeactivated(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameDeiconified(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameIconified(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameOpened(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }
          });

      // Call #activateFrame *after* adding the listener. [Jon Aquino]
      activateFrame(internalFrame);
      position(internalFrame);
    }
  }