public void run(TaskMonitor monitor, PlugInContext context) throws Exception {
   // -- get the LM because when the Histogram will be shown, the app. focus
   //   will change and context.addLayer will not work (null pointer exc.)
   // [mmichaud 2012-04-09] to completely resolve this problem, I added the
   // new JInternalFrame is added after the addLayer method has been called
   this.currentLM = context.getLayerManager();
   monitor.allowCancellationRequests();
   if (this.selAttribute == null) {
     context.getWorkbenchFrame().warnUser(I18N.get(sNoAttributeChoosen));
     return;
   }
   javax.swing.JInternalFrame internalFrame = context.getWorkbenchFrame().getActiveInternalFrame();
   FeatureDataset result = classifyAndCreatePlot(monitor, context);
   context.getWorkbenchFrame().activateFrame(internalFrame);
   if (result == null) {
     context.getWorkbenchFrame().warnUser(I18N.get(sNotEnoughValuesWarning));
   } else if (result.size() > 0) {
     String name = this.selAttribute + "_" + this.selClassifier;
     this.currentLM.addLayer(StandardCategoryNames.WORKING, name, result);
     JInternalFrame frame = new JInternalFrame(this.sHistogram);
     frame.setLayout(new BorderLayout());
     frame.add(plot, BorderLayout.CENTER);
     frame.setClosable(true);
     frame.setResizable(true);
     frame.setMaximizable(true);
     frame.setSize(450, 450);
     context.getWorkbenchFrame().addInternalFrame(frame);
     plot = null;
   } else {
     context.getWorkbenchFrame().warnUser(sWarning);
   }
 }
Ejemplo n.º 2
0
  private JInternalFrame _startJFXImpuestosCRUD() {
    frame = new JInternalFrame("Administrador de impuestos");
    final JFXPanel fxPanel = new JFXPanel();

    frame.setClosable(true);
    frame.add(fxPanel);
    frame.setVisible(true);

    Herramientas.panelCatalogo(frame);
    Principal.getEscritorio().getPanelEscritorio().add(frame);
    frame.setSize(706, 518);
    frame.setPreferredSize(new Dimension(706, 518));
    frame.setResizable(true);
    frame.setVisible(true);
    Herramientas.centrarVentana(frame);
    Herramientas.iconificable(frame);
    frame.toFront();

    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            Scene scene = null;
            try {
              scene = initImpuestosCRUD();
              scene.setFill(null);
              fxPanel.setScene(scene);
            } catch (IOException e) {

            }
          }
        });

    return frame;
  }
Ejemplo n.º 3
0
 protected void showDeployAgentDialog() {
   // TODO Auto-generated method stub
   JInternalFrame fr = new JInternalFrame("Deploy Agent");
   fr.getContentPane().add(new NewAgentPanel());
   fr.pack();
   fr.setClosable(true);
   fr.setIconifiable(true);
   fr.setResizable(true);
   fr.setMaximizable(true);
   fr.setVisible(true);
   jDesktopPane1.add(fr);
 }
 /*
  * Class under test for void void setPalette(boolean)
  */
 public void testSetPalette() {
   TestMetalInternalFrameTitlePane pane = new TestMetalInternalFrameTitlePane(frame);
   frame.setClosable(true);
   frame.setIconifiable(true);
   frame.setMaximizable(true);
   // test set to true
   pane.setPalette(true);
   assertTrue("isPalette is true", pane.isPalette);
   assertTrue("changed close icon", pane.getCloseButton().getIcon() == pane.paletteCloseIcon);
   assertTrue("1 child", pane.getComponentCount() == 1);
   // is layoutContainer called?
   // test set to false
   pane.setPalette(false);
   assertFalse("isPalette is false", pane.isPalette);
   assertTrue("changed close icon", pane.getCloseButton().getIcon() == pane.getCloseIcon());
   assertTrue("3 children", pane.getComponentCount() == 3);
 }
Ejemplo n.º 5
0
 private void showDomainDialog(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_showDomainDialog
   // TODO add your handling code here:
   JInternalFrame fr = new JInternalFrame("Add new Domain");
   fr.getContentPane().add(new NewDomainPanel());
   fr.pack();
   fr.setClosable(true);
   fr.setIconifiable(true);
   fr.setResizable(true);
   fr.setMaximizable(true);
   fr.setVisible(true);
   jDesktopPane1.add(fr);
   GridBagConstraints gc = new GridBagConstraints();
   gc.gridx = 0;
   gc.gridy = GridBagConstraints.RELATIVE;
   gc.insets = new Insets(6, 12, 0, 12);
   gc.fill = GridBagConstraints.HORIZONTAL;
   domainsPanel.add(new JButton("Dynamic"), gc);
 } // GEN-LAST:event_showDomainDialog
    public DialogDecoration() {
      setLayout(new BorderLayout());

      clipboardPanel = new JClipboardPanel();
      clipboardPanel.addPropertyChangeListener(DialogDecoration.this);

      frame = new JInternalFrame("Clipboard");
      frame.setContentPane(clipboardPanel);
      frame.setResizable(true);
      frame.setClosable(true);
      frame.setIconifiable(false);
      frame.pack();
      frame.setVisible(true);

      desktop = new JLayeredPane();
      desktop.setOpaque(false);
      desktop.add(frame);

      add(BorderLayout.CENTER, desktop);
    }
 /*
  * Test MetalInternalFrameTitlePane.MetalTitlePaneLayout class
  */
 public void testMetalTitlePaneLayout() {
   TestMetalInternalFrameTitlePane pane = new TestMetalInternalFrameTitlePane(frame);
   pane.setSize(200, 31);
   LayoutManager layout = pane.getLayout();
   final Rectangle iconButtonBounds = new Rectangle(134, 7, 16, 16);
   final Rectangle maximizeButtonBounds = new Rectangle(156, 7, 16, 16);
   final Rectangle closeButtonBounds = new Rectangle(178, 7, 16, 16);
   // test layoutContainer(): non-iconifiable, non-maximizable, non-closable
   layout.layoutContainer(null);
   //        assertEquals("iconButton", zeroBounds,
   //                     pane.getComponent(0).getBounds());
   //        assertTrue("maximizeButton", pane.getComponent(1).getBounds().
   //                equals(zeroBounds));
   //        assertTrue("closeButton", pane.getComponent(2).getBounds().
   //                equals(zeroBounds));
   // test layoutContainer(): iconifiable, maximizable, closable
   frame.setIconifiable(true);
   frame.setMaximizable(true);
   frame.setClosable(true);
   layout.layoutContainer(pane);
   if (isHarmony()) {
     assertEquals("iconButton", iconButtonBounds, pane.getComponent(0).getBounds());
     assertEquals("maximizeButton", maximizeButtonBounds, pane.getComponent(1).getBounds());
     assertEquals("closeButton", closeButtonBounds, pane.getComponent(2).getBounds());
   }
   // test layoutContainer(): isPalette == true
   pane.setPalette(true);
   layout.layoutContainer(null);
   // these bounds can be changed in the future
   if (isHarmony()) {
     assertEquals(
         "palette: closeButton", new Rectangle(189, 11, 8, 8), pane.getComponent(0).getBounds());
   }
   // minimumLayoutSize(), preferredLayoutSize() implementations
   assertTrue("", layout.minimumLayoutSize(pane) != null);
   assertTrue("", layout.preferredLayoutSize(pane) != null);
 }
Ejemplo n.º 8
0
  public static void init(
      JInternalFrame comp, Thing thing, Container parent, ActionContext actionContext) {
    JComponentCreator.init(comp, thing, parent, actionContext);

    String title = JavaCreator.createText(thing, "title", actionContext);
    if (title != null) {
      comp.setTitle(title);
    }

    Boolean closable = JavaCreator.createBoolean(thing, "closable");
    if (closable != null) {
      comp.setClosable(closable);
    }

    Boolean closed = JavaCreator.createBoolean(thing, "closed");
    if (closed != null) {
      try {
        comp.setClosed(closed);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Cursor cursor = AwtCreator.createCursor(thing, "cursor", actionContext);
    if (cursor != null) {
      comp.setCursor(cursor);
    }

    Integer defaultCloseOperation = null;
    String d = thing.getString("defaultCloseOperation");
    if ("DO_NOTHING_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.DO_NOTHING_ON_CLOSE;
    } else if ("HIDE_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.HIDE_ON_CLOSE;
    } else if ("DISPOSE_ON_CLOSE".equals(d)) {
      defaultCloseOperation = JInternalFrame.DISPOSE_ON_CLOSE;
    }
    if (defaultCloseOperation != null) {
      comp.setDefaultCloseOperation(defaultCloseOperation);
    }

    Boolean focusCycleRoot = JavaCreator.createBoolean(thing, "focusCycleRoot");
    if (focusCycleRoot != null) {
      comp.setFocusCycleRoot(focusCycleRoot);
    }

    Icon frameIcon = SwingCreator.createIcon(thing, "frameIcon", actionContext);
    if (frameIcon != null) {
      comp.setFrameIcon(frameIcon);
    }

    Boolean setIcon = JavaCreator.createBoolean(thing, "setIcon");
    if (setIcon != null) {
      try {
        comp.setIcon(setIcon);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Boolean iconifiable = JavaCreator.createBoolean(thing, "iconifiable");
    if (iconifiable != null) {
      comp.setIconifiable(iconifiable);
    }

    Integer layer = JavaCreator.createInteger(thing, "layer");
    if (layer != null) {
      comp.setLayer(layer);
    }

    Boolean maximizable = JavaCreator.createBoolean(thing, "maximizable");
    if (maximizable != null) {
      comp.setMaximizable(maximizable);
    }

    Boolean maximum = JavaCreator.createBoolean(thing, "maximum");
    if (maximum != null) {
      try {
        comp.setMaximum(maximum);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }

    Boolean resizable = JavaCreator.createBoolean(thing, "resizable");
    if (resizable != null) {
      comp.setResizable(resizable);
    }

    Boolean selected = JavaCreator.createBoolean(thing, "selected");
    if (selected != null) {
      try {
        comp.setSelected(selected);
      } catch (PropertyVetoException e) {
        e.printStackTrace();
      }
    }
  }
 @RunsInEDT
 private static void setClosable(final JInternalFrame internalFrame, final boolean closeable) {
   execute(() -> internalFrame.setClosable(closeable));
 }
Ejemplo n.º 10
0
  public SceneLayoutApp() {
    super();
    new Pair();
    final JFrame frame = new JFrame("Scene Layout");

    final JPanel panel = new JPanel(new BorderLayout());
    frame.setContentPane(panel);
    final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setMaximumSize(screenSize);
    frame.setSize(screenSize);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final JMenuBar mb = new JMenuBar();
    frame.setJMenuBar(mb);

    final JMenu jMenu = new JMenu("File");
    mb.add(jMenu);
    mb.add(new JMenu("Edit"));
    mb.add(new JMenu("Help"));
    JMenu menu = new JMenu("Look and Feel");

    //
    // Get all the available look and feel that we are going to use for
    // creating the JMenuItem and assign the action listener to handle
    // the selection of menu item to change the look and feel.
    //
    UIManager.LookAndFeelInfo[] lookAndFeelInfos = UIManager.getInstalledLookAndFeels();
    for (int i = 0; i < lookAndFeelInfos.length; i++) {
      final UIManager.LookAndFeelInfo lookAndFeelInfo = lookAndFeelInfos[i];
      JMenuItem item = new JMenuItem(lookAndFeelInfo.getName());
      item.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              try {
                //
                // Set the look and feel for the frame and update the UI
                // to use a new selected look and feel.
                //
                UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
                SwingUtilities.updateComponentTreeUI(frame);
              } catch (ClassNotFoundException e1) {
                e1.printStackTrace();
              } catch (InstantiationException e1) {
                e1.printStackTrace();
              } catch (IllegalAccessException e1) {
                e1.printStackTrace();
              } catch (UnsupportedLookAndFeelException e1) {
                e1.printStackTrace();
              }
            }
          });
      menu.add(item);
    }

    mb.add(menu);
    jMenu.add(new JMenuItem(new scene.action.QuitAction()));

    panel.add(new JScrollPane(desktopPane), BorderLayout.CENTER);
    final JToolBar bar = new JToolBar();

    panel.add(bar, BorderLayout.NORTH);

    final JComboBox comboNewWindow =
        new JComboBox(
            new String[] {"320:180", "320:240", "640:360", "640:480", "1280:720", "1920:1080"});

    comboNewWindow.addActionListener(new CreateSceneWindowAction());

    comboNewWindow.setBorder(BorderFactory.createTitledBorder("Create New Window"));
    bar.add(comboNewWindow);
    bar.add(
        new AbstractAction("Progress Bars") {

          /** Invoked when an action occurs. */
          @Override
          public void actionPerformed(ActionEvent e) {
            new ProgressBarAnimator();
          }
        });
    bar.add(
        new AbstractAction("Sliders") {

          /** Invoked when an action occurs. */
          @Override
          public void actionPerformed(ActionEvent e) {
            new SliderBarAnimator();
          }
        });

    final JCheckBox permaViz = new JCheckBox();
    permaViz.setText("Show the dump window");
    permaViz.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

    dumpWindow = new JInternalFrame("perma dump window");
    dumpWindow.setContentPane(new JScrollPane(permText));

    permaViz.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dumpWindow.setVisible(permaViz.isSelected());
          }
        });

    comboNewWindow.setMaximumSize(comboNewWindow.getPreferredSize());

    permaViz.setSelected(false);
    bar.add(new CreateWebViewV1Action());
    bar.add(new CreateWebViewV2Action());
    bar.add(permaViz);
    desktopPane.add(dumpWindow);
    dumpWindow.setSize(400, 400);
    dumpWindow.setResizable(true);
    dumpWindow.setClosable(false);
    dumpWindow.setIconifiable(false);
    final JMenuBar m = new JMenuBar();
    final JMenu cmenu = new JMenu("Create");
    m.add(cmenu);
    final JMenuItem menuItem =
        new JMenuItem(
            new AbstractAction("new") {
              @Override
              public void actionPerformed(ActionEvent e) {
                Runnable runnable =
                    new Runnable() {
                      public void run() {
                        Object[] in = (Object[]) XSTREAM.fromXML(permText.getText());

                        final JInternalFrame ff = new JInternalFrame();

                        final ScenePanel c = new ScenePanel();
                        ff.setContentPane(c);
                        desktopPane.add(ff);
                        final Dimension d = (Dimension) in[0];
                        c.setMaximumSize(d);
                        c.setPreferredSize(d);

                        ff.setSize(d.width + 50, d.height + 50);
                        ScenePanel.panes.put(c, (List<Pair<Point, ArrayList<URL>>>) in[1]);

                        c.invalidate();
                        c.repaint();

                        ff.pack();
                        ff.setClosable(true);

                        ff.setMaximizable(false);
                        ff.setIconifiable(false);
                        ff.setResizable(false);
                        ff.show();
                      }
                    };

                SwingUtilities.invokeLater(runnable);
              }
            });
    cmenu.add(menuItem);
    //        JMenuBar menuBar = new JMenuBar();

    //        getContentPane().add(menuBar);

    dumpWindow.setJMenuBar(m);
    frame.setVisible(true);
  }
Ejemplo n.º 11
0
 /** Run the task. */
 public void run() {
   final BoundedRangeModel model = progressBar.getModel();
   switch (task) {
     case -LABEL:
       {
         value = description.getText();
         return;
       }
     case +LABEL:
       {
         description.setText((String) value);
         return;
       }
     case PROGRESS:
       {
         model.setValue(((Integer) value).intValue());
         progressBar.setIndeterminate(false);
         return;
       }
     case STARTED:
       {
         model.setRangeProperties(0, 1, 0, 100, false);
         window.setVisible(true);
         break; // Need further action below.
       }
     case COMPLETE:
       {
         model.setRangeProperties(100, 1, 0, 100, false);
         window.setVisible(warningArea != null);
         cancel.setEnabled(false);
         break; // Need further action below.
       }
   }
   /*
    * Some of the tasks above requires an action on the window, which may be a JDialog or
    * a JInternalFrame. We need to determine the window type before to apply the action.
    */
   synchronized (ProgressWindow.this) {
     if (window instanceof JDialog) {
       final JDialog window = (JDialog) ProgressWindow.this.window;
       switch (task) {
         case -TITLE:
           {
             value = window.getTitle();
             return;
           }
         case +TITLE:
           {
             window.setTitle((String) value);
             return;
           }
         case STARTED:
           {
             window.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
             return;
           }
         case COMPLETE:
           {
             window.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
             return;
           }
         case DISPOSE:
           {
             window.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
             if (warningArea == null || !window.isVisible()) {
               window.dispose();
             }
             return;
           }
       }
     } else {
       final JInternalFrame window = (JInternalFrame) ProgressWindow.this.window;
       switch (task) {
         case -TITLE:
           {
             value = window.getTitle();
             return;
           }
         case +TITLE:
           {
             window.setTitle((String) value);
             return;
           }
         case STARTED:
           {
             window.setClosable(false);
             return;
           }
         case COMPLETE:
           {
             window.setClosable(true);
             return;
           }
         case DISPOSE:
           {
             window.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
             if (warningArea == null || !window.isVisible()) {
               window.dispose();
             }
             return;
           }
       }
     }
     /*
      * Si la tâche spécifiée n'est aucune des tâches énumérées ci-haut,
      * on supposera que l'on voulait afficher un message d'avertissement.
      */
     if (warningArea == null) {
       final JTextArea warningArea = new JTextArea();
       final JScrollPane scroll = new JScrollPane(warningArea);
       final JPanel namedArea = new JPanel(new BorderLayout());
       ProgressWindow.this.warningArea = warningArea;
       warningArea.setFont(Font.getFont("Monospaced"));
       warningArea.setEditable(false);
       namedArea.setBorder(BorderFactory.createEmptyBorder(0, HMARGIN, VMARGIN, HMARGIN));
       namedArea.add(new JLabel(getString(VocabularyKeys.WARNING)), BorderLayout.NORTH);
       namedArea.add(scroll, BorderLayout.CENTER);
       content.add(namedArea, BorderLayout.CENTER);
       if (window instanceof JDialog) {
         final JDialog window = (JDialog) ProgressWindow.this.window;
         window.setResizable(true);
       } else {
         final JInternalFrame window = (JInternalFrame) ProgressWindow.this.window;
         window.setResizable(true);
       }
       window.setSize(WIDTH, HEIGHT + WARNING_HEIGHT);
       window.setVisible(true); // Seems required in order to force relayout.
     }
     final JTextArea warningArea = (JTextArea) ProgressWindow.this.warningArea;
     warningArea.append((String) value);
   }
 }