Example #1
0
    public void actionPerformed(ActionEvent e) {
      if (elementTreeFrame == null) {
        // Create a frame containing an instance of
        // ElementTreePanel.
        try {
          String title = resources.getString("ElementTreeFrameTitle");
          elementTreeFrame = new JFrame(title);
        } catch (MissingResourceException mre) {
          elementTreeFrame = new JFrame();
        }

        elementTreeFrame.addWindowListener(
            new WindowAdapter() {

              @Override
              public void windowClosing(WindowEvent weeee) {
                elementTreeFrame.setVisible(false);
              }
            });
        Container fContentPane = elementTreeFrame.getContentPane();

        fContentPane.setLayout(new BorderLayout());
        elementTreePanel = new ElementTreePanel(getEditor());
        fContentPane.add(elementTreePanel);
        elementTreeFrame.pack();
      }
      elementTreeFrame.setVisible(true);
    }
 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;
   }
   PickerTableModel model = getDataModel();
   ICFInternetISOCountryObj o =
       (ICFInternetISOCountryObj) model.getValueAt(row, COLID_ROW_HEADER);
   invokeWhenChosen.choseISOCountry(o);
   try {
     Container cont = getParent();
     while ((cont != null) && (!(cont instanceof JInternalFrame))) {
       cont = cont.getParent();
     }
     if (cont != null) {
       ((JInternalFrame) cont).setClosed(true);
     }
   } catch (Exception x) {
   }
 }
Example #3
0
  public MsnTreeTest() {
    String[] tab = {"hello", "test", "blabla"};

    container = getContentPane();
    container.setLayout(null);

    eleve = new DefaultMutableTreeNode("MSN");

    worker = new DefaultMutableTreeNode("Worker");
    prof = new DefaultMutableTreeNode("Profs");

    for (int i = 0; i < tab.length; i++) {
      worker.add(new DefaultMutableTreeNode(tab[i]));
      prof.add(new DefaultMutableTreeNode(tab[i]));
    }
    //        worker.add(new DefaultMutableTreeNode("hello world2"));

    eleve.add(worker);
    eleve.add(prof);

    tree = new JTree(eleve);

    scroll = new JScrollPane(tree);
    scroll.setBounds(10, 10, 100, 100);

    container.add(scroll);

    setSize(300, 300);
    setLocation(200, 200);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setVisible(true);

    //        worker.add(n);

  }
Example #4
0
  /* constructor
   * Create a frame with JTextArea and a menubar
   * with a "File" dropdown menu.
   *
   * @param title: the title for the frame
   * @param whichFile: to indicate which load or save buuton
   */
  public OpenFileDir(String title, String whichFile) {
    super(title);
    fileNo = whichFile;
    Container content_pane = getContentPane();

    // Create a user interface.
    content_pane.setLayout(new BorderLayout());

    // Use the helper method makeMenuItem
    // for making the menu items and registering
    // their listener.
    JMenu m = new JMenu("File");

    // Modify task names to something relevant to
    // the particular program.
    m.add(fMenuLoad = makeMenuItem("Load"));
    m.add(fMenuSave = makeMenuItem("Save"));
    m.add(fMenuClose = makeMenuItem("Quit"));

    JMenuBar mb = new JMenuBar();
    mb.add(m);

    setJMenuBar(mb);
    setSize(400, 200);
  } /* end of the constructor */
Example #5
0
  /*
   * Fix for BugTraq ID 4041703.
   * Set the focus to a reasonable default for an Applet.
   */
  private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if (parent != null) {
      if (parent instanceof Window) {
        toFocus = getMostRecentFocusOwnerForWindow((Window) parent);
        if (toFocus == parent || toFocus == null) {
          toFocus = parent.getFocusTraversalPolicy().getInitialComponent((Window) parent);
        }
      } else if (parent.isFocusCycleRoot()) {
        toFocus = parent.getFocusTraversalPolicy().getDefaultComponent(parent);
      }
    }

    if (toFocus != null) {
      if (parent instanceof EmbeddedFrame) {
        ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
      }
      // EmbeddedFrame might have focus before the applet was added.
      // Thus after its activation the most recent focus owner will be
      // restored. We need the applet's initial focusabled component to
      // be focused here.
      toFocus.requestFocusInWindow();
    }
  }
 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;
   }
   FinderTableModel model = getDataModel();
   ICFSecurityISOTimezoneObj o =
       (ICFSecurityISOTimezoneObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = swingSchema.getISOTimezoneFactory().newViewEditJInternalFrame(o);
   ((ICFSecuritySwingISOTimezoneJPanelCommon) 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();
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFInternetDomainBaseObj focus = getSwingFocusAsDomainBase();
   if (focus != null) {
     ICFInternetDomainBaseEditObj editObj = (ICFBamDomainBaseEditObj) focus.getEdit();
     if (editObj != null) {
       focus = editObj;
     }
     JInternalFrame frame = null;
     Container cont;
     JDesktopPane desktop;
     ICFBamTenantObj referencedObj =
         (ICFBamTenantObj) focus.getRequiredOwnerTenant(swingIsInitializing);
     if (referencedObj != null) {
       String classCode = referencedObj.getClassCode();
       if ("TENT".equals(classCode)) {
         frame = swingSchema.getTenantFactory().newViewEditJInternalFrame(referencedObj);
         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, "swingFocus", focus, "ICFBamTenantObj");
       }
     }
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame frame = (JInternalFrame) cont;
     if (frame instanceof ICFSecuritySwingSecGroupFormJPanelCommon) {
       ICFSecuritySwingSecGroupFormJPanelCommon jpanelCommon =
           (ICFSecuritySwingSecGroupFormJPanelCommon) frame;
       jpanelCommon.setPanelMode(CFJPanel.PanelMode.Delete);
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "frame",
               frame,
               "ICFSecuritySwingSecGroupFormJPanelCommon");
     }
     try {
       frame.setClosed(true);
     } catch (Exception x) {
     }
   }
 }
Example #9
0
  public void init() {

    // <Begin_init>
    if (initialized == true) return;
    this.setSize(getPreferredSize().width + 682, getPreferredSize().height + 419);
    setTitle(NmsClientUtil.GetString("Router Display Panel"));
    Container container = getContentPane();
    container.setLayout(new BorderLayout());
    try {
      initVariables();
      setUpGUI(container);
      setUpProperties();
      setUpConnections();
    } catch (Exception ex) {
      showStatus(NmsClientUtil.GetString("Error in init method"), ex);
    }
    // let us set the initialzed variable to true so
    // we dont initialize again even if init is called
    initialized = true;
    setUpMenus();
    setUpToolBar();

    // <End_init>
    setIconImage(NmsClientUtil.getFrameIcon());
  }
 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();
   }
 }
Example #11
0
  /**
   * Creates a new AWT <tt>Container</tt> which can display a single <tt>Component</tt> at a time
   * (supposedly, one which represents video) and, in the absence of such a <tt>Component</tt>,
   * displays a predefined default <tt>Component</tt> (in accord with the previous supposition, one
   * which is the default when there is no video). The returned <tt>Container</tt> will track the
   * <tt>Components</tt>s added to and removed from it in order to make sure that
   * <tt>noVideoContainer</tt> is displayed as described.
   *
   * @param noVideoComponent the predefined default <tt>Component</tt> to be displayed in the
   *     returned <tt>Container</tt> when there is no other <tt>Component</tt> in it
   * @return a new <tt>Container</tt> which can display a single <tt>Component</tt> at a time and,
   *     in the absence of such a <tt>Component</tt>, displays <tt>noVideoComponent</tt>
   */
  private VideoContainer createVideoContainer(Component noVideoComponent) {
    Container oldParent = noVideoComponent.getParent();

    if (oldParent != null) oldParent.remove(noVideoComponent);

    return new VideoContainer(noVideoComponent, false);
  }
    /** Displays the labels and the values for the panel. */
    protected void displayPnlFields(HashMap hmPnl) {
      if (hmPnl == null || hmPnl.isEmpty()) return;

      Iterator keySetItr = hmPnl.keySet().iterator();
      String strLabel = "";
      String strValue = "";

      // if the file is empty, then create an empty set of textfields.
      if (hmPnl == null || hmPnl.isEmpty()) {
        displayNewTxf("", "");
        return;
      }

      Container container = getParent();
      if (container != null) container.setVisible(false);
      try {
        // Get each set of label and value, and display them.
        while (keySetItr.hasNext()) {
          strLabel = (String) keySetItr.next();
          strValue = (String) hmPnl.get(strLabel);

          displayNewTxf(strLabel, strValue);
        }

        if (container != null) container.setVisible(true);
        revalidate();
        repaint();
      } catch (Exception e) {
        Messages.writeStackTrace(e);
        // e.printStackTrace();
        Messages.postDebug(e.toString());
      }
    }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame frame = (JInternalFrame) cont;
     if (frame instanceof ICFSecuritySwingISOCurrencyJPanelCommon) {
       ICFSecuritySwingISOCurrencyJPanelCommon jpanelCommon =
           (ICFSecuritySwingISOCurrencyJPanelCommon) frame;
       jpanelCommon.setPanelMode(CFJPanel.PanelMode.Unknown);
       ICFSecurityISOCurrencyEditObj editObj =
           (ICFSecurityISOCurrencyEditObj) jpanelCommon.getSwingFocusAsISOCurrency().getEdit();
       if (editObj != null) {
         editObj.endEdit();
       }
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "frame",
               frame,
               "ICFSecuritySwingISOCurrencyJPanelCommon");
     }
     try {
       frame.setClosed(true);
     } catch (Exception x) {
     }
   }
 }
 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 setEntityDead() {
   super.setEntityDead();
   inventorySlots.onCraftGuiClosed(this);
   if (craftingInventory != null) {
     craftingInventory.onCraftGuiClosed(this);
   }
 }
Example #16
0
  /**
   * Maps a named servlet to a particular path or extension. If the named servlet is unregistered,
   * it will be added and subsequently mapped.
   *
   * <p>Note that the order of resolution to handle a request is:
   *
   * <p>exact mapped servlet (eg /catalog) prefix mapped servlets (eg /foo/bar/*) extension mapped
   * servlets (eg *jsp) default servlet
   */
  public void addServletMapping(String path, String servletName) throws TomcatException {
    if (mappings.get(path) != null) {
      log("Removing duplicate " + path + " -> " + mappings.get(path));
      mappings.remove(path);
      Container ct = (Container) containers.get(path);
      removeContainer(ct);
    }
    ServletWrapper sw = (ServletWrapper) servlets.get(servletName);
    if (sw == null) {
      // Workaround for frequent "bug" in web.xmls
      // Declare a default mapping
      log("Mapping with unregistered servlet " + servletName);
      sw = addServlet(servletName, servletName);
    }
    if ("/".equals(path)) defaultServlet = sw;

    mappings.put(path, sw);

    Container map = new Container();
    map.setContext(this);
    map.setHandler(sw);
    map.setPath(path);
    contextM.addContainer(map);
    containers.put(path, map);
  }
 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");
     }
   }
 }
Example #18
0
  UserInputValidationErrorBox(Frame parent, YWorkItem item, YDataStateException e) {
    super(parent, "Problem with your input data");
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    JPanel p = new JPanel(new BorderLayout());
    p.setBackground(YAdminGUI._apiColour);
    p.add(createTopPanel(item), BorderLayout.NORTH);
    p.add(createCentrePanel(e), BorderLayout.CENTER);
    c.add(p, BorderLayout.CENTER);
    c.add(createBottomPanel(), BorderLayout.SOUTH);
    c.setBackground(YAdminGUI._apiColour);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            storeData();
            this_windowClosing();
          }
        });

    Double screenWidth =
        new Double(
            GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth());
    Double screenHeight =
        new Double(
            GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight());
    setSize(new Double(screenWidth * 0.8).intValue(), new Double(screenHeight * 0.8).intValue());

    Dimension labelSize = this.getSize();
    setLocation(
        screenWidth.intValue() / 2 - (labelSize.width / 2),
        screenHeight.intValue() / 2 - (labelSize.height / 2));
    show();
  }
 @Override
 public Dimension minimumLayoutSize(Container parent) {
   Component toolbar = parent.getComponent(0);
   Dimension toolbarSize = toolbar.isVisible() ? toolbar.getMinimumSize() : new Dimension();
   Dimension contentSize = parent.getComponent(1).getMinimumSize();
   return new Dimension(
       Math.max(toolbarSize.width, contentSize.width), toolbarSize.height + contentSize.height);
 }
Example #20
0
 /** Find the hosting frame, for the file-chooser dialog. */
 protected Frame getFrame() {
   for (Container p = getParent(); p != null; p = p.getParent()) {
     if (p instanceof Frame) {
       return (Frame) p;
     }
   }
   return null;
 }
 @Override
 public void layoutContainer(Container parent) {
   int width = parent.getWidth();
   int height = parent.getHeight();
   Component toolbar = parent.getComponent(0);
   Dimension toolbarSize = toolbar.isVisible() ? toolbar.getPreferredSize() : new Dimension();
   toolbar.setBounds(0, 0, width, toolbarSize.height);
   parent.getComponent(1).setBounds(0, toolbarSize.height, width, height - toolbarSize.height);
 }
Example #22
0
 public static void main(String[] argv) throws NoSuchMethodException {
   f = new JFrame();
   Container c = f.getContentPane();
   c.setLayout(new BorderLayout());
   c.add(new WordListScreen(null), BorderLayout.CENTER);
   f.pack();
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   showFrame(true);
 }
Example #23
0
 /** Destroy all containers */
 public static void destroy() {
   for (Container c : CONTAINERS) {
     try {
       c.destroy();
     } catch (Exception ex) {
       // noop
     }
   }
 }
 public Dimension getPreferredSize() {
   Dimension d = super.getPreferredSize();
   Container parent = getParent();
   if (parent instanceof JViewport) {
     if (parent.getWidth() > d.width) {
       d = new Dimension(parent.getWidth(), d.height);
     }
   }
   return d;
 }
 public void doAction(ActionEvent e) {
   String cmd = e.getActionCommand();
   // the new button creates a new set of texfields
   if (cmd.equals("new")) {
     Container container = getParent();
     if (container != null) container.setVisible(false);
     displayNewTxf("", "");
     if (container != null) container.setVisible(true);
   }
 }
 @Override
 public Dimension preferredLayoutSize(final Container parent) {
   Dimension result = new Dimension();
   for (int i = 0; i < parent.getComponentCount(); i++) {
     final Dimension prefSize = parent.getComponent(i).getPreferredSize();
     result.width += prefSize.width;
     result.height = Math.max(prefSize.height, result.height);
   }
   return result;
 }
Example #27
0
 private static void setComponentName(JComponent component, String name) {
   if (component != null) {
     Container parent = component.getParent();
     if (parent != null) {
       component.setName(parent.getName() + "." + name);
     } else {
       component.setName(name);
     }
   }
 }
Example #28
0
  /**
   * Cr�e une nouvelle instance de CreeTrans
   *
   * @param mf fenetre principale de l'application
   * @param zg Zone graphique
   * @param auto automate
   * @param be barre d'�tat
   */
  public TransCreator(MainFrame mf, GraphicZone g, Automate auto, StateBar be) {

    super(JOptionPane.getFrameForComponent(mf), "Creating interaction", true);

    this.setResizable(false);

    this.gz = g;
    this.auto = auto;
    this.bar = be;
    this.mf = mf;

    be.displayInfo("Creating interaction");

    tfJPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel1.setBackground(Color.lightGray);
    tfJPanel1.add(new JLabel("Type  : "));
    groupe = new CheckboxGroup();
    plus = new Checkbox("activator", groupe, true);
    tfJPanel1.add(plus);
    minus = new Checkbox("inhibitor", groupe, false);
    tfJPanel1.add(minus);

    tfJPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel2.setBackground(Color.lightGray);
    tfJPanel2.add(new JLabel("Threshold  = "));
    tf = new JTextField(auto.nbrCharTransLabel);
    tf.setText("1");
    tfJPanel2.add(tf);

    btJPanel = new JPanel(new GridLayout(1, 2, 0, 0));
    btJPanel.setBackground(Color.lightGray);
    ok = new Button("Ok");
    ok.setBackground(Color.lightGray);
    ok.addActionListener(this);
    cancel = new Button("Cancel");
    cancel.setBackground(Color.lightGray);
    cancel.addActionListener(this);
    btJPanel.add(ok);
    btJPanel.add(cancel);

    content = this.getContentPane();
    content.setLayout(new BorderLayout());
    content.setBackground(Color.lightGray);
    content.add(tfJPanel1, BorderLayout.NORTH);
    content.add(tfJPanel2, BorderLayout.CENTER);
    content.add(btJPanel, BorderLayout.SOUTH);

    this.pack();
    this.setLocationRelativeTo(this.mf);

    tf.requestFocusInWindow();

    // rendre la fenetre visible
    setVisible(true);
  }
 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();
   }
 }
Example #30
0
  /** Find the top focusable Window, Applet, or InternalFrame */
  private static Container getTopAncestor(JComponent c) {
    for (Container p = c.getParent(); p != null; p = p.getParent()) {
      if (p instanceof Window && ((Window) p).isFocusableWindow()
          || p instanceof Applet
          || p instanceof JInternalFrame) {

        return p;
      }
    }
    return null;
  }