Back to index

wims  3.65+svn20090927
Public Member Functions | Package Attributes
fr.ove.errordialog.MainPanelError Class Reference

A panel to insert in the fr.ove.errordialog.ErrorDialod dialog box to display an error. More...

Inheritance diagram for fr.ove.errordialog.MainPanelError:
Inheritance graph
[legend]
Collaboration diagram for fr.ove.errordialog.MainPanelError:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MainPanelError (Window theWindow, String errorMessage)
 The constructor.
void setMesg1 (String mesg)
 Sets the first of the three messages that can be displayed.
void setMesg2 (String mesg)
 Sets the second of the three messages that can be displayed.
void setMesg3 (String mesg)
 Sets the third of the three messages that can be displayed.
void setDetails (String theDetails)
 Sets the details of the error.

Package Attributes

Panel panelError
Panel panelErrorName
PanelImage smileyL
PanelImage smileyR
Label labelErrorName
Panel panelErrorMesgs
Label labelMesg1
Label labelMesg2
Label labelMesg3
Panel panelButton
Button buttonCloseWindow
Button buttonDetails
TextArea details
Window window

Detailed Description

A panel to insert in the fr.ove.errordialog.ErrorDialod dialog box to display an error.

The instance can display specific error message and give more details about the error.

Author:
© 1998 DIRAT Laurent
Version:
1.0 13/04/99

Definition at line 45 of file MainPanelError.java.


Constructor & Destructor Documentation

fr.ove.errordialog.MainPanelError.MainPanelError ( Window  theWindow,
String  errorMessage 
) [inline]

The constructor.

Definition at line 68 of file MainPanelError.java.

                                                                      {
           window = theWindow;
           
           Font commonFont = new Font("Dialog", Font.PLAIN, 14);
           
           // Le panel qui contient tout ce qui est information de l'erreur (le nom, les messages, ...)
              setLayout(new BorderLayout(0,0));
              panelError = new Panel();
              panelError.setLayout(new BorderLayout(0,0));
              add("North", panelError);
              
              // Le panel qui contient le nom de l'erreur (avec le smiley)
              panelErrorName = new Panel();
              panelErrorName.setLayout(new BorderLayout(0,0));
              panelErrorName.setBackground(Color.white);
              panelError.add("North", panelErrorName);
              
              try {
                  // Comme PanelImage est dans un autre package que le courant il faut que l'on donne
                  // le chemin de l'image à charger relativement au package de PanelImage.
                  // Donc :
                  //      PanelImage est dans le package fr.ove.utils
                  //      L'instance dans le package fr.ove.errordialog, répertoire ou se trouve smiley.gif
                  //      D'où le chemin ../errordialog/smiley.gif
              //smileyL = new PanelImage("../errordialog/smiley.gif");
              
              // Bon on verra cette histoire si on refait passer PanelImage dans fr.ove.utils et l'image
              // ailleurs
              
              smileyL = new PanelImage("smiley.gif");
              panelErrorName.add("West", smileyL);
       }
       catch(Exception e) {
           e.printStackTrace();
       }
              
              labelErrorName = new Label(errorMessage, Label.CENTER);
              labelErrorName.setFont(new Font("Dialog", Font.PLAIN, 20));
              panelErrorName.add("Center", labelErrorName);
              
              try {
              //smileyR = new PanelImage("../errordialog/smiley.gif");
              smileyR = new PanelImage("smiley.gif");
              panelErrorName.add("East", smileyR);
       }
       catch(Exception e) {
           e.printStackTrace();
       }

              // Le panel qui contient tous les messages et boutons de commande
              panelErrorMesgs = new Panel();
              panelErrorMesgs.setLayout(new GridLayout(4,1,0,0));
              panelError.add("Center", panelErrorMesgs);
              
              // Un message d'erreur
              labelMesg1 = new Label("",Label.CENTER);
              labelMesg1.setFont(commonFont);
              panelErrorMesgs.add(labelMesg1);
              
              // Un autre message d'erreur
              labelMesg2 = new Label("",Label.CENTER);
              labelMesg2.setFont(commonFont);
              panelErrorMesgs.add(labelMesg2);
              
              // Et le dernier
              labelMesg3 = new Label("",Label.CENTER);
              labelMesg3.setFont(commonFont);
              panelErrorMesgs.add(labelMesg3);
              
              // Le panel qui contient les boutons de commande
              panelButton = new Panel();
              panelButton.setLayout(new FlowLayout(FlowLayout.CENTER,80,5));
              panelErrorMesgs.add(panelButton);

              // On ferme la la fenêtre qui contient notre instance
              buttonCloseWindow = new Button();
              buttonCloseWindow.setLabel("Close Window");
              buttonCloseWindow.setFont(commonFont);
              panelButton.add(buttonCloseWindow);
              
              // On montre ou cache les détails
              buttonDetails = new Button();
              buttonDetails.setLabel("Show Details >>");
              buttonDetails.setFont(commonFont);
              panelButton.add(buttonDetails);
              
              // Les éventuels détails de l'erreur
              details = new TextArea();
              //add("Center", details);
        
        // La gestion des actions
        
        // On affiche ou on cache les détails de l'erreur
        buttonDetails.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    Button button = (Button) event.getSource();
                    String label = button.getLabel();
                    Dimension size = window.getSize();
                    
                    if (label.equals("Show Details >>")) {
                        button.setLabel("Hide Details <<");
                        MainPanelError.this.add("Center", details);
                        size.height += 250;
                    }
                    else {
                        button.setLabel("Show Details >>");
                        MainPanelError.this.remove(details);
                        size.height -= 250;
                    }
                    
                    window.setSize(size);
                    window.validate();
                }
            }
        );
        
        // On ferme le fenêtre d'erreur
        buttonCloseWindow.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    window.setVisible(false);
                }
            }
        );
    }

Member Function Documentation

void fr.ove.errordialog.MainPanelError.setDetails ( String  theDetails) [inline]

Sets the details of the error.

Parameters:
theDetailsthe details of the error

Definition at line 223 of file MainPanelError.java.

                                              {
        details.setText(theDetails);
    }
void fr.ove.errordialog.MainPanelError.setMesg1 ( String  mesg) [inline]

Sets the first of the three messages that can be displayed.

Parameters:
mesgthe error message

Definition at line 199 of file MainPanelError.java.

                                      {
        labelMesg1.setText(mesg);
    }
void fr.ove.errordialog.MainPanelError.setMesg2 ( String  mesg) [inline]

Sets the second of the three messages that can be displayed.

Parameters:
mesgthe error message

Definition at line 207 of file MainPanelError.java.

                                      {
        labelMesg2.setText(mesg);
    }
void fr.ove.errordialog.MainPanelError.setMesg3 ( String  mesg) [inline]

Sets the third of the three messages that can be displayed.

Parameters:
mesgthe error message

Definition at line 215 of file MainPanelError.java.

                                      {
        labelMesg3.setText(mesg);
    }

Member Data Documentation

Definition at line 58 of file MainPanelError.java.

Definition at line 59 of file MainPanelError.java.

Definition at line 61 of file MainPanelError.java.

Definition at line 50 of file MainPanelError.java.

Definition at line 53 of file MainPanelError.java.

Definition at line 54 of file MainPanelError.java.

Definition at line 55 of file MainPanelError.java.

Definition at line 57 of file MainPanelError.java.

Definition at line 46 of file MainPanelError.java.

Definition at line 52 of file MainPanelError.java.

Definition at line 48 of file MainPanelError.java.

Definition at line 49 of file MainPanelError.java.

Definition at line 49 of file MainPanelError.java.

Definition at line 63 of file MainPanelError.java.


The documentation for this class was generated from the following file: