org/objectweb/proactive/ext/scilab/gui/DialogLegend.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
00028  * 
00029  * ################################################################
00030  */ 
00031 package org.objectweb.proactive.ext.scilab.gui;
00032 import java.awt.Graphics;
00033 import java.awt.GridLayout;
00034 import java.awt.Toolkit;
00035 
00036 import javax.swing.BorderFactory;
00037 import javax.swing.JFrame;
00038 import javax.swing.JLabel;
00039 import javax.swing.JPanel;
00040 
00053 public class DialogLegend extends javax.swing.JDialog {
00054         private JPanel pnlTaskWait;
00055         private JPanel pnlTaskRun;
00056         private JPanel pnlTaskEnd;
00057         private JPanel pnlLegendRun;
00058         private JPanel pnlLegendWait;
00059         private JLabel lblLegendCancel;
00060         private JLabel lblLegendRun;
00061         private JPanel pnlIconAbort;
00062         private JPanel pnlIconSuccess;
00063         private JPanel pnlIconKill;
00064         private JPanel pnlIconRun;
00065         private JPanel pnlIconCancel;
00066         private JPanel pnlIconWait;
00067         private JLabel lblLegendAbort;
00068         private JLabel lblLegendSuccess;
00069         private JLabel lblLegendKill;
00070         private JLabel lblLegendWait;
00071         private JPanel pnlLegendEnd;
00072 
00073         public DialogLegend(JFrame frame) {
00074                 super(frame);
00075                 initGUI();
00076         }
00077         
00078         private void initGUI() {
00079                 try {
00080                         GridLayout thisLayout = new GridLayout(3, 1);
00081                         thisLayout.setColumns(1);
00082                         thisLayout.setHgap(5);
00083                         thisLayout.setVgap(5);
00084                         thisLayout.setRows(3);
00085                         getContentPane().setLayout(thisLayout);
00086                         {
00087                                 pnlTaskWait = new JPanel();
00088                                 getContentPane().add(pnlTaskWait);
00089                                 pnlTaskWait.setBorder(BorderFactory.createTitledBorder("Pending Tasks"));
00090                                 {
00091                                         pnlLegendWait = new JPanel();
00092                                         GridLayout pnlLegendWaitLayout = new GridLayout(2, 2);
00093                                         pnlLegendWaitLayout.setColumns(2);
00094                                         pnlLegendWaitLayout.setHgap(5);
00095                                         pnlLegendWaitLayout.setVgap(5);
00096                                         pnlLegendWaitLayout.setRows(2);
00097                                         pnlLegendWait.setLayout(pnlLegendWaitLayout);
00098                                         pnlTaskWait.add(pnlLegendWait);
00099                                         {
00100                                                 pnlIconWait = new JPanel() {
00101                                                         public void paintComponent(Graphics g) {
00102                                                                 super.paintComponent(g);
00103 
00104                                                                 g.drawImage(Toolkit.getDefaultToolkit()
00105                                                                         .getImage(
00106                                                                                 getClass().getResource(
00107                                                                                         "img/runTask.gif")), 0, 0, this);
00108                                                         }
00109                                                 };
00110                                                 pnlLegendWait.add(pnlIconWait);
00111                                                 pnlIconWait.setPreferredSize(new java.awt.Dimension(
00112                                                         100,
00113                                                         28));
00114                                                 pnlIconWait.setSize(100, 28);
00115                                         }
00116                                         {
00117                                                 lblLegendWait = new JLabel();
00118                                                 pnlLegendWait.add(lblLegendWait);
00119                                                 lblLegendWait.setText("Pending");
00120                                                 lblLegendWait.setPreferredSize(new java.awt.Dimension(
00121                                                         100,
00122                                                         28));
00123                                                 lblLegendWait.setSize(100, 28);
00124                                         }
00125                                         {
00126                                                 pnlIconCancel = new JPanel() {
00127                                                         public void paintComponent(Graphics g) {
00128                                                                 super.paintComponent(g);
00129 
00130                                                                 g.drawImage(Toolkit.getDefaultToolkit()
00131                                                                         .getImage(
00132                                                                                 getClass().getResource(
00133                                                                                         "img/stopTask.gif")), 0, 0, this);
00134                                                         }
00135                                                 };
00136                                                 pnlLegendWait.add(pnlIconCancel);
00137                                                 pnlIconCancel.setPreferredSize(new java.awt.Dimension(100, 28));
00138                                                 pnlIconCancel.setSize(100, 28);
00139                                         }
00140                                         {
00141                                                 lblLegendCancel = new JLabel();
00142                                                 pnlLegendWait.add(lblLegendCancel);
00143                                                 lblLegendCancel.setText("Cancelled");
00144                                                 lblLegendCancel.setBounds(-49, 96, 60, 30);
00145                                                 lblLegendCancel.setPreferredSize(new java.awt.Dimension(100, 28));
00146                                                 lblLegendCancel.setSize(100, 28);
00147                                         }
00148                                 }
00149                         }
00150                         {
00151                                 pnlTaskRun = new JPanel();
00152                                 getContentPane().add(pnlTaskRun);
00153                                 pnlTaskRun.setBorder(BorderFactory.createTitledBorder("Executing Tasks"));
00154                                 pnlTaskRun.setPreferredSize(new java.awt.Dimension(100, 28));
00155                                 pnlTaskRun.setSize(100, 28);
00156                                 {
00157                                         pnlLegendRun = new JPanel();
00158                                         GridLayout pnlLegendRunLayout = new GridLayout(2, 2);
00159                                         pnlLegendRunLayout.setColumns(2);
00160                                         pnlLegendRunLayout.setHgap(5);
00161                                         pnlLegendRunLayout.setVgap(5);
00162                                         pnlLegendRunLayout.setRows(2);
00163                                         pnlLegendRun.setLayout(pnlLegendRunLayout);
00164                                         pnlTaskRun.add(pnlLegendRun);
00165                                         {
00166                                                 pnlIconRun = new JPanel() {
00167                                                         public void paintComponent(Graphics g) {
00168                                                                 super.paintComponent(g);
00169 
00170                                                                 g.drawImage(Toolkit.getDefaultToolkit()
00171                                                                         .getImage(
00172                                                                                 getClass().getResource(
00173                                                                                         "img/runTask.gif")), 0, 0, this);
00174                                                         }
00175                                                 };
00176                                                 pnlLegendRun.add(pnlIconRun);
00177                                                 pnlIconRun.setPreferredSize(new java.awt.Dimension(
00178                                                         100,
00179                                                         28));
00180                                                 pnlIconRun.setSize(100, 28);
00181                                         }
00182                                         {
00183                                                 lblLegendRun = new JLabel();
00184                                                 pnlLegendRun.add(lblLegendRun);
00185                                                 lblLegendRun.setText("Executing");
00186                                                 lblLegendRun.setPreferredSize(new java.awt.Dimension(
00187                                                         100,
00188                                                         28));
00189                                                 lblLegendRun.setSize(100, 28);
00190                                         }
00191                                         {
00192                                                 pnlIconKill = new JPanel() {
00193                                                         public void paintComponent(Graphics g) {
00194                                                                 super.paintComponent(g);
00195 
00196                                                                 g.drawImage(Toolkit.getDefaultToolkit()
00197                                                                         .getImage(
00198                                                                                 getClass().getResource(
00199                                                                                         "img/stopTask.gif")), 0, 0, this);
00200                                                         }
00201                                                 };
00202                                                 pnlLegendRun.add(pnlIconKill);
00203                                                 pnlIconKill.setPreferredSize(new java.awt.Dimension(100, 28));
00204                                                 pnlIconKill.setSize(100, 28);
00205                                         }
00206                                         {
00207                                                 lblLegendKill = new JLabel();
00208                                                 pnlLegendRun.add(lblLegendKill);
00209                                                 lblLegendKill.setText("Killed");
00210                                                 lblLegendKill.setBounds(-34, 67, 60, 30);
00211                                                 lblLegendKill.setPreferredSize(new java.awt.Dimension(100, 28));
00212                                                 lblLegendKill.setSize(100, 28);
00213                                         }
00214                                 }
00215                         }
00216                         {
00217                                 pnlTaskEnd = new JPanel();
00218                                 getContentPane().add(pnlTaskEnd);
00219                                 pnlTaskEnd.setBorder(BorderFactory.createTitledBorder("Terminated Tasks"));
00220                                 {
00221                                         pnlLegendEnd = new JPanel();
00222                                         GridLayout pnlLegendEndLayout = new GridLayout(2, 2);
00223                                         pnlLegendEndLayout.setColumns(2);
00224                                         pnlLegendEndLayout.setHgap(5);
00225                                         pnlLegendEndLayout.setVgap(5);
00226                                         pnlLegendEndLayout.setRows(2);
00227                                         pnlLegendEnd.setLayout(pnlLegendEndLayout);
00228                                         pnlTaskEnd.add(pnlLegendEnd);
00229                                         {
00230                                                 pnlIconSuccess = new JPanel() {
00231                                                         public void paintComponent(Graphics g) {
00232                                                                 super.paintComponent(g);
00233 
00234                                                                 g
00235                                                                         .drawImage(
00236                                                                                 Toolkit.getDefaultToolkit().getImage(
00237                                                                                         getClass().getResource(
00238                                                                                                 "img/successTask.gif")),
00239                                                                                 0,
00240                                                                                 0,
00241                                                                                 this);
00242                                                         }
00243                                                 };
00244                                                 pnlLegendEnd.add(pnlIconSuccess);
00245                                                 pnlIconSuccess.setPreferredSize(new java.awt.Dimension(
00246                                                         100,
00247                                                         28));
00248                                                 pnlIconSuccess.setSize(100, 28);
00249                                         }
00250                                         {
00251                                                 lblLegendSuccess = new JLabel();
00252                                                 pnlLegendEnd.add(lblLegendSuccess);
00253                                                 lblLegendSuccess.setText("Succeeded");
00254                                                 lblLegendSuccess
00255                                                         .setPreferredSize(new java.awt.Dimension(100, 28));
00256                                                 lblLegendSuccess.setSize(100, 28);
00257                                         }
00258                                         {
00259                                                 pnlIconAbort = new JPanel() {
00260                                                         public void paintComponent(Graphics g) {
00261                                                                 super.paintComponent(g);
00262 
00263                                                                 g.drawImage(Toolkit.getDefaultToolkit()
00264                                                                         .getImage(
00265                                                                                 getClass().getResource(
00266                                                                                         "img/abortTask.gif")), 0, 0, this);
00267                                                         }
00268                                                 };
00269                                                 pnlLegendEnd.add(pnlIconAbort);
00270                                                 pnlIconAbort.setPreferredSize(new java.awt.Dimension(100, 28));
00271                                                 pnlIconAbort.setSize(100, 28);
00272                                         }
00273                                         {
00274                                                 lblLegendAbort = new JLabel();
00275                                                 pnlLegendEnd.add(lblLegendAbort);
00276                                                 lblLegendAbort.setText("Aborted");
00277                                                 lblLegendAbort.setBounds(-83, 19, 78, 14);
00278                                                 lblLegendAbort.setPreferredSize(new java.awt.Dimension(100, 28));
00279                                                 lblLegendAbort.setSize(100, 28);
00280                                         }
00281                                 }
00282                         }
00283 
00284                         this.setTitle("ToolBox Legend");
00285                         this.setSize(300, 380);
00286                 } catch (Exception e) {
00287                         e.printStackTrace();
00288                 }
00289         }
00290 
00291 }

Generated on Mon Jan 22 15:16:10 2007 for ProActive by  doxygen 1.5.1