Exemplo n.º 1
0
 private void jbInit() throws Exception {
   box1 = Box.createVerticalBox();
   this.getContentPane().setLayout(borderLayout1);
   close.setText("Close");
   close.addActionListener(new CellHelpWindow_close_actionAdapter(this));
   jLabel1.setText("Recommendation");
   jLabel2.setText("Description");
   jPanel1.setLayout(borderLayout2);
   jPanel2.setLayout(borderLayout3);
   description.setText("jTextPane1");
   description.setContentType("text/html");
   scp1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   scp1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   scp1.setToolTipText("");
   recom.setText("");
   recom.setContentType("text/html");
   this.getContentPane().add(box1, BorderLayout.CENTER);
   box1.add(jPanel1, null);
   box1.add(jPanel2, null);
   this.getContentPane().add(jPanel3, BorderLayout.SOUTH);
   jPanel3.add(close, null);
   jPanel2.add(jLabel1, BorderLayout.NORTH);
   jPanel2.add(scp2, BorderLayout.CENTER);
   scp2.getViewport().add(recom, null);
   jPanel2.add(scp2, BorderLayout.CENTER);
   jPanel1.add(jLabel2, BorderLayout.NORTH);
   jPanel1.add(scp1, BorderLayout.CENTER);
   scp1.getViewport().add(description, null);
 }
  /**
   * @param logs
   * @param firstOrg
   * @param secondOrg
   * @return
   */
  private ProMSplitPane differentConditionsPanelCreator(
      OrganizationalLogs logs, int firstOrg, int secondOrg) {
    ProMSplitPane splitPanelRefinedActivity = new ProMSplitPane();
    splitPanelRefinedActivity.setBackground(null);

    ProMTable comp = differentConditionsTableCreator(logs, firstOrg, secondOrg);
    if (comp == null) return null;

    JTextPane textField = new JTextPane();
    textField.setContentType("text/html");
    textField.setText(
        fontBlack6
            + "Different Conditions for Occurrence ("
            + comp.getTable().getRowCount()
            + ")</font><hr>"
            + fontBlack4
            + "Set of dependencies are same for two processes; however, occurrence condition is different in organizations. In the list you can see different occurrence conditions in two organizations as "
            + logs.organizationNames.get(firstOrg)
            + "(Selected) and "
            + logs.organizationNames.get(secondOrg)
            + "(Other).");
    textField.setEditable(false);
    textField.setBackground(new Color(192, 192, 192));
    JScrollPane scrollPane = new JScrollPane(textField);
    scrollPane.setPreferredSize(new Dimension(500, 0));

    splitPanelRefinedActivity.setLeftComponent(comp);
    splitPanelRefinedActivity.setRightComponent(scrollPane);
    return splitPanelRefinedActivity;
  }
  /**
   * @param logs
   * @param firstOrg
   * @param secondOrg
   * @return
   */
  private ProMSplitPane refinedActivityPanelCreator(
      OrganizationalLogs logs, int firstOrg, int secondOrg) {
    ProMSplitPane splitPanelRefinedActivity = new ProMSplitPane();
    splitPanelRefinedActivity.setBackground(null);

    ProMTable comp = refinedActivityTableCreator(logs, firstOrg, secondOrg);
    if (comp == null) return null;

    JTextPane textField = new JTextPane();
    textField.setContentType("text/html");
    textField.setText(
        fontBlack6
            + "Refined Activities ("
            + comp.getTable().getRowCount()
            + ")</font><hr>"
            + fontBlack4
            + "An activity exists in one process but, as an equivalent, a collection of activitiesare existing in the other process to achieve the same task. In the list you can see the refined activity in "
            + logs.organizationNames.get(firstOrg)
            + " and a potential list of activities in "
            + logs.organizationNames.get(secondOrg)
            + ".");
    textField.setEditable(false);
    textField.setBackground(new Color(192, 192, 192));
    JScrollPane scrollPane = new JScrollPane(textField);
    scrollPane.setPreferredSize(new Dimension(500, 0));

    splitPanelRefinedActivity.setLeftComponent(comp);
    splitPanelRefinedActivity.setRightComponent(scrollPane);
    return splitPanelRefinedActivity;
  }
Exemplo n.º 4
0
  private JPanel createCentrePanel(YDataStateException exception) {
    JPanel centrePanel = new JPanel(new GridLayout(1, 2));

    JPanel msgPanel = new JPanel(new BorderLayout());
    msgPanel.setBackground(YAdminGUI._apiColour);
    msgPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "Schema for completing task"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane msgTextPane = new JTextPane();
    msgTextPane.setContentType("text/plain");
    msgTextPane.setFont(new Font("courier", Font.PLAIN, 12));
    msgTextPane.setForeground(Color.RED);

    msgTextPane.setText(exception.getMessage());
    msgTextPane.setEditable(false);
    msgTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel = new JPanel();
    noWrapPanel.setLayout(new BorderLayout());
    noWrapPanel.add(msgTextPane);
    msgPanel.add(new JScrollPane(noWrapPanel));

    centrePanel.add(msgPanel, BorderLayout.NORTH);
    return centrePanel;
  }
  /**
   * @param logs
   * @param firstOrg
   * @param secondOrg
   * @return
   */
  private ProMSplitPane additionalDependencyPanelCreator(
      OrganizationalLogs logs, int firstOrg, int secondOrg) {
    ProMSplitPane splitPanelRefinedActivity = new ProMSplitPane();
    splitPanelRefinedActivity.setBackground(null);

    ProMTable comp = additionalDependencyTableCreator(logs, firstOrg, secondOrg);
    if (comp == null) return null;

    JTextPane textField = new JTextPane();
    textField.setContentType("text/html");
    textField.setText(
        fontBlack6
            + "Additional Dependencies ("
            + comp.getTable().getRowCount()
            + ")</font><hr>"
            + fontBlack4
            + " This pattern is a special case of different dependencies where one set of activities includes the other and results with additional dependencies. In the list you can see additional dependency sets in two organizations as "
            + logs.organizationNames.get(firstOrg)
            + "(Selected) and "
            + logs.organizationNames.get(secondOrg)
            + "(Other).");
    textField.setEditable(false);
    textField.setBackground(new Color(192, 192, 192));
    JScrollPane scrollPane = new JScrollPane(textField);
    scrollPane.setPreferredSize(new Dimension(500, 0));

    splitPanelRefinedActivity.setLeftComponent(comp);
    splitPanelRefinedActivity.setRightComponent(scrollPane);
    return splitPanelRefinedActivity;
  }
Exemplo n.º 6
0
  public Panel_21(String password) {
    this.password = password;
    setBackground(Color.WHITE);
    setSize(300, 200);
    setBorder(BorderFactory.createLineBorder(Color.lightGray));

    JTextPane pane1 = new JTextPane();
    pane1.setContentType("text/html");
    String text =
        "<p><b><font color = '#007fff'>Allow Remote Control</font></b></p><p>Please tell your partner the following IP and<br>"
            + "password if your would like to allow remote<br>"
            + "control.</p>";
    pane1.setText(text);
    pane1.setEditable(false);
    add(pane1);
  }
  /**
   * @param logs
   * @param firstOrg
   * @param secondOrg
   * @return
   */
  private ProMSplitPane skippedActivityPanelCreator(
      OrganizationalLogs logs, int firstOrg, int secondOrg) {
    ProMSplitPane splitPanelSkippedActivity = new ProMSplitPane();
    splitPanelSkippedActivity.setBackground(null);

    ProMTable comp = null;
    if (firstOrg == secondOrg) {
      comp = skippedActivityTableCreator(logs, firstOrg);
    } else {
      comp = skippedActivityTableCreator(logs, secondOrg);
    }
    if (comp == null) return null;

    JTextPane textField = new JTextPane();
    textField.setContentType("text/html");
    if (firstOrg == secondOrg) {
      textField.setText(
          fontBlack6
              + "Skipped Activities ("
              + comp.getTable().getRowCount()
              + ") </font><hr>"
              + fontBlack4
              + " An activity exists in one process but no equivalent activity is found in the other process. In the list you can see the skipped activities in "
              + logs.organizationNames.get(firstOrg)
              + ".");
    } else {
      textField.setText(
          fontBlack6
              + "Skipped Activities ("
              + comp.getTable().getRowCount()
              + ")</font><hr>"
              + fontBlack4
              + " An activity exists in one process but no equivalent activity is found in the other process. In the list you can see the skipped activities in "
              + logs.organizationNames.get(secondOrg)
              + " compared to "
              + logs.organizationNames.get(firstOrg)
              + ".");
    }
    textField.setEditable(false);
    textField.setBackground(new Color(192, 192, 192));
    JScrollPane scrollPane = new JScrollPane(textField);
    scrollPane.setPreferredSize(new Dimension(500, 0));

    splitPanelSkippedActivity.setLeftComponent(comp);
    splitPanelSkippedActivity.setRightComponent(scrollPane);
    return splitPanelSkippedActivity;
  }
  @Override
  protected Object doInBackground() {
    URL url = null;
    try {
      url = new URL(this.url);

      if (MirrorUtils.isAddressReachable(url.toString())) {
        editorPane.setVisible(false);
        editorPane.setContentType("text/html");
        // editorPane.setEditable(false);
        ToolTipManager.sharedInstance().registerComponent(editorPane);

        editorPane.addHyperlinkListener(
            new HyperlinkListener() {
              @Override
              public void hyperlinkUpdate(HyperlinkEvent e) {

                if (HyperlinkEvent.EventType.ACTIVATED == e.getEventType()) {
                  try {
                    if (Desktop.isDesktopSupported()) {
                      Desktop.getDesktop().browse(e.getURL().toURI());
                    }
                  } catch (IOException e1) {
                    e1.printStackTrace();
                  } catch (URISyntaxException e1) {
                    e1.printStackTrace();
                  }
                }
              }
            });

        editorPane.addPropertyChangeListener(this);
        editorPane.setPage(url);
      } else {
        editorPane.setText("Oh Noes! Our Tumblr Feed is Down!");
      }
    } catch (MalformedURLException e1) {
      e1.printStackTrace();
    } catch (IOException e1) {
      editorPane.setText("Oh Noes! Our Tumblr Server is Down!");
      Util.log("Tumbler log @ '%' not avaliable.", url);
    }

    return null;
  }
Exemplo n.º 9
0
  @Override
  public JComponent layoutDialogContent() {
    final JPanel panel = new JPanel(new MigLayout("ins 5,wrap 1", "[fill,grow]"));

    ImageIcon imageIcon = null;

    if (this.imagefile != null && this.imagefile.exists()) {
      imageIcon = new ImageIcon(this.imagefile.getAbsolutePath());
    } else {
      imageIcon = NewTheme.I().getIcon("ocr", 0);
    }

    final int size =
        SubConfiguration.getConfig("JAC").getIntegerProperty(Configuration.PARAM_CAPTCHA_SIZE, 100);
    if (size != 100) {
      imageIcon =
          new ImageIcon(
              imageIcon
                  .getImage()
                  .getScaledInstance(
                      (int) (imageIcon.getIconWidth() * size / 100.0f),
                      (int) (imageIcon.getIconHeight() * size / 100.0f),
                      Image.SCALE_SMOOTH));
    }

    final JLabel captcha = new JLabel(imageIcon);
    captcha.addMouseListener(this);
    captcha.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
    captcha.setToolTipText(this.explain);

    if (this.explain != null) {
      final JTextPane tf = new JTextPane();
      tf.setBorder(null);
      tf.setBackground(null);
      tf.setContentType("text/html");
      tf.setOpaque(false);
      tf.putClientProperty("Synthetica.opaque", Boolean.FALSE);
      tf.setText(this.explain);
      tf.setEditable(false);
      panel.add(tf, "");
    }
    panel.add(captcha, "w pref!, h pref!, alignx center");

    return panel;
  }
Exemplo n.º 10
0
  /** Constructor. */
  public LegendPanel(int mode, final CyServices cyServices) {
    this.setLayout(new BorderLayout());

    JTextPane textPane = new JTextPane();
    textPane.setEditable(false);
    textPane.setContentType("text/html");
    textPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

    URL legendUrl;
    if (mode == BIOPAX_LEGEND) {
      legendUrl = LegendPanel.class.getResource("legend.html");
    } else {
      legendUrl = LegendPanel.class.getResource("binary_legend.html");
    }
    StringBuffer temp = new StringBuffer();
    temp.append("<html><body>");

    try {
      String legendHtml = retrieveDocument(legendUrl.toString());
      temp.append(legendHtml);
    } catch (Exception e) {
      temp.append("Could not load legend... " + e.toString());
    }

    temp.append("</body></html>");
    textPane.setText(temp.toString());

    textPane.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
            if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              String name = hyperlinkEvent.getDescription();
              if (name.equalsIgnoreCase("filter")) {
                new EdgeFilterUi(cyServices.applicationManager.getCurrentNetwork(), cyServices);
              }
            }
          }
        });

    BioPaxDetailsPanel.modifyStyleSheetForSingleDocument(textPane);

    JScrollPane scrollPane = new JScrollPane(textPane);
    this.add(scrollPane, BorderLayout.CENTER);
  }
Exemplo n.º 11
0
  public FrameLyric() {
    setSize(400, 500);
    setVisible(true);
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    setLocationRelativeTo(null);
    setIconImage(
        Toolkit.getDefaultToolkit().getImage((getClass().getResource("/images/lyrics.png"))));

    Container container = getContentPane();
    container.setLayout(new BorderLayout());
    container.add(Box.createRigidArea(new Dimension(5, 0)), BorderLayout.WEST);
    container.add(Box.createRigidArea(new Dimension(5, 0)), BorderLayout.EAST);
    container.add(Box.createRigidArea(new Dimension(0, 5)), BorderLayout.NORTH);
    container.add(scrollPane = new JScrollPane(lyric = new JTextPane()));
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    lyric.setEditable(false);
    lyric.setContentType("text/html");
    container.add(Box.createRigidArea(new Dimension(0, 5)), BorderLayout.SOUTH);
  }
Exemplo n.º 12
0
  private void initComponent() {
    JTextPane helpContentTextPane = new JTextPane();
    helpContentTextPane.setEditable(false);
    helpContentTextPane.setContentType("text/html;charset=utf-8");
    try {
      helpContentTextPane.setText(FileUtil.readFileToString(Config.HELP_FILE_PATH));
    } catch (IOException e) {
      e.printStackTrace();
    }

    JScrollPane scrollPane = new JScrollPane(helpContentTextPane);
    scrollPane.setAutoscrolls(true);

    Container c = this.getContentPane();
    c.add(scrollPane, BorderLayout.CENTER);

    this.setTitle("Help");
    this.setIconImage(new ImageIcon(Config.LOGO_IMG).getImage());
    this.setSize(Config.HELP_DIALOG_WIDTH, Config.HELP_DIALOG_HEIGHT);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  }
Exemplo n.º 13
0
 /**
  * This method initializes jTextPane
  *
  * @return javax.swing.JTextPane
  */
 private JTextPane getJTextPane() {
   if (jTextPane == null) {
     jTextPane = new JTextPane();
     jTextPane.setContentType("text/html");
     jTextPane.setText(helpText);
     jTextPane.addHyperlinkListener(
         new HyperlinkListener() {
           public void hyperlinkUpdate(HyperlinkEvent e) {
             if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
               try {
                 FileOpener opener = new MultiOSFileOpener();
                 opener.open(e.getURL().toString());
               } catch (Exception ex) {
                 logger.error("", ex);
               }
             }
           }
         });
     jTextPane.setEditable(false);
   }
   return jTextPane;
 }
Exemplo n.º 14
0
  private void decompile(Map params) {
    try {
      ClazzSourceView csv = ClazzSourceViewFactory.getClazzSourceView(clazz);
      csv.setDecompileParameters(params);
      source = csv.getSource();

      String sourceText = source;

      sourceText = sourceText.replaceAll(" ", "&nbsp;");
      sourceText = sourceText.replaceAll("<", "&lt;");
      sourceText = sourceText.replaceAll(">", "&gt;");
      sourceText = sourceText.replaceAll("\n", "<BR>");
      sourcePane.setText(sourceText);
      sourcePane.setCaretPosition(0);
    } catch (Throwable ex) {
      if (Utils.hasDebug()) {
        ex.printStackTrace();
      }
      sourcePane.setText("Exception occured while decompiling");

      String link = "http://sourceforge.net/tracker/?group_id=226227&atid=1066690";
      String exception = unpackException(ex);

      JTextPane text = new JTextPane();
      text.setContentType("text/html");
      text.setText(
          "<html>Error occured while decompiling!<BR>Please submit bug at <b>"
              + link
              + "</b><BR>"
              + exception
              + "</html>");
      text.setEditable(false);
      text.setBackground(this.getBackground());

      JOptionPane.showMessageDialog(this, text, "Error", JOptionPane.ERROR_MESSAGE);

      throw new IllegalArgumentException("Error decompiling");
    }
  }
Exemplo n.º 15
0
  /** Create the frame. */
  public PreferencesWindow(
      final Preferences prefs, MetadataInfo defaultMetadata, final Frame owner) {
    super(owner, true);
    setLocationRelativeTo(owner);
    long startTime = System.nanoTime();

    final Future<HttpResponse> status = checkForUpdates();
    isWindows = System.getProperty("os.name").startsWith("Windows");
    this.prefs = prefs;
    if (defaultMetadata != null) {
      this.defaultMetadata = defaultMetadata;
    } else {
      this.defaultMetadata = new MetadataInfo();
    }
    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent arg0) {
            save();
            if (onSave != null) {
              onSave.run();
            }
          }
        });
    setTitle("Preferences");
    setMinimumSize(new Dimension(640, 480));
    contentPane = new JPanel();
    setContentPane(contentPane);

    GridBagLayout gbl_contentPane = new GridBagLayout();
    gbl_contentPane.columnWidths = new int[] {725, 0};
    gbl_contentPane.rowHeights = new int[] {389, 29, 0};
    gbl_contentPane.columnWeights = new double[] {0.0, Double.MIN_VALUE};
    gbl_contentPane.rowWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    contentPane.setLayout(gbl_contentPane);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    GridBagConstraints gbc_tabbedPane = new GridBagConstraints();
    gbc_tabbedPane.weighty = 1.0;
    gbc_tabbedPane.weightx = 1.0;
    gbc_tabbedPane.fill = GridBagConstraints.BOTH;
    gbc_tabbedPane.insets = new Insets(0, 0, 5, 0);
    gbc_tabbedPane.gridx = 0;
    gbc_tabbedPane.gridy = 0;
    contentPane.add(tabbedPane, gbc_tabbedPane);

    JPanel panelGeneral = new JPanel();
    tabbedPane.addTab("General", null, panelGeneral, null);
    panelGeneral.setLayout(new MigLayout("", "[grow]", "[][]"));

    JPanel panel_1 = new JPanel();
    panel_1.setBorder(
        new TitledBorder(
            new LineBorder(new Color(184, 207, 229)),
            "On Save ...",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(51, 51, 51)));
    panel_1.setLayout(new MigLayout("", "[]", "[][]"));

    onsaveCopyDocumentTo = new JCheckBox("Copy Document To XMP");
    onsaveCopyDocumentTo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (onsaveCopyDocumentTo.isSelected()) {
              onsaveCopyXmpTo.setSelected(false);
            }
            copyBasicToXmp = onsaveCopyDocumentTo.isSelected();
            copyXmpToBasic = onsaveCopyXmpTo.isSelected();
          }
        });
    panel_1.add(onsaveCopyDocumentTo, "cell 0 0,alignx left,aligny top");
    onsaveCopyDocumentTo.setSelected(false);

    onsaveCopyXmpTo = new JCheckBox("Copy XMP To Document");
    onsaveCopyXmpTo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (onsaveCopyXmpTo.isSelected()) {
              onsaveCopyDocumentTo.setSelected(false);
            }
            copyBasicToXmp = onsaveCopyDocumentTo.isSelected();
            copyXmpToBasic = onsaveCopyXmpTo.isSelected();
          }
        });
    panel_1.add(onsaveCopyXmpTo, "cell 0 1");
    onsaveCopyXmpTo.setSelected(false);
    panelGeneral.add(panel_1, "flowx,cell 0 0,alignx left,aligny top");

    onsaveCopyXmpTo.setSelected(prefs.getBoolean("onsaveCopyXmpTo", false));
    onsaveCopyDocumentTo.setSelected(prefs.getBoolean("onsaveCopyBasicTo", false));

    JPanel panel = new JPanel();
    panel.setBorder(
        new TitledBorder(
            new LineBorder(new Color(184, 207, 229)),
            "Rename template",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(51, 51, 51)));
    panelGeneral.add(panel, "cell 0 1,grow");
    panel.setLayout(new MigLayout("", "[grow]", "[][][]"));

    lblNewLabel = new JLabel("Preview:");
    panel.add(lblNewLabel, "cell 0 1");

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setViewportBorder(null);
    panel.add(scrollPane, "cell 0 2,grow");

    JTextPane txtpnAaa = new JTextPane();
    txtpnAaa.setBackground(UIManager.getColor("Panel.background"));
    txtpnAaa.setEditable(false);
    scrollPane.setViewportView(txtpnAaa);
    txtpnAaa.setContentType("text/html");
    txtpnAaa.setText(
        "Supported fields:<br>\n<pre>\n<i>"
            + CommandLine.mdFieldsHelpMessage(60, "  {", "}", false)
            + "</i></pre>");
    txtpnAaa.setFont(UIManager.getFont("TextPane.font"));
    txtpnAaa.setCaretPosition(0);

    comboBox = new JComboBox();
    comboBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            showPreview((String) getRenameTemplateCombo().getModel().getSelectedItem());
          }
        });
    comboBox.setEditable(true);
    comboBox.setModel(
        new DefaultComboBoxModel(
            new String[] {
              "", "{doc.author} - {doc.title}.pdf", "{doc.author} - {doc.creationDate}.pdf"
            }));
    panel.add(comboBox, "cell 0 0,growx");

    JPanel saveActionPanel = new JPanel();
    saveActionPanel.setBorder(
        new TitledBorder(
            null, "Default save action", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelGeneral.add(saveActionPanel, "cell 0 0");
    saveActionPanel.setLayout(new MigLayout("", "[][]", "[][]"));

    final JRadioButton rdbtnSave = new JRadioButton("Save");

    buttonGroup.add(rdbtnSave);
    saveActionPanel.add(rdbtnSave, "flowy,cell 0 0,alignx left,aligny top");

    final JRadioButton rdbtnSaveAndRename = new JRadioButton("Save & rename");
    rdbtnSaveAndRename.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {}
        });
    buttonGroup.add(rdbtnSaveAndRename);

    final JRadioButton rdbtnSaveAs = new JRadioButton("Save as ...");
    buttonGroup.add(rdbtnSaveAs);

    saveActionPanel.add(rdbtnSaveAndRename, "cell 0 0,alignx left,aligny top");

    saveActionPanel.add(rdbtnSaveAs, "cell 1 0,aligny top");
    final JTextComponent tcA = (JTextComponent) comboBox.getEditor().getEditorComponent();

    JPanel panelDefaults = new JPanel();
    tabbedPane.addTab("Defaults", null, panelDefaults, null);
    GridBagLayout gbl_panelDefaults = new GridBagLayout();
    gbl_panelDefaults.columnWidths = new int[] {555, 0};
    gbl_panelDefaults.rowHeights = new int[] {32, 100, 0};
    gbl_panelDefaults.columnWeights = new double[] {0.0, Double.MIN_VALUE};
    gbl_panelDefaults.rowWeights = new double[] {0.0, Double.MIN_VALUE};
    panelDefaults.setLayout(gbl_panelDefaults);

    JLabel lblDefineHereDefault =
        new JLabel(
            "Define here default values for the fields you would like prefilled if not set in the PDF document ");
    GridBagConstraints gbc_lblDefineHereDefault = new GridBagConstraints();
    gbc_lblDefineHereDefault.insets = new Insets(5, 5, 0, 0);
    gbc_lblDefineHereDefault.weightx = 1.0;
    gbc_lblDefineHereDefault.anchor = GridBagConstraints.NORTH;
    gbc_lblDefineHereDefault.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblDefineHereDefault.gridx = 0;
    gbc_lblDefineHereDefault.gridy = 0;
    panelDefaults.add(lblDefineHereDefault, gbc_lblDefineHereDefault);

    GridBagConstraints gbc_lblDefineHereDefault1 = new GridBagConstraints();
    gbc_lblDefineHereDefault1.weightx = 1.0;
    gbc_lblDefineHereDefault1.weighty = 1.0;
    gbc_lblDefineHereDefault1.anchor = GridBagConstraints.NORTH;
    gbc_lblDefineHereDefault1.fill = GridBagConstraints.BOTH;
    gbc_lblDefineHereDefault1.gridx = 0;
    gbc_lblDefineHereDefault1.gridy = 1;
    defaultMetadataPane = new MetadataEditPane();

    panelDefaults.add(defaultMetadataPane.tabbedaPane, gbc_lblDefineHereDefault1);

    JPanel panelOsIntegration = new JPanel();
    tabbedPane.addTab("Os Integration", null, panelOsIntegration, null);
    panelOsIntegration.setLayout(new MigLayout("", "[grow]", "[grow]"));

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(
        new TitledBorder(
            new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Explorer context menu (Windows only)",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 0)));
    panelOsIntegration.add(panel_2, "cell 0 0,grow");
    panel_2.setLayout(new MigLayout("", "[][]", "[growprio 50,grow][growprio 50,grow]"));

    JButton btnRegister = new JButton("Add to context menu");
    btnRegister.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              WindowsRegisterContextMenu.register();
            } catch (Exception e1) {
              // StringWriter sw = new StringWriter();
              // PrintWriter pw = new PrintWriter(sw);
              // e1.printStackTrace(pw);
              // JOptionPane.showMessageDialog(owner,
              // "Failed to register context menu:\n" + e1.toString()
              // +"\n" +sw.toString());
              JOptionPane.showMessageDialog(
                  owner, "Failed to register context menu:\n" + e1.toString());
              e1.printStackTrace();
            }
          }
        });
    panel_2.add(btnRegister, "cell 0 0,growx,aligny center");

    JButton btnUnregister = new JButton("Remove from context menu");
    btnUnregister.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WindowsRegisterContextMenu.unregister();
          }
        });

    final JLabel lblNewLabel_1 = new JLabel("");
    panel_2.add(lblNewLabel_1, "cell 1 0 1 2");

    panel_2.add(btnUnregister, "cell 0 1,growx,aligny center");

    btnRegister.setEnabled(isWindows);
    btnUnregister.setEnabled(isWindows);

    JPanel panelBatchLicense = new JPanel();
    tabbedPane.addTab("License", null, panelBatchLicense, null);
    GridBagLayout gbl_panelBatchLicense = new GridBagLayout();
    gbl_panelBatchLicense.columnWidths = new int[] {0, 0, 0};
    gbl_panelBatchLicense.rowHeights = new int[] {0, 0, 0, 0, 0};
    gbl_panelBatchLicense.columnWeights = new double[] {0.0, 1.0, Double.MIN_VALUE};
    gbl_panelBatchLicense.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    panelBatchLicense.setLayout(gbl_panelBatchLicense);

    JTextPane txtpnEnterLicenseInformation = new JTextPane();
    txtpnEnterLicenseInformation.setEditable(false);
    txtpnEnterLicenseInformation.setBackground(UIManager.getColor("Panel.background"));
    txtpnEnterLicenseInformation.setContentType("text/html");
    txtpnEnterLicenseInformation.setText(
        "<h3 align='center'>Enter license information below to use batch operations.</h3><p align='center'>You can get license at <a href=\""
            + Constants.batchLicenseUrl
            + "\">"
            + Constants.batchLicenseUrl
            + "</a></p>");
    GridBagConstraints gbc_txtpnEnterLicenseInformation = new GridBagConstraints();
    gbc_txtpnEnterLicenseInformation.gridwidth = 2;
    gbc_txtpnEnterLicenseInformation.insets = new Insets(15, 0, 5, 0);
    gbc_txtpnEnterLicenseInformation.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtpnEnterLicenseInformation.gridx = 0;
    gbc_txtpnEnterLicenseInformation.gridy = 0;
    panelBatchLicense.add(txtpnEnterLicenseInformation, gbc_txtpnEnterLicenseInformation);
    txtpnEnterLicenseInformation.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
              return;
            }
            if (!java.awt.Desktop.isDesktopSupported()) {
              return;
            }
            java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
            if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
              return;
            }

            try {
              java.net.URI uri = e.getURL().toURI();
              desktop.browse(uri);
            } catch (Exception e1) {

            }
          }
        });
    JLabel lblNewLabel_2 = new JLabel("Email");
    GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
    gbc_lblNewLabel_2.insets = new Insets(15, 15, 5, 5);
    gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST;
    gbc_lblNewLabel_2.gridx = 0;
    gbc_lblNewLabel_2.gridy = 1;
    panelBatchLicense.add(lblNewLabel_2, gbc_lblNewLabel_2);

    emailField = new JTextField();
    GridBagConstraints gbc_emailField = new GridBagConstraints();
    gbc_emailField.insets = new Insets(15, 0, 5, 15);
    gbc_emailField.fill = GridBagConstraints.HORIZONTAL;
    gbc_emailField.gridx = 1;
    gbc_emailField.gridy = 1;
    panelBatchLicense.add(emailField, gbc_emailField);
    emailField.setColumns(10);
    emailField.setText(Main.getPreferences().get("email", ""));
    emailField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void removeUpdate(DocumentEvent e) {
                updateLicense();
              }

              @Override
              public void insertUpdate(DocumentEvent e) {
                updateLicense();
              }

              @Override
              public void changedUpdate(DocumentEvent e) {}
            });

    JLabel lblLicenseKey = new JLabel("License key");
    GridBagConstraints gbc_lblLicenseKey = new GridBagConstraints();
    gbc_lblLicenseKey.anchor = GridBagConstraints.EAST;
    gbc_lblLicenseKey.insets = new Insets(0, 15, 5, 5);
    gbc_lblLicenseKey.gridx = 0;
    gbc_lblLicenseKey.gridy = 2;
    panelBatchLicense.add(lblLicenseKey, gbc_lblLicenseKey);

    keyField = new JTextField();
    GridBagConstraints gbc_keyField = new GridBagConstraints();
    gbc_keyField.insets = new Insets(0, 0, 5, 15);
    gbc_keyField.fill = GridBagConstraints.HORIZONTAL;
    gbc_keyField.gridx = 1;
    gbc_keyField.gridy = 2;
    panelBatchLicense.add(keyField, gbc_keyField);
    keyField.setColumns(10);
    keyField.setText(Main.getPreferences().get("key", ""));
    keyField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void removeUpdate(DocumentEvent e) {
                updateLicense();
              }

              @Override
              public void insertUpdate(DocumentEvent e) {
                updateLicense();
              }

              @Override
              public void changedUpdate(DocumentEvent e) {}
            });

    labelLicenseStatus = new JLabel("No License");
    GridBagConstraints gbc_labelLicenseStatus = new GridBagConstraints();
    gbc_labelLicenseStatus.gridwidth = 2;
    gbc_labelLicenseStatus.insets = new Insets(30, 15, 0, 15);
    gbc_labelLicenseStatus.gridx = 0;
    gbc_labelLicenseStatus.gridy = 3;
    panelBatchLicense.add(labelLicenseStatus, gbc_labelLicenseStatus);

    JScrollPane scrollPane_1 = new JScrollPane();
    tabbedPane.addTab("About", null, scrollPane_1, null);

    txtpnDf = new JTextPane();
    txtpnDf.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
              return;
            }
            if (!java.awt.Desktop.isDesktopSupported()) {
              return;
            }
            java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
            if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
              return;
            }

            try {
              java.net.URI uri = e.getURL().toURI();
              desktop.browse(uri);
            } catch (Exception e1) {

            }
          }
        });
    txtpnDf.setContentType("text/html");
    txtpnDf.setEditable(false);
    txtpnDf.setText(
        aboutMsg =
            "<h1 align=center>Pdf Metadata editor</h1>\n\n<p align=center><a href=\"http://broken-by.me/pdf-metadata-editor/\">http://broken-by.me/pdf-metadata-editor/</a></p>\n<br>\n<p align=center>If you have suggestions, found bugs or just want to share some idea about it you can write me at : <a href=\"mailto:[email protected]\"/>[email protected]</a></p>\n<br>");
    scrollPane_1.setViewportView(txtpnDf);

    JPanel panel_3 = new JPanel();
    GridBagConstraints gbc_panel_3 = new GridBagConstraints();
    gbc_panel_3.insets = new Insets(0, 5, 0, 5);
    gbc_panel_3.fill = GridBagConstraints.BOTH;
    gbc_panel_3.gridx = 0;
    gbc_panel_3.gridy = 1;
    contentPane.add(panel_3, gbc_panel_3);
    panel_3.setLayout(new BorderLayout(0, 0));

    JButton btnClose = new JButton("Close");
    panel_3.add(btnClose, BorderLayout.EAST);

    updateStatusLabel = new JLabel("...");
    panel_3.add(updateStatusLabel, BorderLayout.WEST);
    btnClose.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false);
            save();
          }
        });

    ActionListener onDefaultSaveAction =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (rdbtnSave.isSelected()) {
              defaultSaveAction = "save";
            } else if (rdbtnSaveAndRename.isSelected()) {
              defaultSaveAction = "saveRename";

            } else if (rdbtnSaveAs.isSelected()) {
              defaultSaveAction = "saveAs";
            }
          }
        };
    rdbtnSave.addActionListener(onDefaultSaveAction);
    rdbtnSaveAndRename.addActionListener(onDefaultSaveAction);
    rdbtnSaveAs.addActionListener(onDefaultSaveAction);
    tcA.getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void changedUpdate(DocumentEvent arg0) {
                showPreview((String) comboBox.getEditor().getItem());
              }

              @Override
              public void insertUpdate(DocumentEvent arg0) {
                showPreview((String) comboBox.getEditor().getItem());
              }

              @Override
              public void removeUpdate(DocumentEvent arg0) {
                showPreview((String) comboBox.getEditor().getItem());
              }
            });
    String defaultSaveAction = prefs.get("defaultSaveAction", "save");
    if (defaultSaveAction.equals("saveRename")) {
      rdbtnSaveAndRename.setSelected(true);
    } else if (defaultSaveAction.equals("saveAs")) {
      rdbtnSaveAndRename.setSelected(true);
    } else {
      rdbtnSave.setSelected(true);
    }

    SwingUtilities.invokeLater(
        new Runnable() {

          @Override
          public void run() {
            lblNewLabel_1.setIcon(
                new ImageIcon(
                    PreferencesWindow.class.getResource("/pmedit/os_integration_hint.png")));
          }
        });

    load();
    refresh();
    contentPane.doLayout();

    if (status.isDone()) {
      showUpdatesStatus(status);
    } else {
      (new Thread(
              new Runnable() {

                @Override
                public void run() {
                  showUpdatesStatus(status);
                }
              }))
          .start();
    }
    updateLicense();
  }
  private JComponent createCenterPane() {
    MyTableRenderer mtr = new MyTableRenderer();
    JPanel toReturn = new JPanel(new BorderLayout());

    JLabel lab = new JLabel(getText("found"));
    lab.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
    toReturn.add(lab, BorderLayout.NORTH);
    tableTb = new JTable();
    tableTb.setAutoCreateColumnsFromModel(false);
    TableColumn col = new TableColumn(0);
    col.setHeaderValue(getText("tclocale"));
    col.setCellRenderer(mtr);
    tableTb.addColumn(col);
    col = new TableColumn(1);
    col.setHeaderValue(getText("tcmodified"));
    col.setCellRenderer(mtr);
    tableTb.addColumn(col);
    col = new TableColumn(2);
    col.setHeaderValue(getText("tcsize"));
    col.setCellRenderer(mtr);
    tableTb.addColumn(col);
    col = new TableColumn(3);
    col.setHeaderValue(getText("tcurl"));
    col.setPreferredWidth(200);
    col.setCellRenderer(mtr);
    tableTb.addColumn(col);
    JScrollPane tscroll = new JScrollPane(tableTb);
    tscroll.setPreferredSize(new Dimension(tableTb.getPreferredSize().width, 300));
    toReturn.add(tscroll, BorderLayout.CENTER);

    new TableCellTipManager(tableTb);
    tableTb.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    refreshBt = new JButton();
    refreshBt.setMargin(new Insets(1, 1, 1, 1));
    JPRManagerLauncher.getResourceData().configureButton("form.dictInWeb.refreshBt", refreshBt);
    installBt = new JButton();
    installBt.setMargin(new Insets(1, 1, 1, 1));
    installBt.setEnabled(false);
    JPRManagerLauncher.getResourceData().configureButton("form.dictInWeb.indexBt", installBt);
    Box bts = Box.createVerticalBox();
    bts.add(refreshBt);
    bts.add(Box.createVerticalStrut(5));
    bts.add(installBt);
    bts.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
    toReturn.add(bts, BorderLayout.EAST);

    JPanel southPn = new JPanel(new BorderLayout());
    notesLb = new JTextPane();
    notesLb.setOpaque(false);
    notesLb.setEditable(false);
    notesLb.setFocusable(false);
    notesLb.setContentType("text/html");
    notesLb.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              try {
                BrowserLauncher.openURL(e.getURL().toString());
              } catch (IOException _e) {
                JPRManagerLauncher.getMessageHandler()
                    .showMessage(
                        DictionariesInWebForm.this,
                        MessageConstants.OPEN_URL_ERROR,
                        new Object[] {e.getURL().toString()},
                        _e);
              }
            }
          }
        });
    JScrollPane nscroll = new JScrollPane(notesLb);
    nscroll.setBorder(BorderFactory.createEmptyBorder(5, 0, 6, 0));
    nscroll.setPreferredSize(new Dimension(200, 80));
    southPn.add(nscroll, BorderLayout.CENTER);

    JPanel progressPn = new JPanel(new BorderLayout());
    progressPb = new JProgressBar();
    progressPb.setStringPainted(true);
    progressPb.setString("");
    progressPb.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(2, 0, 3, 5), progressPb.getBorder()));
    cancelBt = new JButton(JPRManagerLauncher.getResourceData().getText("form.cancel"));
    progressPn.add(progressPb, BorderLayout.CENTER);
    progressPn.add(cancelBt, BorderLayout.EAST);
    southPn.add(progressPn, BorderLayout.SOUTH);
    toReturn.add(southPn, BorderLayout.SOUTH);

    return toReturn;
  }
Exemplo n.º 17
0
  public void show() {
    final String aboutText = Tools.getLabel(messages.getString("guiMenuAbout"));

    JTextPane aboutPane = new JTextPane();
    aboutPane.setBackground(new Color(0, 0, 0, 0));
    aboutPane.setBorder(BorderFactory.createEmptyBorder());
    aboutPane.setContentType("text/html");
    aboutPane.setEditable(false);
    aboutPane.setOpaque(false);

    aboutPane.setText(
        String.format(
            "<html>"
                + "<p>LanguageTool %s (%s)<br>"
                + "Copyright (C) 2005-2014 the LanguageTool community and Daniel Naber<br>"
                + "This software is licensed under the GNU Lesser General Public License.<br>"
                + "<a href=\"http://www.languagetool.org\">http://www.languagetool.org</a></p>"
                + "<p>Maintainers of the language modules:</p><br>"
                + "</html>",
            JLanguageTool.VERSION, JLanguageTool.BUILD_DATE));

    aboutPane.addHyperlinkListener(
        new HyperlinkListener() {
          @Override
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              if (Desktop.isDesktopSupported()) {
                try {
                  Desktop.getDesktop().browse(e.getURL().toURI());
                } catch (Exception ex) {
                  Tools.showError(ex);
                }
              }
            }
          }
        });

    JTextPane maintainersPane = new JTextPane();
    maintainersPane.setBackground(new Color(0, 0, 0, 0));
    maintainersPane.setBorder(BorderFactory.createEmptyBorder());
    maintainersPane.setContentType("text/html");
    maintainersPane.setEditable(false);
    maintainersPane.setOpaque(false);

    maintainersPane.setText(getMaintainers());

    int maxHeight = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2;
    if (maintainersPane.getPreferredSize().height > maxHeight) {
      maintainersPane.setPreferredSize(
          new Dimension(maintainersPane.getPreferredSize().width, maxHeight));
    }

    JScrollPane scrollPane = new JScrollPane(maintainersPane);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    panel.add(aboutPane);
    panel.add(scrollPane);

    JOptionPane.showMessageDialog(parent, panel, aboutText, JOptionPane.INFORMATION_MESSAGE);
  }
  /** Creates the viewer content component. */
  private JTextPane createContent(AlgorithmData algData) {

    String algName = algData.getParams().getString("name");
    int numOfDesiredClusters = algData.getParams().getInt("desired-cluster-count");
    String[] div = algData.getStringArray("diversity-value-array");
    String[] pop = algData.getStringArray("cluster-population-array");
    int popLimit = algData.getParams().getInt("minimum-cluster-size");

    JTextPane area = new JTextPane();
    area.setContentType("text/html");
    area.setEditable(false);
    area.setMargin(new Insets(0, 10, 0, 0));

    String text;

    int population;

    if (algName.equals("Diversity Ranking Cluster Selection")) {
      boolean useCentroid = algData.getParams().getBoolean("use-centroid-based-variability");

      text = "<html><body bgcolor='#FFFFFF'><font face='serif' size='5'>";
      text += "<br>Number of Desired Clusters: " + numOfDesiredClusters + "<br>";
      text += "Minimum Cluster Size (population): " + popLimit + "<br>";
      if (useCentroid)
        text += "Diversity Measurement: Centroid Based Diversity (mean gene-to-centroid dist.)<br>";
      else
        text += "Diversity Measurement: Intra-gene Based Diversity (mean gene-to-gene dist.)<br>";

      text +=
          "<br><br>Note: Clusters are sorted by diversity.  Selected clusters are in <b>bold</b> type.<br>";

      text +=
          "<table cellpadding=10><th><u>Div. Rank</u></th><th><u>Diversity</u></th><th><u>Population</u></td>";
      int clusterCount = 0;
      for (int i = 0; i < div.length; i++) {
        population = Integer.parseInt(pop[i]);
        if (population >= popLimit && clusterCount < numOfDesiredClusters) {
          text +=
              "<tr align=center><td><b>"
                  + (i + 1)
                  + "</b></td><td><b>"
                  + div[i]
                  + "</b></td><td><b>"
                  + pop[i]
                  + "</b></td></tr>";
          clusterCount++;
        } else
          text +=
              "<tr align=center><td>"
                  + (i + 1)
                  + "</td><td>"
                  + div[i]
                  + "</td><td>"
                  + pop[i]
                  + "</td></tr>";
      }
      text += "</table></body></html>";
    } else {
      boolean useVariance = algData.getParams().getBoolean("use-centroid-variance");

      text = "<html><body bgcolor='#FFFFFF'><font face='serif' size='5'>";
      text += "<br>Number of Desired Clusters: " + numOfDesiredClusters + "<br>";
      text += "Minimum Cluster Size (population): " + popLimit + "<br>";
      if (useVariance) {
        text += "Selection Criteria: Centroid Variance<br>";
        text +=
            "<br><br>Note: Clusters are sorted by decreasing variance.  Selected clusters are in <b>bold</b> type.<br>";
        text +=
            "<table cellpadding=10><th><u>Var. Rank</u></th><th><u>Variance</u></th><th><u>Population</u></td>";
      } else {
        text += "Selection Criteria: Centroid Entropy<br>";
        text +=
            "<br><br>Note: Clusters are sorted by decreasing entropy.  Selected clusters are in <b>bold</b> type.<br>";
        text +=
            "<table cellpadding=10><th><u>Entropy Rank</u></th><th><u>Entropy</u></th><th><u>Population</u></td>";
      }

      int clusterCount = 0;
      for (int i = 0; i < div.length; i++) {
        population = Integer.parseInt(pop[i]);
        if (population >= popLimit && clusterCount < numOfDesiredClusters) {
          text +=
              "<tr align=center><td><b>"
                  + (i + 1)
                  + "</b></td><td><b>"
                  + div[i]
                  + "</b></td><td><b>"
                  + pop[i]
                  + "</b></td></tr>";
          clusterCount++;
        } else
          text +=
              "<tr align=center><td>"
                  + (i + 1)
                  + "</td><td>"
                  + div[i]
                  + "</td><td>"
                  + pop[i]
                  + "</td></tr>";
      }
      text += "</table></body></html>";
    }

    area.setText(text);
    area.setCaretPosition(0);
    return area;
  }
Exemplo n.º 19
0
  private void initializeGUIComponents() {
    topLevelContainer = new JPanel();
    topLevelContainer.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    topLevelContainer.setLayout(new BoxLayout(topLevelContainer, BoxLayout.Y_AXIS));
    setContentPane(topLevelContainer);

    JPanel formPanel = new JPanel();
    JPanel errorPanel = new JPanel();
    JPanel userAgreementNoticePanel = new JPanel();
    JPanel userAgreementPanel = new JPanel();
    JPanel alreadyRegisteredPanel = new JPanel();
    JPanel buttonsPanel = new JPanel();
    topLevelContainer.add(formPanel);
    topLevelContainer.add(errorPanel);
    topLevelContainer.add(Box.createVerticalGlue());
    topLevelContainer.add(userAgreementNoticePanel);
    topLevelContainer.add(userAgreementPanel);
    topLevelContainer.add(alreadyRegisteredPanel);
    topLevelContainer.add(buttonsPanel);

    formPanel.setLayout(new BorderLayout());
    JPanel formLabels = new JPanel(new GridLayout(11, 1));
    formLabels.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    JPanel formFields = new JPanel(new GridLayout(11, 1));
    formPanel.add(formLabels, BorderLayout.LINE_START);
    formPanel.add(formFields, BorderLayout.CENTER);

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1;

    formLabels.add(new JLabel("First Name"));
    firstNameField = new JTextField();
    JPanel firstNameFieldPanel = new JPanel(new GridBagLayout());
    firstNameFieldPanel.add(firstNameField, constraints);
    formFields.add(firstNameFieldPanel);

    formLabels.add(new JLabel("Last Name"));
    lastNameField = new JTextField();
    JPanel lastNameFieldPanel = new JPanel(new GridBagLayout());
    lastNameFieldPanel.add(lastNameField, constraints);
    formFields.add(lastNameFieldPanel);

    formLabels.add(new JLabel("Email Address"));
    emailAddressField = new JTextField();
    JPanel emailAddressFieldPanel = new JPanel(new GridBagLayout());
    emailAddressFieldPanel.add(emailAddressField, constraints);
    formFields.add(emailAddressFieldPanel);

    formLabels.add(new JLabel(""));
    femaleRadioButton = new JRadioButton("Female");
    formFields.add(femaleRadioButton);

    formLabels.add(new JLabel("Sex"));
    maleRadioButton = new JRadioButton("Male");
    formFields.add(maleRadioButton);

    formLabels.add(new JLabel("Country"));
    countryComboBox = new DisableableComboBox();
    JPanel countryComboBoxPanel = new JPanel(new GridBagLayout());
    countryComboBoxPanel.add(countryComboBox, constraints);
    formFields.add(countryComboBoxPanel);

    formLabels.add(new JLabel("Birthday (Optional)"));
    JPanel birthdayPanel = new JPanel(new GridLayout(1, 3, 10, 0));
    formFields.add(birthdayPanel);
    birthdayYearComboBox = new JComboBox();
    birthdayMonthComboBox = new JComboBox();
    birthdayDayComboBox = new JComboBox();
    JPanel birthdayYearComboBoxPanel = new JPanel(new GridBagLayout());
    JPanel birthdayMonthComboBoxPanel = new JPanel(new GridBagLayout());
    JPanel birthdayDayComboBoxPanel = new JPanel(new GridBagLayout());
    birthdayYearComboBoxPanel.add(birthdayYearComboBox, constraints);
    birthdayMonthComboBoxPanel.add(birthdayMonthComboBox, constraints);
    birthdayDayComboBoxPanel.add(birthdayDayComboBox, constraints);
    birthdayPanel.add(birthdayYearComboBoxPanel);
    birthdayPanel.add(birthdayMonthComboBoxPanel);
    birthdayPanel.add(birthdayDayComboBoxPanel);

    formLabels.add(new JLabel("Password"));
    JPanel passwordFieldPanel = new JPanel(new GridBagLayout());
    passwordField = new JPasswordField();
    passwordFieldPanel.add(passwordField, constraints);
    formFields.add(passwordFieldPanel);

    formLabels.add(new JLabel("Password Confirmation"));
    JPanel passwordConfirmFieldPanel = new JPanel(new GridBagLayout());
    passwordConfirmField = new JPasswordField();
    passwordConfirmFieldPanel.add(passwordConfirmField, constraints);
    formFields.add(passwordConfirmFieldPanel);

    formLabels.add(new JLabel("Profile Picture"));
    JPanel filePanel = new JPanel();
    filePanel.setLayout(new BoxLayout(filePanel, BoxLayout.X_AXIS));
    imageFromFileRadioButton = new JRadioButton("Image from file");
    filePanel.add(imageFromFileRadioButton);
    fileSelector = new FileSelector(filePanel);
    filePanel.add(fileSelector);
    formFields.add(filePanel);

    formLabels.add(new JLabel(""));
    noProfilePictureRadioButton = new JRadioButton("No profile picture");
    formFields.add(noProfilePictureRadioButton);

    setMaxHeightToPreferredHeight(formPanel);

    errorPanel.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 5));
    errorLabel = new JLabel("Error message");
    errorLabel.setForeground(Color.RED);
    errorPanel.add(errorLabel);
    setMaxHeightToPreferredHeight(errorPanel);

    userAgreementNoticePanel.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 5));
    userAgreementNoticePanel.add(
        new JLabel("By clicking 'Create Account', you agree to the user agreement below:"));
    setMaxHeightToPreferredHeight(userAgreementNoticePanel);

    userAgreementPanel.setLayout(new BorderLayout());
    JScrollPane userAgreementScrollPane = new JScrollPane();
    userAgreementTextPane = new JTextPane();
    userAgreementTextPane.setContentType("text/html");
    userAgreementTextPane.setText("<b>This</b> is some test text!!!");
    userAgreementTextPane.setPreferredSize(
        new Dimension(userAgreementTextPane.getPreferredSize().width, 150));
    userAgreementScrollPane.setViewportView(userAgreementTextPane);
    userAgreementPanel.add(userAgreementScrollPane, BorderLayout.CENTER);
    setMaxHeightToPreferredHeight(userAgreementPanel);

    alreadyRegisteredPanel.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 5));
    alreadyRegisteredPanel.add(new JLabel("Already registered?"));
    setMaxHeightToPreferredHeight(alreadyRegisteredPanel);

    buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS));
    loginButton = new JButton("Login");
    cancelButton = new JButton("Cancel");
    createAccountButton = new JButton("Create Account");
    buttonsPanel.add(loginButton);
    buttonsPanel.add(Box.createHorizontalGlue());
    buttonsPanel.add(cancelButton);
    buttonsPanel.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonsPanel.add(createAccountButton);
    setMaxHeightToPreferredHeight(buttonsPanel);

    ButtonGroup sexButtonGroup = new ButtonGroup();
    sexButtonGroup.add(maleRadioButton);
    sexButtonGroup.add(femaleRadioButton);

    ButtonGroup profilePictureButtonGroup = new ButtonGroup();
    profilePictureButtonGroup.add(imageFromFileRadioButton);
    profilePictureButtonGroup.add(noProfilePictureRadioButton);
  }
Exemplo n.º 20
0
    @SuppressWarnings("unchecked") // we must be compatible with 1.6
    public VersionManagementPanel(final VisualCanvas canvas) {

      super(canvas);

      setLayout(new GridLayout());

      // TODO @Christian Poliwoda what does manual testing mean?
      // numbers tested manually
      Dimension prefScrollPaneDim = new Dimension(100, 30);
      Dimension visibleRectDim = canvas.getVisibleRect().getSize();

      final VersionController controller =
          canvas.getProjectController().getProject().getProjectFile();

      final int numVersions = controller.getNumberOfVersions() - 1;

      versionData = new Object[numVersions];

      ArrayList<RevCommit> versions = new ArrayList<RevCommit>();

      try {
        versions = controller.getVersions();
      } catch (IOException ex) {
        Logger.getLogger(VersionManagementPanel.class.getName()).log(Level.SEVERE, null, ex);
      }

      int maxTextwidth = 0;
      String longestText = null;

      // the history with timestamp and a short commit message
      for (int i = 1; i < versions.size(); i++) {
        String text =
            // + Message.generateHTMLSpace(3)
            new Date(versions.get(i).getCommitTime() * 1000L)
                + ": "
                + versions.get(i).getShortMessage();

        // truncate texts that are too long
        int maxTextLength = 100;
        String dots = "...";

        int textLength = text.length() - dots.length();

        if (textLength > maxTextLength) {
          text = text.substring(0, maxTextLength) + dots;
        }

        versionData[versions.size() - i - 1] = new Version(text, i);

        if (text.length() > maxTextwidth) {
          maxTextwidth = text.length();
          longestText = text;
        }
      }

      resultModel = new DefaultListModel();

      // first init to show all if search not started yet
      for (int i = 0; i < versionData.length; i++) {
        resultModel.addElement(versionData[i]);
      }

      versionList = new JList(resultModel);

      // set the width of version managment window
      // dependent on largest git short message length
      double maxFontWidth =
          versionList
              .getFontMetrics(versionList.getFont())
              .getStringBounds(longestText, versionList.getGraphics())
              .getWidth();

      if (maxFontWidth <= visibleRectDim.width) {

        prefScrollPaneDim.width = (int) maxFontWidth;
      } else {

        if (visibleRectDim.width < 400) {
          prefScrollPaneDim.width = visibleRectDim.width;
        } else {
          prefScrollPaneDim.width = 400;
        }
      }

      versionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

      versionList.setOpaque(false);

      versionList.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      versionList.setBorder(new EmptyBorder(3, 3, 3, 3));

      Box upperTopBox = Box.createVerticalBox();

      // press the commits to top with VerticalGlue
      // contains search area at top and
      // search results at the botton
      Box upperOuterBox = Box.createVerticalBox();

      JButton searchButton = new JButton("search");
      searchButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
              searchAndAddToResultList();
            }
          });

      searchField = new JTextArea();

      // search area box
      Box upperBox1 = Box.createHorizontalBox();

      upperBox1.add(searchField);
      upperBox1.add(searchButton);

      Dimension fieldDim = new Dimension(Short.MAX_VALUE, searchField.getPreferredSize().height);
      searchField.setMaximumSize(fieldDim);

      searchField.addKeyListener(
          new KeyAdapter() {
            String tmp = "";

            @Override
            public void keyReleased(KeyEvent ke) {

              searchAndAddToResultList();
            }
          });

      //            upperOuterBox.add(upperBox1);
      upperTopBox.add(upperBox1);
      upperTopBox.add(upperOuterBox);

      // result area box
      Box upperBox2 = Box.createHorizontalBox();

      upperBox2.add(Box.createHorizontalGlue());
      upperBox2.add(versionList);
      upperBox2.add(Box.createHorizontalGlue());

      upperOuterBox.add(upperBox2);
      upperOuterBox.add(Box.createVerticalGlue());

      // added for optical reasons to force correct scrollbar position
      Box upperInnerBorderPane = Box.createHorizontalBox();
      upperInnerBorderPane.add(upperOuterBox);
      upperInnerBorderPane.setBorder(new EmptyBorder(5, 15, 5, 15));
      upperInnerBorderPane.setBackground(VSwingUtil.TRANSPARENT_COLOR);

      VScrollPane upperScrollPane = new VScrollPane(upperInnerBorderPane);
      upperScrollPane.setHorizontalScrollBarPolicy(VScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      upperScrollPane.setVerticalScrollBarPolicy(VScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      upperScrollPane.setMinimumSize(prefScrollPaneDim);

      JSplitPane splitPane = new VSplitPane(JSplitPane.VERTICAL_SPLIT);
      splitPane.setEnabled(true); // true = transparent
      splitPane.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      splitPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      splitPane.setDividerLocation(0.5);

      upperTopBox.add(upperScrollPane);
      splitPane.add(upperTopBox); // add in the upper part

      htmlCommit.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      htmlCommit.setContentType("text/html");
      htmlCommit.setOpaque(false);
      htmlCommit.setEditable(false);
      htmlCommit.setBorder(new EmptyBorder(0, 15, 0, 15));

      Box lowerBox = Box.createVerticalBox();
      lowerBox.setAlignmentX(Component.LEFT_ALIGNMENT);
      lowerBox.add(htmlCommit);
      lowerBox.add(Box.createVerticalGlue());

      VScrollPane lowerScrollPane = new VScrollPane(lowerBox);

      lowerScrollPane.setHorizontalScrollBarPolicy(VScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      lowerScrollPane.setVerticalScrollBarPolicy(VScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      lowerScrollPane.setMinimumSize(new Dimension(0, 0));

      // add in the lower part
      splitPane.setBottomComponent(lowerScrollPane);

      add(splitPane);

      versionList.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

              // show commit message in lower part if clicked on a row
              // in upper part
              if (e.getClickCount() == 1) {

                final VersionController controller =
                    canvas.getProjectController().getProject().getProjectFile();

                final int numVersions = controller.getNumberOfVersions() - 1;

                ArrayList<RevCommit> versions = new ArrayList<RevCommit>();

                try {
                  versions = controller.getVersions();
                } catch (IOException ex) {
                  Logger.getLogger(VersionManagementPanel.class.getName())
                      .log(Level.SEVERE, null, ex);
                }

                int versionIndex = ((Version) versionList.getSelectedValue()).getVersion();

                htmlCommit.setText(
                    "<html>"
                        + "<pre> <font color=white><br>"
                        + "<b>SHA-1:</b> "
                        + versions.get(versionIndex).getName()
                        + "<br><br>"
                        + "<b>Message:</b><br><br>"
                        + versions.get(versionIndex).getFullMessage()
                        + "</pre></p>"
                        + "</html>");
                htmlCommit.setCaretPosition(0);
              }

              if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) {

                if (((Version) versionList.getSelectedValue()).getVersion() < 2) {
                  VDialog.showMessageDialog(
                      canvas,
                      "Cannot Load Version",
                      "The first version in a project contains no"
                          + " sessions and cannot be loaded!");
                  return;
                }

                //                        if (VDialog.showConfirmDialog(canvas,
                //                                "Checkout Version:",
                //                                "<html><div align=Center>"
                //                                + "<p>Do you want to checkout the selected"
                //                                + " version?<p>"
                //                                + "<p><b>Unsaved changes will be lost!</b></p>"
                //                                + "</div></html>",
                //                                VDialog.DialogType.YES_NO) != VDialog.YES) {
                //                            return;
                //                        }

                int answer =
                    VDialog.showConfirmDialog(
                        canvas,
                        "Checkout Version:",
                        "<html><div align=Center>"
                            + "<p>Checking out selected version.<p><br>"
                            + "<p>Do you want to save the current session?</p><br>"
                            + "<p><b>Unsaved changes will be lost!</b></p>"
                            + "</div></html>",
                        new String[] {"Save", "Discard", "Cancel"});

                if (answer == 0) {
                  try {
                    canvas.getProjectController().saveProject(false);
                  } catch (IOException ex) {
                    Logger.getLogger(VersionManagement.class.getName()).log(Level.SEVERE, null, ex);

                    VDialog.showMessageDialog(
                        canvas,
                        "Cannot save Project:",
                        "<html><div align=Center>" + "Project cannot be saved!" + "</div></html>");
                  }
                } else if (answer == 1) {
                  // nothing to do
                } else if (answer == 2) {
                  return;
                }

                try {

                  int versionIndex = ((Version) versionList.getSelectedValue()).getVersion();

                  canvas.setActive(false);

                  String currentSessionName = canvas.getProjectController().getCurrentSession();

                  canvas.getProjectController().close(currentSessionName);

                  controller.checkoutVersion(versionIndex);

                  if (dialog != null) {
                    dialog.close();
                    dialog = null;
                  }

                  if (canvas
                      .getProjectController()
                      .getProject()
                      .getSessionFileByEntryName(currentSessionName)
                      .exists()) {
                    canvas.getProjectController().open(currentSessionName, false, true);
                  } else {
                    //                                VDialog.showMessageDialog(canvas,
                    //                                        "Cannot load \""
                    //                                        + currentSessionName
                    //                                        +"\":", "<html><div align=Center>"
                    //                                        + "<p>The Session "
                    //                                        + Message.EMPHASIZE_BEGIN
                    //                                        + currentSessionName
                    //                                         +  Message.EMPHASIZE_END
                    //                                        + " does not exist in the current"
                    //                                        + " version."
                    //                                        + "<p>The <b>Main</b>-Session will"
                    //                                        + "be loaded instead</div></html>");
                    canvas.getProjectController().open("Main", false, true);
                  }

                } catch (IOException ex) {
                  Logger.getLogger(VersionManagementPanel.class.getName())
                      .log(Level.SEVERE, null, ex);
                }
              }
            }
          });

      //            setMinimumSize(visibleRectDim);
      setMaximumSize(visibleRectDim);

      int width = getPreferredSize().width;
      setPreferredSize(new Dimension(width, (int) (visibleRectDim.height * 0.5)));
    } // end constructure
  /**
   * Create header panel
   *
   * @param logs
   * @param factory
   * @return
   */
  private ProMSplitPane createHeaderPanel(final OrganizationalLogs logs, SlickerFactory factory) {
    ProMSplitPane headerPanel = new ProMSplitPane(ProMSplitPane.HORIZONTAL_SPLIT);

    {
      JTextPane headerExplanation = new JTextPane();
      headerExplanation.setContentType("text/html");
      headerExplanation.setText(
          fontBlack6
              + "Mismatch Pattern Analysis without Performance Clustering</font><hr>"
              + fontBlack4
              + " Select an organization from left and click \"Analyze\" to list mismatch patterns compared to other organizations.");
      headerExplanation.setEditable(false);
      headerExplanation.setBackground(null);
      headerPanel.setRightComponent(headerExplanation);
    }

    {
      JPanel headerLeftPanel = new JPanel();
      headerLeftPanel.setBackground(null);
      headerLeftPanel.setLayout(new GridBagLayout());
      {
        List<String> organizationList = new ArrayList<String>();
        if (logs != null) {

          organizationList.addAll(logs.organizationNames);
        }
        organizationCombo = factory.createComboBox(organizationList.toArray());

        GridBagConstraints organizationComboConstraint = new GridBagConstraints();
        organizationComboConstraint.gridx = 0;
        organizationComboConstraint.gridy = 1;

        organizationComboConstraint.anchor = GridBagConstraints.WEST;

        organizationCombo.addActionListener(
            (new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                organizationName = (String) organizationCombo.getSelectedItem();
              }
            }));
        headerLeftPanel.add(organizationCombo, organizationComboConstraint);
      }
      {
        JLabel organizationComboLabel = factory.createLabel("Organization");
        GridBagConstraints organizationComboLabelConstraint = new GridBagConstraints();
        organizationComboLabelConstraint.gridx = 0;
        organizationComboLabelConstraint.gridy = 0;
        organizationComboLabelConstraint.fill = GridBagConstraints.HORIZONTAL;
        headerLeftPanel.add(organizationComboLabel, organizationComboLabelConstraint);
      }

      {
        JButton analyzeButton = factory.createButton("Analyze");
        GridBagConstraints analyzeButtonConstraint = new GridBagConstraints();
        analyzeButtonConstraint.gridx = 0;
        analyzeButtonConstraint.gridy = 3;
        analyzeButtonConstraint.gridwidth = 3;
        analyzeButtonConstraint.fill = GridBagConstraints.HORIZONTAL;
        analyzeButtonConstraint.anchor = GridBagConstraints.WEST;
        analyzeButton.addActionListener(
            (new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                organizationName = (String) organizationCombo.getSelectedItem();
                if (!(organizationName.equals("Select") || organizationName.equals(""))) {
                  System.out.println(organizationName + " " + performanceDifferentThresholdValue);
                  analyzeClicked(logs);
                }
              }
            }));
        headerLeftPanel.add(analyzeButton, analyzeButtonConstraint);
      }
      headerPanel.setLeftComponent(headerLeftPanel);
    }
    return headerPanel;
  }
Exemplo n.º 22
0
  public void addNewAnnotations(HashMap<String, MsgAnnotation> annotations) throws Exception {
    HashSet<String> newMsgStrs = new HashSet<String>();
    for (String msgstr : annotations.keySet()) {
      if (!matchedMsgStrs.contains(msgstr)) {
        matchedMsgStrs.add(msgstr);
        newMsgStrs.add(msgstr);
      }
    }
    final HashMap<String, Integer> numOccurrencesOfSources = new HashMap<String, Integer>();
    // gnome-mouse-properties => #of times it occurs on the current screenshot
    for (String msgidblock : this.msgidblocks) {
      String msgfsrc = msgsrc.msgSourceConciseFromMsgIdBlock(msgidblock);
      if (!numOccurrencesOfSources.containsKey(msgfsrc)) numOccurrencesOfSources.put(msgfsrc, 0);
      String msgstr = msgsrc.textFromMsgIdBlock(msgidblock);
      if (annotations.keySet().contains(msgstr)) {
        numOccurrencesOfSources.put(msgfsrc, numOccurrencesOfSources.get(msgfsrc) + 1);
      }
    }

    List<List<String>> msgsGroupedBySource = msgsrc.groupByMsgSouce(msgidblocks);
    Collections.sort(
        msgsGroupedBySource,
        new Comparator<List<String>>() {

          @Override
          public int compare(List<String> o1, List<String> o2) {
            try {
              String src1 = msgsrc.msgSourceConciseFromMsgIdBlock(o1.get(0));
              String src2 = msgsrc.msgSourceConciseFromMsgIdBlock(o2.get(0));
              return numOccurrencesOfSources.get(src2) - numOccurrencesOfSources.get(src1);
            } catch (Exception e) {
              return 0;
            }
          }
        });

    // String curMsgSource = "";
    // String curMsgSourceFound = "";
    StringBuilder msgsToBeFound = new StringBuilder();
    msgsToBeFound.append("<html><body>");
    msgsToBeFound.append("<h3>Messages Not Found:</h3>");
    StringBuilder msgsFound = new StringBuilder();
    msgsFound.append("<html><body>");
    msgsFound.append("<h3>Messages Found:</h3>");
    // for (String msgidblock : msgsrc.splitIntoMsgIdBlocks()) {
    for (List<String> msgidblockGroup : msgsGroupedBySource) {
      String msgsource = msgsrc.msgSourceConciseFromMsgIdBlock(msgidblockGroup.get(0));
      msgsFound.append("<p><b>" + msgsource + "</b></p>\n");
      msgsToBeFound.append("<p><b>" + msgsource + "</b></p>\n");
      for (String msgidblock : msgidblockGroup) {
        String msgstr = msgsrc.textFromMsgIdBlock(msgidblock);
        if (msgstr.isEmpty()) continue;
        if (matchedMsgStrs.contains(msgstr)) {
          if (newMsgStrs.contains(msgstr)) {
            msgsFound.append("<p bgcolor='#FFFF00'>" + msgstr + "</p>\n");
          } else if (annotations.keySet().contains(msgstr)) {
            msgsFound.append("<p bgcolor='#00FFFF'>" + msgstr + "</p>\n");
          } else {
            msgsFound.append("<p>" + msgstr + "</p>\n");
          }
        } else {
          msgsToBeFound.append("<p>" + msgstr + "</p>\n");
        }
      }
    }
    /*
      String msgstr = msgsrc.textFromMsgIdBlock(msgidblock);
    	if (msgstr.isEmpty())
    		continue;
    	String msgsource = msgsrc.msgSourceConciseFromMsgIdBlock(msgidblock);
    	if (matchedMsgStrs.contains(msgstr)) {
        	if (!msgsource.isEmpty() && !msgsource.equals(curMsgSourceFound)) {
        		curMsgSourceFound = msgsource;
        		msgsFound.append("<p><b>" + msgsource + "</b></p>\n");
        	}
        	if (newMsgStrs.contains(msgstr)) {
            	msgsFound.append("<p bgcolor='#FFFF00'>" + msgstr + "</p>\n");
        	} else {
            	msgsFound.append("<p>" +  msgstr + "</p>\n");
        	}
    	} else {
    		if (!msgsource.isEmpty() && !msgsource.equals(curMsgSource)) {
        		curMsgSource = msgsource;
        		msgsToBeFound.append("<p><b>" + msgsource + "</b></p>\n");
        	}
    		msgsToBeFound.append("<p>" + msgstr + "</p>\n");
    	}
    }
    */
    msgsToBeFound.append("</body></html>");
    msgsFound.append("</body></html>");
    textArea.setContentType("text/html");
    textArea.setText(msgsToBeFound.toString());
    textAreaSeen.setContentType("text/html");
    textAreaSeen.setText(msgsFound.toString());
    updateMatchCount();
  }
Exemplo n.º 23
0
  private void init() throws Exception {
    setLayout(new BorderLayout());
    serverMessage = new JTextPane();
    serverMessage.setContentType("text/html");
    serverMessage.setEditable(false);

    JPanel panel3 = new JPanel(new GridBagLayout());
    panel3.setBackground(Color.WHITE);
    JPanel panel4 = new JPanel(new BorderLayout());
    panel4.setBackground(Color.WHITE);

    IconManager im = IconManager.getInstance();
    JPanel panel1 = new NorthPanel(serverMessage);
    panel1.setBackground(Color.WHITE);

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.NORTH;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.insets.left = 5;

    ImageIcon icon2 = im.getIcon("start");
    JLabel label2 = new JLabel(icon2);
    panel3.add(label2, constraints);

    constraints.gridx = 1;
    constraints.weightx = 1;
    deinClient = new JLabel();
    deinClient.setForeground(APFEL_ROT);
    panel3.add(deinClient, constraints);
    constraints.weightx = 0;

    constraints.gridy++;
    constraints.insets.left = 15;
    version = new JLabel();
    panel3.add(version, constraints);
    constraints.gridy++;
    constraints.insets.left = 15;
    faq = new JTextPane();
    faq.setContentType("text/html");
    faq.setEditable(false);
    faq.setText("<html><a href=\"http://www.applejuicenet.de/13.0.html\">FAQ</a></html>");
    panel3.add(faq, constraints);

    constraints.gridy++;
    constraints.insets.left = 5;
    constraints.gridx = 0;
    ImageIcon icon3 = im.getIcon("warnung");
    warnungIcon = new JLabel(icon3);
    panel3.add(warnungIcon, constraints);

    constraints.gridx = 1;
    warnungen = new JLabel();
    warnungen.setForeground(APFEL_ROT);
    panel3.add(warnungen, constraints);

    constraints.gridy++;
    constraints.insets.left = 15;
    firewallWarning = new JLabel();
    firewallWarning.setForeground(Color.RED);

    panel3.add(firewallWarning, constraints);

    constraints.gridy++;
    constraints.insets.left = 5;
    constraints.gridx = 0;
    ImageIcon icon4 = im.getIcon("netzwerk");
    JLabel label4 = new JLabel(icon4);
    panel3.add(label4, constraints);

    constraints.gridx = 1;
    neuigkeiten = new JLabel();
    neuigkeiten.setForeground(APFEL_ROT);
    panel3.add(neuigkeiten, constraints);

    constraints.gridy++;
    constraints.insets.left = 15;
    nachrichten = new JTextPane();
    panel3.add(nachrichten, constraints);
    nachrichten.setEditable(false);

    constraints.gridy++;
    constraints.insets.left = 5;
    constraints.gridx = 0;
    ImageIcon icon5 = im.getIcon("server");
    JLabel label5 = new JLabel(icon5);
    panel3.add(label5, constraints);

    constraints.gridx = 1;
    netzwerk = new JLabel();
    netzwerk.setForeground(APFEL_ROT);
    panel3.add(netzwerk, constraints);

    constraints.gridy++;
    constraints.insets.left = 15;
    verbindungsNachricht = new JLabel();
    panel3.add(verbindungsNachricht, constraints);

    verbindungen = new JLabel();
    constraints.gridy++;
    constraints.insets.top = 5;
    panel3.add(verbindungen, constraints);

    constraints.gridy++;
    status = new JLabel();
    panel3.add(status, constraints);

    constraints.insets.top = 0;

    add(panel1, BorderLayout.NORTH);
    panel4.add(panel3, BorderLayout.NORTH);
    JScrollPane scrollPane = new JScrollPane(panel4);
    scrollPane.setBorder(null);
    add(scrollPane, BorderLayout.CENTER);
  }
Exemplo n.º 24
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    decompilePanel = new JPanel();
    jScrollPane2 = new JScrollPane();
    sourcePane = new JTextPane();
    jMenuBar1 = new JMenuBar();
    jMenu2 = new JMenu();
    savaAsMenuItem = new JMenuItem();
    CtrlCMenuItem = new JMenuItem();

    setName("decompileFrame"); // NOI18N
    getContentPane().setLayout(new java.awt.GridBagLayout());

    decompilePanel.setLayout(new java.awt.GridBagLayout());

    sourcePane.setContentType("text/html");
    sourcePane.setEditable(false);
    sourcePane.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    sourcePane.setEnabled(false);
    jScrollPane2.setViewportView(sourcePane);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    decompilePanel.add(jScrollPane2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    getContentPane().add(decompilePanel, gridBagConstraints);

    jMenu2.setText("Edit");

    savaAsMenuItem.setText("Save as...");
    savaAsMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveAsMenuItemActionPerformed(evt);
          }
        });
    jMenu2.add(savaAsMenuItem);

    CtrlCMenuItem.setText("Copy All to Clipboard");
    CtrlCMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CtrlCMenuItemActionPerformed(evt);
          }
        });
    jMenu2.add(CtrlCMenuItem);

    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    pack();
  }
Exemplo n.º 25
0
  public void createPartControl(Composite parent) {
    listener =
        new WorkbenchWindowListener(
            new WorkbenchPageListener(
                new PartListener(new DropTemplateWorkflowModelEditorAction())));
    listener.register();

    FillLayout parentLayout = new FillLayout();
    parent.setLayout(parentLayout);
    SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);

    Tree tree = new Tree(sashForm, SWT.BORDER);
    tree.setLinesVisible(false);
    tree.setLayoutData(FormBuilder.createDefaultMultiLineWidgetGridData());
    Composite composite = FormBuilder.createComposite(sashForm, 1);
    Composite swingComposite = new Composite(composite, SWT.EMBEDDED);
    swingComposite.setLayoutData(FormBuilder.createDefaultMultiLineWidgetGridData());
    java.awt.Frame locationFrame = SWT_AWT.new_Frame(swingComposite);
    textPane = new JTextPane();
    JScrollPane scrollPane = new JScrollPane(textPane);
    locationFrame.add(scrollPane);
    textPane.setContentType("text/html"); // $NON-NLS-1$
    StyleSheet css = ((HTMLEditorKit) textPane.getEditorKit()).getStyleSheet();
    URL url = this.getClass().getResource("/html/carnot.css"); // $NON-NLS-1$
    css.importStyleSheet(url);
    textPane.setEditable(false);
    sashForm.setWeights(new int[] {1, 2});
    final TreeViewer viewer = new TreeViewer(tree);
    viewer.setContentProvider(new PatternsContentProvider());
    viewer.setLabelProvider(new PatternsLabelProvider());
    viewer.addSelectionChangedListener(
        new ISelectionChangedListener() {

          public void selectionChanged(SelectionChangedEvent event) {
            TreeSelection selection = (TreeSelection) event.getSelection();
            Object object = selection.getFirstElement();
            if (object instanceof ITemplate) {
              ITemplate template = (ITemplate) object;
              textPane.setEditorKit(new ExtendedHTMLEditorKit(template));
              textPane.setText(template.getDescription());
            } else {
              if (object instanceof ITemplateFactory) {
                ITemplateFactory templateFactory = (ITemplateFactory) object;
                textPane.setText(templateFactory.getDescription());
              }
            }
          }
        });

    viewer.addDragSupport(
        DND.DROP_COPY,
        new Transfer[] {LocalSelectionTransfer.getTransfer()},
        new DragSourceAdapter() {
          public void dragStart(DragSourceEvent event) {
            ISelection selection = viewer.getSelection();
            LocalSelectionTransfer.getTransfer().setSelection(selection);
            LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & 0xFFFFFFFFL);
            event.doit = DropTemplateWorkflowModelEditorAction.isValidDndSelection(selection);
          }

          public void dragSetData(DragSourceEvent event) {
            event.data = LocalSelectionTransfer.getTransfer().getSelection();
          }

          public void dragFinished(DragSourceEvent event) {
            LocalSelectionTransfer.getTransfer().setSelection(null);
            LocalSelectionTransfer.getTransfer().setSelectionSetTime(0);
          }
        });

    // Add actions to the local tool bar
    IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
    Action refreshAction =
        new Action(Diagram_Messages.LB_VersionRepository_Refresh) {
          public void run() {
            viewer.setInput(
                "org.eclipse.stardust.modeling.templates.templateProvider"); //$NON-NLS-1$
          }
        };
    tbm.add(refreshAction);

    refreshAction.run();
  }
  /**
   * Steps to handle when "Analyze" button is clicked
   *
   * @param logs
   */
  private void analyzeClicked(OrganizationalLogs logs) {
    IconVerticalTabbedPane tabbed = new IconVerticalTabbedPane(Color.GRAY, Color.BLACK, 85);

    int firstOrg = logs.organizationNames.indexOf(organizationName);

    if (logs != null) {
      for (String s : logs.organizationNames) {
        if (!s.equals("Select")) {
          int secondOrg = logs.organizationNames.indexOf(s);
          JPanel panel = new JPanel(new GridBagLayout());
          panel.setBackground(new Color(40, 40, 40));

          if (!s.equals(organizationName)) {

            GridBagConstraints c = new GridBagConstraints();

            JTextPane headerPanel = new JTextPane();
            headerPanel.setContentType("text/html");
            headerPanel.setText(
                "<center><font color='white' face='helvetica,arial,sans-serif' size='8'>Mismatch Patterns</font><font color='white' face='helvetica,arial,sans-serif' size='4'> <br>"
                    + organizationName
                    + " (Selected) vs "
                    + s
                    + " (Other)");
            headerPanel.setEditable(false);
            headerPanel.setBackground(null);
            c.gridx = 0;
            c.gridy = 0;
            panel.add(headerPanel, c);

            ProMSplitPane splitPanelSkippedActivity =
                skippedActivityPanelCreator(logs, firstOrg, secondOrg);
            c.gridy = 1;
            if (splitPanelSkippedActivity != null) panel.add(splitPanelSkippedActivity, c);

            ProMSplitPane splitPanelRefinedActivity =
                refinedActivityPanelCreator(logs, firstOrg, secondOrg);
            c.gridy = 2;
            if (splitPanelRefinedActivity != null) panel.add(splitPanelRefinedActivity, c);

            ProMSplitPane splitPanelDifferentMoments =
                differentMomentsPanelCreator(logs, firstOrg, secondOrg);
            c.gridy = 3;
            if (splitPanelDifferentMoments != null) panel.add(splitPanelDifferentMoments, c);

            ProMSplitPane splitPanelDifferentMoments2 =
                differentConditionsPanelCreator(logs, firstOrg, secondOrg);
            c.gridy = 4;
            if (splitPanelDifferentMoments2 != null) panel.add(splitPanelDifferentMoments2, c);

            ProMSplitPane splitPanelDifferentMoments3 =
                differentDependencyPanelCreator(logs, firstOrg, secondOrg);
            c.gridy = 5;
            if (splitPanelDifferentMoments3 != null) panel.add(splitPanelDifferentMoments3, c);

            ProMSplitPane splitPanelDifferentMoments4 =
                additionalDependencyPanelCreator(logs, firstOrg, secondOrg);
            c.gridy = 6;
            if (splitPanelDifferentMoments4 != null) panel.add(splitPanelDifferentMoments4, c);

          } else {

            GridBagConstraints c = new GridBagConstraints();

            JTextPane headerPanel = new JTextPane();
            headerPanel.setContentType("text/html");
            headerPanel.setText(
                "<center><font color='white' face='helvetica,arial,sans-serif' size='8'>Mismatch Patterns</font><font color='white' face='helvetica,arial,sans-serif' size='4'> <br>"
                    + organizationName);
            headerPanel.setEditable(false);
            headerPanel.setBackground(null);
            c.gridx = 0;
            c.gridy = 0;
            panel.add(headerPanel, c);

            ProMSplitPane splitPanelSkippedActivity =
                skippedActivityPanelCreator(logs, firstOrg, secondOrg);
            c.gridy = 1;
            panel.add(splitPanelSkippedActivity, c);
          }
          // tabbed.addTab(s, panel);
          ProMScrollPane jScrollPane = new ProMScrollPane(panel);
          jScrollPane.getVerticalScrollBar().setUnitIncrement(20);
          jScrollPane.setBackground(Color.black);
          String label = "Org #";
          if (firstOrg == secondOrg) {
            label = label + firstOrg;
          } else {
            label = label + secondOrg;
          }

          tabbed.addTab(label, gearsIcon.getImage(), jScrollPane);
        }
      }
    }
    splitPanel.setBottomComponent(tabbed);
  }
Exemplo n.º 27
0
  protected void buildErrorPanel() {
    errorPanel = new JPanel();
    GroupLayout layout = new GroupLayout(errorPanel);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    errorPanel.setLayout(layout);
    //    errorPanel.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK));
    errorMessage = new JTextPane();
    errorMessage.setEditable(false);
    errorMessage.setContentType("text/html");
    errorMessage.setText(
        "<html><body>Could not connect to the Processing server.<br>"
            + "Contributions cannot be installed or updated without an Internet connection.<br>"
            + "Please verify your network connection again, then try connecting again.</body></html>");
    errorMessage.setFont(Toolkit.getSansFont(14, Font.PLAIN));
    errorMessage.setMaximumSize(new Dimension(550, 50));
    errorMessage.setOpaque(false);

    StyledDocument doc = errorMessage.getStyledDocument();
    SimpleAttributeSet center = new SimpleAttributeSet();
    StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
    doc.setParagraphAttributes(0, doc.getLength(), center, false);

    closeButton = new JButton("X");
    closeButton.setContentAreaFilled(false);
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            contribDialog.makeAndShowTab(false, false);
          }
        });
    tryAgainButton = new JButton("Try Again");
    tryAgainButton.setFont(Toolkit.getSansFont(14, Font.PLAIN));
    tryAgainButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            contribDialog.makeAndShowTab(false, true);
            contribDialog.downloadAndUpdateContributionListing(editor.getBase());
          }
        });
    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(errorMessage)
                    .addComponent(
                        tryAgainButton,
                        StatusPanel.BUTTON_WIDTH,
                        StatusPanel.BUTTON_WIDTH,
                        StatusPanel.BUTTON_WIDTH))
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addComponent(closeButton));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout.createParallelGroup().addComponent(errorMessage).addComponent(closeButton))
            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(tryAgainButton));
    errorPanel.setBackground(Color.PINK);
    errorPanel.validate();
  }
Exemplo n.º 28
0
  // Experience suggests that one should avoid using weights when using the
  // GridBagLayout. I find that nonzero weights can cause layout bugs that are
  // hard to track down. [Jon Aquino]
  void jbInit() throws Exception {
    _descriptionTextArea.setOpaque(false);
    get_okCancelPanel()
        .addActionListener(
            new java.awt.event.ActionListener() {
              public void actionPerformed(ActionEvent e) {
                okCancelPanel_actionPerformed(e);
              }
            });
    this.addComponentListener(
        new java.awt.event.ComponentAdapter() {
          public void componentShown(ComponentEvent e) {
            this_componentShown(e);
          }
        });

    // _outerMainPanel.setLayout(new GridBagLayout());
    // _outerMainPanel.setAlignmentX((float) 0.7);
    _outerMainPanel.setLayout(new BorderLayout());
    this.setResizable(true);
    this.getContentPane().setLayout(new BorderLayout());
    _imagePanel.setBorder(BorderFactory.createEtchedBorder());
    _imagePanel.setLayout(new GridBagLayout());
    _mainPanel.setLayout(new BorderLayout());
    try {
      _descriptionTextArea.setPreferredSize(new Dimension(100, 100));
      _descriptionTextArea.setOpaque(false);
      _descriptionTextArea.setEnabled(false);
      _descriptionTextArea.setEditable(false);
      _descriptionTextArea.setContentType("text/html");
    } catch (RuntimeException e1) {
      // Problemas para instanciar el kit text/html en el Plugin
      logger.error("jbInit()", e1);
      if (logger.isDebugEnabled()) {
        logger.debug(
            "jbInit() - La clase a instanciar para html es:"
                + _descriptionTextArea.getEditorKitForContentType("text/html"));
      }
    }

    documentExtendedForm = new DocumentExtendedForm();
    documentExtendedForm.initialize(this);
    setDescription();
    _imagePanel.add(
        _descriptionTextArea,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(10, 10, 10, 10),
            0,
            0));

    _imagePanel.add(
        _infoFeatures,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(10, 10, 10, 10),
            0,
            0));
    _imagePanel.add(
        _strutPanel,
        new GridBagConstraints(
            0,
            20,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
    _outerMainPanel.add(_mainPanel, BorderLayout.CENTER);
    _outerMainPanel.add(_imagePanel, BorderLayout.WEST);

    _descriptionTextArea.setFont(_imageLabel.getFont());
    _descriptionTextArea.setDisabledTextColor(_imageLabel.getForeground());
    if (features.size() > 1) _infoFeatures.add(getFeaturesComboBox(), null);
    this.setContentPane(getContentPanel()); // Generated
    _strutPanel.add(getZoomFeatureButton(), null); // Generated
    _strutPanel.add(getFlashFeatureButton(), null); // Generated
  }
Exemplo n.º 29
0
  private void jbInit() throws Exception {
    borderForProjectView = BorderFactory.createLineBorder(Color.black, 2);
    titleBoderForProjectView = new TitledBorder(borderForProjectView, "Project view");
    borderForEntitiesView = BorderFactory.createLineBorder(Color.black, 2);
    titledBorderForEntitiesView = new TitledBorder(borderForEntitiesView, "Entities view");
    titledBorderForMessagesPane =
        new TitledBorder(
            BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)), "Messages");
    this.getContentPane().setLayout(borderLayout2);
    file.setText("File");
    save.setEnabled(false);
    save.setText("Save");
    save.setName("Savefilemenu");
    save.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            save_actionPerformed(e);
          }
        });
    load.setText("Load");
    load.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            load_actionPerformed(e);
          }
        });
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    this.setJMenuBar(mainMenuBar);
    this.setTitle("INGENIAS Development Kit");
    this.setSize(625, 470);
    this.addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosed(WindowEvent e) {
            this_windowClosed(e);
          }

          public void windowClosing(WindowEvent e) {
            this_windowClosing(e);
          }
        });
    splitPaneSeparatingProjectsAndEntitiesView.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPaneSeparatingProjectsAndEntitiesView.setBottomComponent(scrollPaneForEntitiesView);
    splitPaneSeparatingProjectsAndEntitiesView.setTopComponent(scrollPaneForProyectView);
    jPanel1.setLayout(gridLayout1);
    arbolObjetos.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            arbolObjetos_mouseClicked(e);
          }
        });
    scrollPaneForProyectView.setAutoscrolls(true);
    scrollPaneForProyectView.setBorder(titleBoderForProjectView);
    scrollPaneForEntitiesView.setBorder(titledBorderForEntitiesView);
    edit.setText("Edit");
    copyImage.setText("Copy diagram as a file");
    copyImage.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            capture_actionPerformed(e);
          }
        });
    saveas.setText("Save as");
    saveas.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveas_actionPerformed(e);
          }
        });
    help.setText("Help");
    manual.setText("Tool manual");
    manual.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            manual_actionPerformed(e);
          }
        });
    about.setText("About");
    about.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            about_actionPerformed(e);
          }
        });
    project.setText("Project");
    copy.setText("Copy");
    copy.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            copy_actionPerformed(e);
          }
        });
    paste.setText("Paste");
    paste.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            paste_actionPerformed(e);
          }
        });
    exit.setText("Exit");
    exit.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            exit_actionPerformed(e);
          }
        });
    splitPanelDiagramMessagesPaneSeparator.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPanelDiagramMessagesPaneSeparator.setLastDividerLocation(150);
    pprin.setLayout(new BorderLayout());
    pprin.setName("DiagramPane");
    pprin.setPreferredSize(new Dimension(400, 300));
    pprin.add(BorderLayout.SOUTH, pbar);
    pbar.setVisible(false);
    jSplitPane1.setOrientation(JSplitPane.HORIZONTAL_SPLIT);

    scrollLogs.setBorder(titledBorderForMessagesPane);
    scrollLogs.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            jScrollPane3_keyPressed(e);
          }
        });
    this.clearMessages.setText("Clear");
    clearMessages.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clearMessages_actionPerformed(e, (JTextPane) messagesMenu.getInvoker());
          }
        });
    forcegc.setText("Force GC");
    forcegc.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            forcegc_actionPerformed(e);
          }
        });

    menuTools.setText("Tools");
    menuCodeGenerator.setText("Code Generator");
    profiles.setText("Profiles");

    menuModules.setText("Modules");
    this.properties.setText("Properties");
    properties.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            properties_actionPerformed(e);
          }
        });
    moutput.setEditable(false);
    moutput.setSelectionStart(0);
    moutput.setText("");
    moduleOutput.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            moduleOutput_mouseClicked(e);
          }
        });
    moduleOutput.setFont(new java.awt.Font("Monospaced", 0, 11));
    logs.setContentType("text/html");
    logs.setEditable(false);
    logs.setText("");
    logs.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            logs_mouseClicked(e);
          }
        });
    logs.addComponentListener(
        new java.awt.event.ComponentAdapter() {
          public void componentResized(ComponentEvent e) {
            logs_componentResized(e);
          }
        });
    newProject.setText("New");
    newProject.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            newProject_actionPerformed(e);
          }
        });
    undo.setText("Undo");
    undo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            undo_actionPerformed(e);
          }
        });
    redo.setText("Redo");
    redo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            redo_actionPerformed(e);
          }
        });
    delete.setText("Delete");
    delete.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            delete_actionPerformed(e);
          }
        });
    selectall.setText("Select all");
    selectall.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectall_actionPerformed(e);
          }
        });
    cpClipboard.setText("Copy diagram to clipboard");
    cpClipboard.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cpClipboard_actionPerformed(e);
          }
        });
    preferences.setText("Preferences");

    enableUMLView.setToolTipText("UML view" + "instead of its type");
    enableUMLView.setText("Enable UML view from now on");
    enableUMLView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            enableUMLView_actionPerformed(e);
          }
        });
    enableINGENIASView.setToolTipText("INGENIAS view");
    enableINGENIASView.setText("Enable INGENIAS view from now on");
    enableINGENIASView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            enableINGENIASView_actionPerformed(e);
          }
        });

    switchINGENIASView.setToolTipText("Switch to INGENIAS view");
    switchINGENIASView.setText("Switch to INGENIAS view");
    switchINGENIASView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            switchINGENIASView_actionPerformed(e);
          }
        });

    switchUMLView.setToolTipText("Switch to UML view");
    switchUMLView.setText("Switch to UML view");
    switchUMLView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            switchUMLView_actionPerformed(e);
          }
        });

    resizeAll.setToolTipText("Resize all");
    resizeAll.setText("Resize all entities within current diagram");
    resizeAll.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resizeAll_actionPerformed(e);
          }
        });

    resizeAllDiagrams.setToolTipText("Resize all diagrams");
    resizeAllDiagrams.setText("Resize all entities within all defined diagram");
    resizeAllDiagrams.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resizeAllDiagrams_actionPerformed(e);
          }
        });

    JMenuItem workspaceEntry = new JMenuItem("Switch workspace");
    workspaceEntry.setToolTipText("Change current workspace");
    workspaceEntry.setText("Switch workspace");
    workspaceEntry.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changeWorkspace(e);
          }
        });
    preferences.add(workspaceEntry);
    preferences.add(resizeAll);
    preferences.add(resizeAllDiagrams);
    {
      elimOverlap = new JMenuItem();
      preferences.add(elimOverlap);
      elimOverlap.setText("Eliminate overlap");
      elimOverlap.setAccelerator(KeyStroke.getKeyStroke("F3"));
      elimOverlap.addMenuKeyListener(
          new MenuKeyListener() {
            public void menuKeyPressed(MenuKeyEvent evt) {
              System.out.println("elimOverlap.menuKeyPressed, event=" + evt);
              // TODO add your code for elimOverlap.menuKeyPressed
            }

            public void menuKeyReleased(MenuKeyEvent evt) {
              System.out.println("elimOverlap.menuKeyReleased, event=" + evt);
              // TODO add your code for elimOverlap.menuKeyReleased
            }

            public void menuKeyTyped(MenuKeyEvent evt) {
              elimOverlapMenuKeyTyped(evt);
            }
          });
      elimOverlap.addKeyListener(
          new KeyAdapter() {
            public void keyPressed(KeyEvent evt) {
              elimOverlapKeyPressed(evt);
            }
          });
      elimOverlap.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              elimOverlapActionPerformed(evt);
            }
          });
    }
    {
      modelingLanguageNotationSwitchMenu = new JMenu();
      preferences.add(modelingLanguageNotationSwitchMenu);
      modelingLanguageNotationSwitchMenu.setText("Modelling language");
      modelingLanguageNotationSwitchMenu.add(enableINGENIASView);

      viewSelection.add(enableINGENIASView);
      modelingLanguageNotationSwitchMenu.add(enableUMLView);
      viewSelection.add(enableUMLView);

      enableINGENIASView.setSelected(true);
      modelingLanguageNotationSwitchMenu.add(switchUMLView);
      modelingLanguageNotationSwitchMenu.add(switchINGENIASView);
    }
    {
      propertiesModeMenu = new JMenu();
      preferences.add(propertiesModeMenu);
      propertiesModeMenu.setText("Edit Properties Mode");
      {
        editPopUpProperties = new JCheckBoxMenuItem();
        propertiesModeMenu.add(editPopUpProperties);
        editPopUpProperties.setText("Edit Properties in a PopUp Window");
        editPopUpProperties.setSelected(true);
        editPopUpProperties.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                editPopUpProperties_selected();
              }
            });
        propertiesEditModeSelection.add(editPopUpProperties);
      }
      {
        editOnMessages = new JCheckBoxMenuItem();
        propertiesModeMenu.add(editOnMessages);
        editOnMessages.setText("Edit Properties in Messages Panel");
        propertiesEditModeSelection.add(editOnMessages);
        editOnMessages.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                editOnMessages_selected();
              }
            });
      }
    }

    mainMenuBar.add(file);
    mainMenuBar.add(edit);
    mainMenuBar.add(project);
    mainMenuBar.add(menuModules);
    mainMenuBar.add(profiles);
    mainMenuBar.add(preferences);
    mainMenuBar.add(help);
    file.add(newProject);
    file.add(load);
    {
      importFile = new JMenuItem();
      file.add(importFile);
      importFile.setText("Import file");
      importFile.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              importFileActionPerformed(evt);
            }
          });
    }
    file.add(save);
    file.add(saveas);
    file.addSeparator();
    file.add(exit);
    file.addSeparator();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(buttonModelPanel, BorderLayout.WEST);
    this.getContentPane().add(jSplitPane1, BorderLayout.CENTER);
    rightPanel.add(splitPanelDiagramMessagesPaneSeparator, BorderLayout.CENTER);
    jSplitPane1.add(splitPaneSeparatingProjectsAndEntitiesView, JSplitPane.LEFT);
    splitPaneSeparatingProjectsAndEntitiesView.add(scrollPaneForProyectView, JSplitPane.TOP);
    {
      jPanel2 = new JPanel();
      BorderLayout jPanel2Layout = new BorderLayout();
      jPanel2.setLayout(jPanel2Layout);
      splitPaneSeparatingProjectsAndEntitiesView.add(jPanel2, JSplitPane.BOTTOM);
      jPanel2.add(jPanel1, BorderLayout.SOUTH);
      jPanel2.add(scrollPaneForEntitiesView, BorderLayout.CENTER);
    }
    jSplitPane1.add(rightPanel, JSplitPane.RIGHT);
    splitPanelDiagramMessagesPaneSeparator.add(pprin, JSplitPane.TOP);
    splitPanelDiagramMessagesPaneSeparator.add(messagespane, JSplitPane.BOTTOM);
    JScrollPane scrollSearchDiagram = new JScrollPane();
    scrollSearchDiagram.getViewport().add(searchDiagramPanel, null);
    searchDiagramPanel.setContentType("text/html");
    searchDiagramPanel.setEditable(false);

    messagespane.addConventionalTab(scrollLogs, "Logs");
    scrollLogs.getViewport().add(logs, null);
    scrolloutput.getViewport().add(this.moduleOutput, null);
    messagespane.addConventionalTab(scrolloutput, "Module Output");
    messagespane.addConventionalTab(scrollSearchDiagram, "Search");
    scrolloutput.getViewport().add(moduleOutput, null);
    {
      searchPanel = new JPanel();
      FlowLayout searchPanelLayout = new FlowLayout();
      searchPanelLayout.setVgap(1);
      searchPanel.setLayout(searchPanelLayout);
      jPanel1.add(searchPanel, BorderLayout.SOUTH);
      searchPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
      {
        searchField = new JTextField();
        searchPanel.add(searchField);
        searchField.setColumns(15);

        searchField.addKeyListener(
            new KeyAdapter() {
              public void keyTyped(KeyEvent evt) {
                searchFieldKeyTyped(evt);
              }
            });
      }
      {
        Search = new JButton();
        scrollPaneForProyectView.setViewportView(arbolProyectos);
        scrollPaneForEntitiesView.setViewportView(arbolObjetos);
        searchPanel.add(Search);

        Search.setIcon(new ImageIcon(ImageLoader.getImage(("images/lense.png"))));
        //	Search.setPreferredSize(new java.awt.Dimension(20, 20));
        Search.setIconTextGap(0);
        Search.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                SearchActionPerformed(evt);
              }
            });
      }
    }
    edit.add(undo);
    edit.add(redo);
    edit.addSeparator();
    edit.add(copy);
    edit.add(paste);
    edit.add(delete);
    edit.add(selectall);
    edit.addSeparator();
    edit.add(copyImage);
    edit.add(cpClipboard);
    help.add(manual);
    help.add(about);
    help.add(forcegc);

    menuModules.add(menuTools);
    menuModules.add(menuCodeGenerator);
    messagesMenu.add(this.clearMessages);
    project.add(this.properties);

    project.addSeparator();
    jSplitPane1.setDividerLocation(250);
    splitPaneSeparatingProjectsAndEntitiesView.setDividerLocation(250);
    arbolProyectos.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            arbolProyectos_mouseClicked(e);
          }
        });
    splitPanelDiagramMessagesPaneSeparator.setDividerLocation(400);
  }
Exemplo n.º 30
0
  private JPanel createCentrePanel(YDataStateException exception) {
    XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat());
    JPanel centrePanel = new JPanel(new GridLayout(1, 2));

    JPanel schemaPanel = new JPanel(new BorderLayout());
    schemaPanel.setBackground(YAdminGUI._apiColour);
    schemaPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "Schema for completing task"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane schemaTextPane = new JTextPane();
    schemaTextPane.setContentType("text/xml");
    schemaTextPane.setFont(new Font("courier", Font.PLAIN, 12));
    String schemaXML = xmlOut.outputString(exception.getSchema());

    /** AJH: Trap various XML format errors gracefully. */
    try {
      String xml =
          schemaXML.substring(schemaXML.indexOf('<'), schemaXML.lastIndexOf("</xsd:schema>") + 13);
      schemaTextPane.setText(xml);
    } catch (Exception e) {
      schemaTextPane.setText(schemaXML);
    }

    schemaTextPane.setEditable(false);
    schemaTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel = new JPanel();
    noWrapPanel.setLayout(new BorderLayout());
    noWrapPanel.add(schemaTextPane);
    schemaPanel.add(new JScrollPane(noWrapPanel));

    JPanel rightPanel = new JPanel(new GridLayout(2, 1));

    JPanel dataPanel = new JPanel(new BorderLayout());
    dataPanel.setBackground(YAdminGUI._apiColour);
    dataPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "The data that failed to validate"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane dataTextPane = new JTextPane();
    dataTextPane.setContentType("text/xml");
    dataTextPane.setFont(new Font("courier", Font.PLAIN, 12));
    String data = xmlOut.outputString(exception.get_dataInput());

    /** AJH: Trap various XML format errors gracefully. */
    try {
      String temp = data.substring(data.lastIndexOf("<?xml"), data.lastIndexOf('>'));
      dataTextPane.setText(temp);
    } catch (Exception e) {
      dataTextPane.setText(data);
    }

    dataTextPane.setEditable(false);
    dataTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel2 = new JPanel();
    noWrapPanel2.setLayout(new BorderLayout());
    noWrapPanel2.add(dataTextPane);
    dataPanel.add(new JScrollPane(noWrapPanel2));

    JPanel errorPanel = new JPanel(new BorderLayout());
    errorPanel.setBackground(YAdminGUI._apiColour);
    errorPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "The error message from validation engine"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane errorTextPane = new JTextPane();
    errorTextPane.setContentType("text/plain");
    errorTextPane.setFont(new Font("courier", Font.PLAIN, 12));

    /** AJH: Trap various XML format errors gracefully. */
    try {
      String error = schemaXML.substring(schemaXML.lastIndexOf("ERRORS ="), schemaXML.length());
      errorTextPane.setText(error);
    } catch (Exception e) {
      // null action !
    }

    errorTextPane.setText(exception.getErrors());

    errorTextPane.setEditable(false);
    errorTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel3 = new JPanel();
    noWrapPanel3.setLayout(new BorderLayout());
    noWrapPanel3.add(errorTextPane);
    errorPanel.add(new JScrollPane(noWrapPanel3));

    rightPanel.add(dataPanel);
    rightPanel.add(errorPanel);
    centrePanel.add(schemaPanel, BorderLayout.NORTH);
    centrePanel.add(rightPanel, BorderLayout.CENTER);
    return centrePanel;
  }