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 org.objectweb.salome_tmf.ihm.languages.Language;
027:
028: public class changeListenerPanel extends javax.swing.JPanel {
029: int i = 0;
030: int u = 0;
031: int d = 0;
032: String _toolKit = Language.getInstance().getText(
033: "Etat_de_la_synchronisation");
034:
035: /** Creates new form changeListenerPanel */
036: public changeListenerPanel(String toolKit) {
037: this ._toolKit = toolKit;
038: initComponents();
039: }
040:
041: public changeListenerPanel() {
042: initComponents();
043: }
044:
045: public String getToolTipText() {
046: return _toolKit;
047: }
048:
049: public void reset() {
050: i = 0;
051: u = 0;
052: d = 0;
053: insertWarning.setBackground(new java.awt.Color(0, 255, 0));
054: updateWarning.setBackground(new java.awt.Color(0, 255, 0));
055: deleteWarning.setBackground(new java.awt.Color(0, 255, 0));
056: //insertWarning.repaint();
057: //updateWarning.repaint();
058: //deleteWarning.repaint();
059: }
060:
061: public void addUInsert() {
062: i++;
063: org.objectweb.salome_tmf.api.Util
064: .log("[changeListenerPanel] _valeur_de_insert_:_" + i);
065: if (i >= 5 && i < 10) {
066: insertWarning
067: .setBackground(new java.awt.Color(255, 255, 0));
068: //insertWarning.repaint();
069: } else if (i >= 10 && i < 15) {
070: insertWarning.setBackground(new java.awt.Color(255, 0, 0));
071: //insertWarning.repaint();
072: }
073: if (i >= 15 && i < 20) {
074: insertWarning.setBackground(new java.awt.Color(153, 0, 0));
075: //insertWarning.repaint();
076: }
077: if (i >= 20) {
078: insertWarning.setBackground(new java.awt.Color(51, 51, 51));
079: //insertWarning.repaint();
080: }
081: }
082:
083: public void addUpdate() {
084: u++;
085: org.objectweb.salome_tmf.api.Util
086: .log("[changeListenerPanel] valeur_de_update_:_" + u);
087: if (u >= 5 && u < 10) {
088: updateWarning
089: .setBackground(new java.awt.Color(255, 255, 0));
090: //updateWarning.repaint();
091: } else if (u >= 10 && u < 15) {
092: updateWarning.setBackground(new java.awt.Color(255, 0, 0));
093: //updateWarning.repaint();
094: }
095: if (u >= 15 && u < 20) {
096: updateWarning.setBackground(new java.awt.Color(153, 0, 0));
097: //updateWarning.repaint();
098: }
099: if (u >= 20) {
100: updateWarning.setBackground(new java.awt.Color(51, 51, 51));
101: //updateWarning.repaint();
102: }
103: }
104:
105: public void addDelete() {
106: d++;
107: org.objectweb.salome_tmf.api.Util
108: .log("[changeListenerPanel] valeur_de_update_:_" + d);
109: if (d >= 5 && d < 10) {
110: deleteWarning
111: .setBackground(new java.awt.Color(255, 255, 0));
112: //deleteWarning.repaint();
113: } else if (d >= 10 && d < 15) {
114: deleteWarning.setBackground(new java.awt.Color(255, 0, 0));
115: //deleteWarning.repaint();
116: }
117: if (d >= 15 && d < 20) {
118: deleteWarning.setBackground(new java.awt.Color(153, 0, 0));
119: //deleteWarning.repaint();
120: }
121: if (d >= 20) {
122: deleteWarning.setBackground(new java.awt.Color(51, 51, 51));
123: //deleteWarning.repaint();
124: }
125: }
126:
127: /** This method is called from within the constructor to
128: * initialize the form.
129: * WARNING: Do NOT modify this code. The content of this method is
130: * always regenerated by the Form Editor.
131: */
132: private void initComponents() {//GEN-BEGIN:initComponents
133: insertWarning = new java.awt.TextField();
134: updateWarning = new java.awt.TextField();
135: deleteWarning = new java.awt.TextField();
136:
137: setLayout(new java.awt.GridLayout(1, 0, 5, 0));
138:
139: setBorder(new javax.swing.border.SoftBevelBorder(
140: javax.swing.border.BevelBorder.RAISED));
141: setToolTipText(getToolTipText());
142: setMaximumSize(new java.awt.Dimension(50, 10));
143: setMinimumSize(new java.awt.Dimension(40, 10));
144: setPreferredSize(new java.awt.Dimension(40, 10));
145: insertWarning.setText("I");
146: insertWarning.setBackground(new java.awt.Color(0, 255, 0));
147: insertWarning.setEditable(false);
148: insertWarning.setEnabled(false);
149: insertWarning.setFont(new java.awt.Font("Dialog", 1, 12));
150: add(insertWarning);
151:
152: updateWarning.setText("U");
153: updateWarning.setBackground(new java.awt.Color(0, 255, 0));
154: updateWarning.setEditable(false);
155: updateWarning.setEnabled(false);
156: updateWarning.setFont(new java.awt.Font("Dialog", 1, 12));
157: add(updateWarning);
158:
159: deleteWarning.setText("D");
160: deleteWarning.setBackground(new java.awt.Color(0, 255, 0));
161: deleteWarning.setEditable(false);
162: deleteWarning.setEnabled(false);
163: deleteWarning.setFont(new java.awt.Font("Dialog", 1, 12));
164: add(deleteWarning);
165:
166: }//GEN-END:initComponents
167:
168: // Variables declaration - do not modify//GEN-BEGIN:variables
169: private java.awt.TextField deleteWarning;
170: private java.awt.TextField insertWarning;
171: private java.awt.TextField updateWarning;
172: // End of variables declaration//GEN-END:variables
173:
174: }
|