コード例 #1
0
ファイル: AboutDialog.java プロジェクト: nsahoo/cmssw-1
  /** standard constructor */
  public AboutDialog(JFrame frame) {
    super(frame, true);

    getConfDbVersion(); // load info from confdb.version file
    getContactPerson(); // load info from confdb.version file

    setTitle("About ConfDbGUI");

    setContentPane(initComponents());

    String txt =
        "<p>Thank you for using <b>ConfDbGUI</b>,"
            + "a CMS tool to create and manage "
            + "CMSSW job configurations based on a "
            + "relational database.</p>"
            + "This software was originally developed "
            + "by Philipp Schieferdecker and is currently "
            + "maintained by Raul Jimenez Estupinan "
            + "with contributions from Ulf Behrens, "
            + "Jonathan Hollar, Vasundhara Chetluru "
            + "and Martin Gruenewald. "
            + "<p>For feedback please contact me at "
            + "<b>"
            + contactEmail
            + "</b>.</p>"
            + "<p>Find documentation on the web under "
            + "<b>https://twiki.cern.ch/twiki/bin/view/CMS/EvfConfDBGUI</b>.</p>";

    jTextFieldApplication.setText("ConfDbGUI");
    // jTextFieldVersion.setText("V01-05-82"); // Change in confdb.version file!

    jEditorPaneAbout.setContentType("text/html");
    jEditorPaneAbout.setText(txt);
  }
コード例 #2
0
  private void setSubscriberDetails(
      String subscriberName, String subscriberAddress, String message) {
    this.name = subscriberName;
    this.address = subscriberAddress;

    Color color = messagePane.getForeground();

    messagePane.setText(
        "<FONT COLOR=\"#"
            + Integer.toHexString(color.getRGB()).substring(2)
            + "\">"
            + messageString1
            + "<p>"
            + namePrefix
            + name
            + nameSuffix
            + "<br>"
            + addressPrefix
            + address
            + addressSuffix
            + "<p>"
            + ((message != null && message.trim().length() > 0)
                ? messagePrefix + message + messageSuffix + "<p>"
                : "")
            + messageString2
            + "</FONT>");
  }
コード例 #3
0
 private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
コード例 #4
0
  @Override
  public JComponent getContent() {

    if (this.obj == null) {

      throw new IllegalStateException("No object set.");
    }

    // TODO: Make this nicer later.
    if (this.obj instanceof Chapter) {

      Chapter c = (Chapter) this.obj;

      JComponent t = UIUtils.getChapterInfoPreview(c, null, this.viewer);

      if (t == null) {

        // May be a fake chapter, return null.
        return null;
      }

      t.setSize(new Dimension(300, Short.MAX_VALUE));

      return t;

    } else {

      String firstLine = "<b><i>No description.</i></b>";

      String t = (obj.getDescription() != null ? obj.getDescription().getText() : null);

      if ((t != null) && (t.length() > 0)) {

        firstLine = new Paragraph(t, 0).getFirstSentence().getText();
      }

      JEditorPane desc = UIUtils.createHelpTextPane(firstLine, null);

      FormLayout fl = new FormLayout("380px", "p");

      PanelBuilder pb = new PanelBuilder(fl);

      CellConstraints cc = new CellConstraints();

      pb.add(desc, cc.xy(1, 1));

      desc.setAlignmentX(Component.LEFT_ALIGNMENT);

      JPanel p = pb.getPanel();
      p.setOpaque(true);
      p.setBackground(UIUtils.getComponentColor());

      return p;
    }
  }
コード例 #5
0
  public void displayPage(JEditorPane pane, String text) {
    try {
      File helpFile = new File((String) locations.get(text));
      String loc = "file:" + helpFile.getAbsolutePath();
      URL page = new URL(loc);

      pane.setPage(page);

    } catch (IOException ioe) {
      JOptionPane.showMessageDialog(null, "Help Topic Unavailable");
      pane.getParent().repaint();
    }
  }
コード例 #6
0
  private void initComponents() {
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

    messagePane.setBackground(contentPane.getBackground());
    messagePane.setEditorKit(new HTMLEditorKit());
    messagePane.setForeground(contentPane.getForeground());

    setSize(450, 360);

    // center the window
    int x = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() - getWidth()) / 2;
    int y = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() - getHeight()) / 2;
    setLocation(x, y);

    okButton.addActionListener(this);
  }
コード例 #7
0
 /**
  * Called when the selection changed in the tree. Loads the selected certificate.
  *
  * @param e the event
  */
 private void valueChangedPerformed(TreeSelectionEvent e) {
   Object o = e.getNewLeadSelectionPath().getLastPathComponent();
   if (o instanceof DefaultMutableTreeNode) {
     DefaultMutableTreeNode node = (DefaultMutableTreeNode) o;
     infoTextPane.setText(toString(node.getUserObject()));
   }
 }
コード例 #8
0
    TextPanel(String file) {
      super(new BorderLayout());

      JEditorPane text = new JEditorPane();

      try {
        text.setPage(TextPanel.this.getClass().getResource(file));
      } catch (Exception e) {
        text.setText("Error loading '" + file + "'");
        e.printStackTrace();
      }

      text.setEditable(false);

      JScrollPane scrollPane = new JScrollPane(text);
      Dimension dim = new Dimension();
      dim.width = 450;
      dim.height = 200;
      scrollPane.setPreferredSize(dim);
      TextPanel.this.add(BorderLayout.CENTER, scrollPane);
    }
コード例 #9
0
  public SyntaxTest() {

    JFrame frame = new JFrame();
    frame.setSize(300, 300);

    JEditorPane editor = new JEditorPane();
    DefaultSyntaxKit.initKit();
    editor.setContentType("text/banking");

    frame.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1.0;
    c.weighty = 1.0;
    c.fill = GridBagConstraints.BOTH;

    frame.add(editor, c);

    frame.pack();
    frame.setVisible(true);
  }
コード例 #10
0
ファイル: AboutDialog.java プロジェクト: nsahoo/cmssw-1
  /** initialize GUI components */
  private JPanel initComponents() {
    JPanel panel = new JPanel();
    JScrollPane jScrollPane1 = new JScrollPane();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();

    jScrollPane1.setViewportView(jEditorPaneAbout);

    jButtonOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButtonOkActionPerformed(e);
          }
        });

    jButtonOk.setText("OK");
    jLabel1.setText("Application:");
    jLabel2.setText("Version:");

    jTextFieldApplication.setBackground(new Color(255, 255, 255));
    jTextFieldApplication.setEditable(false);
    jTextFieldApplication.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));

    jTextFieldVersion.setBackground(new Color(255, 255, 255));
    jTextFieldVersion.setEditable(false);
    jTextFieldVersion.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));

    jEditorPaneAbout.setEditable(false);

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(panel);
    panel.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .add(
                        layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(
                                layout
                                    .createSequentialGroup()
                                    .addContainerGap()
                                    .add(
                                        layout
                                            .createParallelGroup(
                                                org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(
                                                jScrollPane1,
                                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                289,
                                                Short.MAX_VALUE)
                                            .add(
                                                layout
                                                    .createSequentialGroup()
                                                    .add(
                                                        layout
                                                            .createParallelGroup(
                                                                org.jdesktop.layout.GroupLayout
                                                                    .LEADING)
                                                            .add(
                                                                jTextFieldApplication,
                                                                org.jdesktop.layout.GroupLayout
                                                                    .PREFERRED_SIZE,
                                                                145,
                                                                org.jdesktop.layout.GroupLayout
                                                                    .PREFERRED_SIZE)
                                                            .add(jLabel1))
                                                    .add(4, 4, 4)
                                                    .add(
                                                        layout
                                                            .createParallelGroup(
                                                                org.jdesktop.layout.GroupLayout
                                                                    .LEADING)
                                                            .add(jLabel2)
                                                            .add(
                                                                jTextFieldVersion,
                                                                org.jdesktop.layout.GroupLayout
                                                                    .DEFAULT_SIZE,
                                                                140,
                                                                Short.MAX_VALUE)))))
                            .add(
                                layout
                                    .createSequentialGroup()
                                    .add(106, 106, 106)
                                    .add(
                                        jButtonOk,
                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                        101,
                                        Short.MAX_VALUE)
                                    .add(94, 94, 94)))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel1)
                            .add(jLabel2))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(
                                jTextFieldApplication,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(
                                jTextFieldVersion,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        jScrollPane1,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        300,
                        Short.MAX_VALUE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jButtonOk)
                    .addContainerGap()));
    return panel;
  }
コード例 #11
0
ファイル: DialogAbout.java プロジェクト: zukov/Jpicedt
  /** Construct a new "about&hellip;" dialog */
  public DialogAbout(MDIManager mdimgr) {

    buttonOk = new JButton(localize("button.OK"));
    buttonOk.addActionListener(this);

    JPanel buttonPanel = new JPanel(new FlowLayout(), false);
    buttonPanel.add(buttonOk);

    JPanel logoPanel = new JPanel(new FlowLayout(), false);
    logoPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    logoPanel.add(PEToolKit.createJLabel("Frankenstein"));

    JPanel infoPanel = new JPanel(new GridLayout(9, 1, 5, 5), true);
    infoPanel.setBorder(new EmptyBorder(10, 60, 10, 10));
    infoPanel.add(
        new JLabel("jPicEdt " + Version.getVersion() + " Built " + Version.getBuildDate()));
    infoPanel.add(new JLabel(localize("about.APictureEditorFor")));
    final String[] addressLines = {
      "(c) Sylvain Reynal",
      "É.N.S.É.A. - Dept. of Physics",
      "6, avenue du Ponceau",
      "F-95014 CERGY Cedex",
      "Fax: +33 (0) 130 736 667",
      "*****@*****.**",
      "http://www.jpicedt.org"
    };
    for (String addressLine : addressLines) infoPanel.add(new JLabel(addressLine));

    JTabbedPane caveatPanel = new JTabbedPane();
    String[] tabKeys = {"license.lines", "license.thirdparty.lines"};
    for (String tabKey : tabKeys) {
      JEditorPane caveatTA = new JEditorPane();
      caveatTA.setContentType("text/html; charset=" + localize(tabKey + ".encoding"));
      caveatTA.setEditable(false);
      caveatTA.setPreferredSize(new Dimension(485, 300));
      JScrollPane scrollCaveat = new JScrollPane(caveatTA);
      caveatTA.setText(localize(tabKey));
      caveatPanel.addTab(localize(tabKey + ".tabname"), null, scrollCaveat, null);
    }

    caveatPanel.setBorder(BorderFactory.createEtchedBorder());

    JPanel upperPanel = new JPanel(new BorderLayout(), false);
    upperPanel.add(logoPanel, BorderLayout.WEST);
    upperPanel.add(infoPanel, BorderLayout.CENTER);
    upperPanel.add(caveatPanel, BorderLayout.SOUTH);
    upperPanel.setBorder(BorderFactory.createEtchedBorder());

    JPanel contentPane = new JPanel(new BorderLayout(5, 5));
    contentPane.add(upperPanel, BorderLayout.NORTH);
    contentPane.add(buttonPanel, BorderLayout.SOUTH);

    String title = localize("about.AboutPicEdt") + " " + Version.getVersion();
    boolean modal = true;
    frame = mdimgr.createDialog(title, modal, contentPane);
    frame.setResizable(true);
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    Dimension dlgSize = frame.getPreferredSize();
    frame.setSize(dlgSize);

    // this.pack();
    frame.setVisible(true);
  }
コード例 #12
0
  public AboutDialog(JConsole jConsole) {
    super(jConsole, Resources.getText("Help.AboutDialog.title"), false);

    setAccessibleDescription(this, getText("Help.AboutDialog.accessibleDescription"));
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    setResizable(false);
    JComponent cp = (JComponent) getContentPane();

    createActions();

    JLabel mastheadLabel = new JLabel(mastheadIcon);
    setAccessibleName(mastheadLabel, getText("Help.AboutDialog.masthead.accessibleName"));

    JPanel mainPanel = new TPanel(0, 0);
    mainPanel.add(mastheadLabel, NORTH);

    String jConsoleVersion = Version.getVersion();
    String vmName = System.getProperty("java.vm.name");
    String vmVersion = System.getProperty("java.vm.version");
    String urlStr = getText("Help.AboutDialog.userGuideLink.url");
    if (isBrowseSupported()) {
      urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>";
    }

    JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10));
    infoAndLogoPanel.setBackground(bgColor);

    String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF);
    JEditorPane helpLink =
        new JEditorPane(
            "text/html",
            "<html><font color=#"
                + colorStr
                + ">"
                + getText("Help.AboutDialog.jConsoleVersion", jConsoleVersion)
                + "<p>"
                + getText("Help.AboutDialog.javaVersion", (vmName + ", " + vmVersion))
                + "<p>"
                + getText("Help.AboutDialog.userGuideLink", urlStr)
                + "</html>");
    helpLink.setOpaque(false);
    helpLink.setEditable(false);
    helpLink.setForeground(textColor);
    mainPanel.setBorder(BorderFactory.createLineBorder(borderColor));
    infoAndLogoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    helpLink.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              browse(e.getDescription());
            }
          }
        });
    infoAndLogoPanel.add(helpLink, NORTH);

    ImageIcon brandLogoIcon = new ImageIcon(getClass().getResource("resources/brandlogo.png"));
    JLabel brandLogo = new JLabel(brandLogoIcon, JLabel.LEADING);

    JButton closeButton = new JButton(closeAction);

    JPanel bottomPanel = new TPanel(0, 0);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    buttonPanel.setOpaque(false);

    mainPanel.add(infoAndLogoPanel, CENTER);
    cp.add(bottomPanel, SOUTH);

    infoAndLogoPanel.add(brandLogo, SOUTH);

    buttonPanel.setBorder(new EmptyBorder(2, 12, 2, 12));
    buttonPanel.add(closeButton);
    bottomPanel.add(buttonPanel, NORTH);

    statusBar = new JLabel(" ");
    bottomPanel.add(statusBar, SOUTH);

    cp.add(mainPanel, NORTH);

    pack();
    setLocationRelativeTo(jConsole);
    Utilities.updateTransparency(this);
  }
コード例 #13
0
  /**
   * Constructs a X509 certificate panel.
   *
   * @param certificates <tt>X509Certificate</tt> objects
   */
  public X509CertificatePanel(Certificate[] certificates) {
    setLayout(new BorderLayout(5, 5));

    // Certificate chain list
    TransparentPanel topPanel = new TransparentPanel(new BorderLayout());
    topPanel.add(
        new JLabel(
            "<html><body><b>"
                + R.getI18NString("service.gui.CERT_INFO_CHAIN")
                + "</b></body></html>"),
        BorderLayout.NORTH);

    DefaultMutableTreeNode top = new DefaultMutableTreeNode();
    DefaultMutableTreeNode previous = top;
    for (int i = certificates.length - 1; i >= 0; i--) {
      Certificate cert = certificates[i];
      DefaultMutableTreeNode next = new DefaultMutableTreeNode(cert);
      previous.add(next);
      previous = next;
    }
    JTree tree = new JTree(top);
    tree.setBorder(new BevelBorder(BevelBorder.LOWERED));
    tree.setRootVisible(false);
    tree.setExpandsSelectedPaths(true);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setCellRenderer(
        new DefaultTreeCellRenderer() {

          @Override
          public Component getTreeCellRendererComponent(
              JTree tree,
              Object value,
              boolean sel,
              boolean expanded,
              boolean leaf,
              int row,
              boolean hasFocus) {
            JLabel component =
                (JLabel)
                    super.getTreeCellRendererComponent(
                        tree, value, sel, expanded, leaf, row, hasFocus);
            if (value instanceof DefaultMutableTreeNode) {
              Object o = ((DefaultMutableTreeNode) value).getUserObject();
              if (o instanceof X509Certificate) {
                component.setText(getSimplifiedName((X509Certificate) o));
              } else {
                // We don't know how to represent this certificate type,
                // let's use the first 20 characters
                String text = o.toString();
                if (text.length() > 20) {
                  text = text.substring(0, 20);
                }
                component.setText(text);
              }
            }
            return component;
          }
        });
    tree.getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {

              @Override
              public void valueChanged(TreeSelectionEvent e) {
                valueChangedPerformed(e);
              }
            });
    tree.setSelectionPath(
        new TreePath((((DefaultTreeModel) tree.getModel()).getPathToRoot(previous))));
    topPanel.add(tree, BorderLayout.CENTER);

    add(topPanel, BorderLayout.NORTH);

    // Certificate details pane
    Caret caret = infoTextPane.getCaret();
    if (caret instanceof DefaultCaret) {
      ((DefaultCaret) caret).setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    }

    /*
     * Make JEditorPane respect our default font because we will be using it
     * to just display text.
     */
    infoTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);

    infoTextPane.setOpaque(false);
    infoTextPane.setEditable(false);
    infoTextPane.setContentType("text/html");
    infoTextPane.setText(toString(certificates[0]));

    final JScrollPane certScroll = new JScrollPane(infoTextPane);
    certScroll.setPreferredSize(new Dimension(300, 500));
    add(certScroll, BorderLayout.CENTER);
  }