PageRenderTime 105ms CodeModel.GetById 51ms app.highlight 31ms RepoModel.GetById 19ms app.codeStats 0ms

/src/mpv5/ui/dialogs/About.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 245 lines | 164 code | 31 blank | 50 comment | 1 complexity | 0e6e6daa5e0cd0ce15eecb6765ec5b14 MD5 | raw file
  1/*
  2 * To change this template, choose Tools | Templates
  3 * and open the template in the editor.
  4 */
  5
  6/*
  7 * SplashScreen.java
  8 *
  9 * Created on 30.03.2009, 21:55:52
 10 */
 11package mpv5.ui.dialogs;
 12
 13import java.awt.Graphics;
 14import java.awt.Image;
 15import javax.swing.DefaultListModel;
 16import javax.swing.ImageIcon;
 17import mpv5.db.common.Context;
 18import mpv5.db.common.NodataFoundException;
 19import mpv5.db.common.QueryCriteria;
 20import mpv5.db.common.QueryHandler;
 21import mpv5.globals.Constants;
 22import mpv5.logging.Log;
 23import mpv5.ui.misc.Position;
 24
 25/**
 26 *
 27 *  
 28 */
 29public class About extends javax.swing.JFrame {
 30
 31    private static final long serialVersionUID = 1L;
 32    private Image image;
 33    private Image grayImage;
 34
 35    /** Creates new form SplashScreen
 36     * @param imageIcon
 37     */
 38    public About(ImageIcon imageIcon) {
 39        initComponents();
 40        jPanel1.setOpaque(false);
 41//        jScrollPane1.setOpaque(false);
 42//        jScrollPane1.getViewport().setOpaque(false);
 43//        ((DefaultListCellRenderer)jList1.getCellRenderer()).setOpaque( false );
 44//        jList1.setOpaque(false);
 45        setInfo(Constants.VERSION);
 46        setDBVersion();
 47        website.setText(Constants.WEBSITE);
 48        DefaultListModel m = new DefaultListModel();
 49        String[] cons = Constants.CONTRIBUTORS;
 50        for (int i = 0; i < cons.length; i++) {
 51            String string = cons[i];
 52            m.addElement(string);
 53        }
 54        jList1.setModel(m);
 55        title.setText(Constants.TITLE);
 56        image = imageIcon.getImage();
 57//        grayImage = GrayFilter.createDisabledImage(image);
 58        new Position(this);
 59        setAlwaysOnTop(true);
 60        setVisible(true);
 61        Log.Debug(this, "About window loaded");
 62    }
 63
 64    /** This method is called from within the constructor to
 65     * initialize the form.
 66     * WARNING: Do NOT modify this code. The content of this method is
 67     * always regenerated by the Form Editor.
 68     */
 69    @SuppressWarnings("unchecked")
 70    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
 71    private void initComponents() {
 72
 73        jPanel1 =  new javax.swing.JPanel(){
 74            public void paintComponent(Graphics g) {
 75                g.drawImage(image, 0, 0, this);
 76                super.paintComponent(g);
 77            }
 78        };
 79        info = new javax.swing.JLabel();
 80        title = new javax.swing.JLabel();
 81        jLabel1 = new javax.swing.JLabel();
 82        jScrollPane1 = new javax.swing.JScrollPane();
 83        jList1 = new javax.swing.JList();
 84        jLabel2 = new javax.swing.JLabel();
 85        website = new javax.swing.JLabel();
 86        db_version = new javax.swing.JLabel();
 87
 88        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
 89        java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle(); // NOI18N
 90        setTitle(bundle.getString("About.title")); // NOI18N
 91        setResizable(false);
 92
 93        jPanel1.setBackground(javax.swing.UIManager.getDefaults().getColor("OptionPane.errorDialog.border.background"));
 94
 95        info.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
 96        info.setText(bundle.getString("About.info.text")); // NOI18N
 97
 98        title.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
 99        title.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
100        title.setText(bundle.getString("About.title.text")); // NOI18N
101
102        jLabel1.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
103        jLabel1.setText(bundle.getString("About.jLabel1.text")); // NOI18N
104
105        jList1.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
106        jList1.setForeground(new java.awt.Color(0, 0, 51));
107        jScrollPane1.setViewportView(jList1);
108
109        jLabel2.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
110        jLabel2.setForeground(new java.awt.Color(255, 255, 204));
111        jLabel2.setText(bundle.getString("About.jLabel2.text")); // NOI18N
112
113        website.setForeground(new java.awt.Color(255, 255, 204));
114        website.setText(bundle.getString("About.website.text")); // NOI18N
115
116        db_version.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
117        db_version.setText(bundle.getString("About.db_version.text")); // NOI18N
118
119        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
120        jPanel1.setLayout(jPanel1Layout);
121        jPanel1Layout.setHorizontalGroup(
122            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
123            .addGroup(jPanel1Layout.createSequentialGroup()
124                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
125                    .addGroup(jPanel1Layout.createSequentialGroup()
126                        .addContainerGap()
127                        .addComponent(info, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
128                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 92, Short.MAX_VALUE)
129                        .addComponent(title, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE))
130                    .addGroup(jPanel1Layout.createSequentialGroup()
131                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
132                            .addGroup(jPanel1Layout.createSequentialGroup()
133                                .addGap(71, 71, 71)
134                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
135                                    .addComponent(jLabel2)
136                                    .addComponent(website, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
137                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
138                            .addGroup(jPanel1Layout.createSequentialGroup()
139                                .addContainerGap()
140                                .addComponent(db_version, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
141                                .addGap(106, 106, 106)))
142                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
143                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
144                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE))))
145                .addContainerGap())
146        );
147        jPanel1Layout.setVerticalGroup(
148            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
149            .addGroup(jPanel1Layout.createSequentialGroup()
150                .addContainerGap()
151                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
152                    .addComponent(info)
153                    .addComponent(title))
154                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
155                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
156                    .addComponent(jLabel1)
157                    .addComponent(db_version))
158                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
159                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
160                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
161                        .addComponent(jLabel2)
162                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
163                        .addComponent(website)
164                        .addGap(2, 2, 2))
165                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE))
166                .addContainerGap())
167        );
168
169        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
170
171        pack();
172    }// </editor-fold>//GEN-END:initComponents
173
174
175  
176
177    // Variables declaration - do not modify//GEN-BEGIN:variables
178    private javax.swing.JLabel db_version;
179    private javax.swing.JLabel info;
180    private javax.swing.JLabel jLabel1;
181    private javax.swing.JLabel jLabel2;
182    private javax.swing.JList jList1;
183    private javax.swing.JPanel jPanel1;
184    private javax.swing.JScrollPane jScrollPane1;
185    private javax.swing.JLabel title;
186    private javax.swing.JLabel website;
187    // End of variables declaration//GEN-END:variables
188
189
190    /**
191     * @return the image
192     */
193    public Image getImage() {
194        return image;
195    }
196
197    /**
198     * @param image the image to set
199     */
200    public void setImage(Image image) {
201        this.image = image;
202    }
203
204    /**
205     * @return the grayImage
206     */
207    public Image getGrayImage() {
208        return grayImage;
209    }
210
211    /**
212     * @param grayImage the grayImage to set
213     */
214    public void setGrayImage(Image grayImage) {
215        this.grayImage = grayImage;
216    }
217
218    /**
219     * @return the info
220     */
221    public String getInfo() {
222        return info.getText();
223    }
224
225    /**
226     * @param info the info to set
227     */
228    public final void setInfo(String info) {
229        this.info.setText(info);
230    }
231    
232    /**
233     * @param info the info to set
234     */
235    public final void setDBVersion() {
236        QueryCriteria criteria = new QueryCriteria("CNAME", "yabs_dbversion");
237        Object[][] data = null;
238        try {
239            data = QueryHandler.instanceOf().clone(Context.IDENTITY_GLOBALSETTINGS).select("VALUE", criteria);
240        } catch (NodataFoundException ex) {
241            Log.Debug(this, ex.getMessage());
242        }
243        this.db_version.setText("(DB:" + data[0][0].toString()+ ")");
244    }
245}