001: /*
002: * SalomeTMF is a Test Management Framework
003: * Copyright (C) 2005 France Telecom R&D
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: *
019: * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
020: *
021: * Contact: mikael.marche@rd.francetelecom.com
022: */
023:
024: package org.objectweb.salome_tmf.ihm.main;
025:
026: import java.awt.BorderLayout;
027: import java.awt.Container;
028: import java.awt.Dimension;
029: import java.awt.FlowLayout;
030: import java.awt.Rectangle;
031: import java.awt.event.ActionEvent;
032: import java.awt.event.ActionListener;
033: import java.util.Properties;
034:
035: import javax.swing.Box;
036: import javax.swing.BoxLayout;
037: import javax.swing.JButton;
038: import javax.swing.JCheckBox;
039: import javax.swing.JDialog;
040: import javax.swing.JLabel;
041: import javax.swing.JPanel;
042:
043: import org.objectweb.salome_tmf.api.ApiConstants;
044: import org.objectweb.salome_tmf.ihm.IHMConstants;
045: import org.objectweb.salome_tmf.ihm.languages.Language;
046: import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
047: import org.objectweb.salome_tmf.ihm.tools.Tools;
048:
049: /**
050: * @author teaml039
051: */
052: public class BadDirectoryView extends JDialog implements IHMConstants {
053:
054: JCheckBox box;
055:
056: public BadDirectoryView() {
057: super (SalomeTMFContext.getInstance().ptrFrame, true);
058:
059: JLabel firstLine = new JLabel(
060: Language
061: .getInstance()
062: .getText(
063: "Une_copie_temporaire_du_fichier_a_été_copiée_dans_le_répertoire_:"));
064: firstLine.setIcon(Tools.createAppletImageIcon(
065: PATH_TO_CAUTION_ICON, ""));
066: Properties sys = System.getProperties();
067: JLabel dirName = new JLabel(sys.getProperty("java.io.tmpdir")
068: + sys.getProperty("file.separator")
069: + ApiConstants.PATH_TO_ADD_TO_TEMP);
070: JLabel lastLine = new JLabel(
071: Language
072: .getInstance()
073: .getText(
074: "Vérifiez_bien_que_l'application_qui_permet_de_visualiser_ce_fichier_pointe_sur_le_bon_répertoire."));
075:
076: box = new JCheckBox(Language.getInstance().getText(
077: "Ne_plus_afficher_cette_fenêtre"));
078: box.addActionListener(new ActionListener() {
079: public void actionPerformed(ActionEvent e) {
080: if (box.isSelected()) {
081: DataModel.setBadDirectoryView(false);
082: } else {
083: DataModel.setBadDirectoryView(true);
084: }
085: }
086: });
087:
088: JButton endButton = new JButton(Language.getInstance().getText(
089: "Terminer"));
090: endButton.addActionListener(new ActionListener() {
091: public void actionPerformed(ActionEvent e) {
092: BadDirectoryView.this .dispose();
093: }
094: });
095:
096: JPanel firstLinePanel = new JPanel(new FlowLayout(
097: FlowLayout.CENTER));
098: firstLinePanel.add(firstLine);
099:
100: JPanel dirPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
101: dirPanel.add(dirName);
102:
103: JPanel lastLinePanel = new JPanel(new FlowLayout(
104: FlowLayout.CENTER));
105: lastLinePanel.add(lastLine);
106:
107: JPanel boxPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
108: boxPanel.add(box);
109:
110: JPanel buttonPanel = new JPanel(new FlowLayout(
111: FlowLayout.CENTER));
112: buttonPanel.add(endButton);
113:
114: JPanel page = new JPanel();
115: page.setLayout(new BoxLayout(page, BoxLayout.Y_AXIS));
116: page.add(firstLinePanel);
117: page.add(dirPanel);
118: page.add(Box.createRigidArea(new Dimension(1, 20)));
119: page.add(lastLinePanel);
120: page.add(Box.createRigidArea(new Dimension(1, 20)));
121: page.add(buttonPanel);
122: page.add(Box.createRigidArea(new Dimension(1, 10)));
123: page.add(boxPanel);
124:
125: Container contentPaneFrame = this .getContentPane();
126: contentPaneFrame.add(page, BorderLayout.CENTER);
127:
128: this .setResizable(false);
129: this .setTitle(Language.getInstance().getText("Attention_!"));
130: /** this.pack();
131: this.setLocationRelativeTo(this.getParent());
132: this.setVisible(true);
133: */
134: centerScreen();
135: }
136:
137: void centerScreen() {
138: Dimension dim = getToolkit().getScreenSize();
139: this .pack();
140: Rectangle abounds = getBounds();
141: setLocation((dim.width - abounds.width) / 2,
142: (dim.height - abounds.height) / 2);
143: this .setVisible(true);
144: requestFocus();
145: }
146:
147: } // Fin de la classe BadDirectoryView
|