385N/A/*
385N/A * CDDL HEADER START
385N/A *
385N/A * The contents of this file are subject to the terms of the
385N/A * Common Development and Distribution License (the "License").
385N/A * You may not use this file except in compliance with the License.
385N/A *
385N/A * See LICENSE.txt included in this distribution for the specific
385N/A * language governing permissions and limitations under the License.
385N/A *
385N/A * When distributing Covered Code, include this CDDL HEADER in each
385N/A * file and include the License file at LICENSE.txt.
385N/A * If applicable, add the following below this CDDL HEADER, with the
385N/A * fields enclosed by brackets "[]" replaced with your own identifying
385N/A * information: Portions Copyright [yyyy] [name of copyright owner]
385N/A *
385N/A * CDDL HEADER END
385N/A */
407N/A
1045N/A/*
1045N/A * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
1045N/A */
1045N/A
385N/Apackage org.opensolaris.opengrok.management.client;
385N/A
385N/Aimport java.awt.Dimension;
385N/Aimport java.awt.Toolkit;
385N/Aimport java.util.Date;
385N/A
385N/A/**
385N/A *
385N/A * @author Jan S Berg
385N/A */
457N/A@SuppressWarnings("PMD.SingularField")
385N/Apublic class NotificationsFrame extends javax.swing.JFrame {
385N/A
385N/A private static final long serialVersionUID = -7314367696755820002L;
385N/A private final java.text.SimpleDateFormat formatter =
385N/A new java.text.SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss.SSS");
385N/A
385N/A /** Creates new form NotificationsFrame */
385N/A public NotificationsFrame(String notifications, long startime, long endtime) {
385N/A initComponents();
385N/A Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
385N/A Dimension mySize = getPreferredSize();
385N/A setLocation(screenSize.width / 2 - (mySize.width / 2), screenSize.height / 2 - (mySize.height / 2));
385N/A jTextArea1.setText(notifications);
385N/A endTimelabel.setText(formatTimestamp(endtime));
385N/A startTimeLabel.setText(formatTimestamp(startime));
385N/A
385N/A }
385N/A
385N/A private String formatTimestamp(long timestamp) {
385N/A return formatter.format(new Date(timestamp));
385N/A }
385N/A
385N/A /** This method is called from within the constructor to
385N/A * initialize the form.
385N/A * WARNING: Do NOT modify this code. The content of this method is
385N/A * always regenerated by the Form Editor.
385N/A */
385N/A @SuppressWarnings("unchecked")
1045N/A // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
1045N/A private void initComponents() {
385N/A
1045N/A notificationsPane = new javax.swing.JScrollPane();
1045N/A jTextArea1 = new javax.swing.JTextArea();
1045N/A closeButton = new javax.swing.JButton();
1045N/A jLabel1 = new javax.swing.JLabel();
1045N/A jLabel2 = new javax.swing.JLabel();
1045N/A startTimeLabel = new javax.swing.JLabel();
1045N/A jLabel4 = new javax.swing.JLabel();
1045N/A endTimelabel = new javax.swing.JLabel();
385N/A
1045N/A setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
1045N/A setTitle("OpenGrok Notifications");
385N/A
1045N/A jTextArea1.setColumns(20);
1045N/A jTextArea1.setEditable(false);
1045N/A jTextArea1.setRows(5);
1045N/A notificationsPane.setViewportView(jTextArea1);
385N/A
1045N/A closeButton.setText("Close");
1045N/A closeButton.addActionListener(new java.awt.event.ActionListener() {
1045N/A public void actionPerformed(java.awt.event.ActionEvent evt) {
1045N/A closeButtonActionPerformed(evt);
1045N/A }
1045N/A });
385N/A
1045N/A jLabel1.setText("Files changed:");
385N/A
1045N/A jLabel2.setText("Last Index Start:");
385N/A
1045N/A startTimeLabel.setText("no time");
385N/A
1045N/A jLabel4.setText("Last Index End:");
385N/A
1045N/A endTimelabel.setText("no time");
385N/A
1045N/A javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
1045N/A getContentPane().setLayout(layout);
1045N/A layout.setHorizontalGroup(
1045N/A layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1045N/A .addGroup(layout.createSequentialGroup()
1045N/A .addContainerGap()
1045N/A .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1045N/A .addComponent(notificationsPane, javax.swing.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)
1045N/A .addGroup(layout.createSequentialGroup()
1045N/A .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1045N/A .addComponent(jLabel2)
1045N/A .addComponent(jLabel4))
385N/A .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1045N/A .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1045N/A .addComponent(startTimeLabel)
1045N/A .addComponent(endTimelabel)))
1045N/A .addComponent(jLabel1)
1045N/A .addComponent(closeButton, javax.swing.GroupLayout.Alignment.TRAILING))
1045N/A .addContainerGap())
1045N/A );
1045N/A layout.setVerticalGroup(
1045N/A layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1045N/A .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1045N/A .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1045N/A .addComponent(jLabel2)
1045N/A .addComponent(startTimeLabel))
1045N/A .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1045N/A .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1045N/A .addComponent(jLabel4)
1045N/A .addComponent(endTimelabel))
1045N/A .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1045N/A .addComponent(jLabel1)
1045N/A .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1045N/A .addComponent(notificationsPane, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
1045N/A .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1045N/A .addComponent(closeButton)
1045N/A .addContainerGap())
1045N/A );
385N/A
1045N/A pack();
1045N/A }// </editor-fold>//GEN-END:initComponents
385N/A
434N/A@SuppressWarnings("unused")
385N/Aprivate void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
385N/A this.dispose();
385N/A}//GEN-LAST:event_closeButtonActionPerformed
385N/A
385N/A /**
385N/A * @param args the command line arguments
385N/A */
385N/A public static void main(String args[]) {
385N/A java.awt.EventQueue.invokeLater(new Runnable() {
385N/A public void run() {
385N/A new NotificationsFrame("",0,0).setVisible(true);
385N/A }
385N/A });
385N/A }
385N/A
1045N/A // Variables declaration - do not modify//GEN-BEGIN:variables
1045N/A private javax.swing.JButton closeButton;
1045N/A private javax.swing.JLabel endTimelabel;
1045N/A private javax.swing.JLabel jLabel1;
1045N/A private javax.swing.JLabel jLabel2;
1045N/A private javax.swing.JLabel jLabel4;
1045N/A private javax.swing.JTextArea jTextArea1;
1045N/A private javax.swing.JScrollPane notificationsPane;
1045N/A private javax.swing.JLabel startTimeLabel;
1045N/A // End of variables declaration//GEN-END:variables
385N/A
385N/A}