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;
025:
026: import java.awt.BorderLayout;
027: import java.awt.Container;
028: import java.awt.event.ActionListener;
029:
030: import javax.swing.JApplet;
031: import javax.swing.JButton;
032: import javax.swing.JDialog;
033: import javax.swing.JPanel;
034:
035: import org.objectweb.salome_tmf.data.DataConstants;
036: import org.objectweb.salome_tmf.data.Execution;
037: import org.objectweb.salome_tmf.data.ExecutionResult;
038: import org.objectweb.salome_tmf.data.Test;
039: import org.objectweb.salome_tmf.data.WithAttachment;
040: import org.objectweb.salome_tmf.ihm.languages.Language;
041:
042: public class AttachmentViewWindow extends JDialog implements
043: DataConstants, ActionListener {
044:
045: AttachmentView attachView;
046:
047: int sourceType;
048:
049: WithAttachment concernedExecutionOrResult;
050:
051: JButton validationButton;
052: JButton cancelButton;
053: public boolean cancelPerformed;
054:
055: public AttachmentViewWindow(JApplet app, int type,
056: WithAttachment executionOrResult, Execution exec,
057: ExecutionResult execResult, Test observedTest) {
058:
059: super (SalomeTMF.ptrFrame, true);
060:
061: cancelPerformed = false;
062: attachView = new AttachmentView(app, type, type,
063: executionOrResult, SMALL_SIZE_FOR_ATTACH, exec,
064: execResult, observedTest);
065:
066: validationButton = new JButton(Language.getInstance().getText(
067: "Valider"));
068: validationButton.addActionListener(this );
069:
070: cancelButton = new JButton(Language.getInstance().getText(
071: "Annuler"));
072: cancelButton.addActionListener(this );
073:
074: JPanel buttonsPanel = new JPanel();
075: buttonsPanel.add(validationButton);
076: buttonsPanel.add(cancelButton);
077:
078: initData(type, executionOrResult);
079:
080: Container contentPaneFrame = this .getContentPane();
081: contentPaneFrame.add(attachView, BorderLayout.CENTER);
082: contentPaneFrame.add(buttonsPanel, BorderLayout.SOUTH);
083:
084: this .setLocation(400, 400);
085: this .setTitle(Language.getInstance().getText("Attachements"));
086: this .pack();
087: this .setVisible(true);
088:
089: } // Fin du constructeur AttachmentViewWindow/3
090:
091: private void initData(int type, WithAttachment executionOrResult) {
092: sourceType = type;
093: concernedExecutionOrResult = executionOrResult;
094: }
095:
096: public void actionPerformed(java.awt.event.ActionEvent e) {
097: Object source = e.getSource();
098: if (source.equals(cancelButton)) {
099: cancelPerformed(e);
100: } else if (source.equals(validationButton)) {
101: validationPerformed(e);
102: }
103: }
104:
105: void validationPerformed(java.awt.event.ActionEvent e) {
106: cancelPerformed = false;
107: concernedExecutionOrResult.setAttachmentMap(attachView
108: .getAttachmentMap());
109: AttachmentViewWindow.this .dispose();
110: }
111:
112: void cancelPerformed(java.awt.event.ActionEvent e) {
113: cancelPerformed = true;
114: AttachmentViewWindow.this .dispose();
115: }
116:
117: } // Fin de la classe AttachmentViewWindow
|