- Hlavní stránka
- Balíky
- Třídy
- Soubory

# src/cz/neubauer/tomas/hazardanalysis/viewcontroller/dangeranalysis/StepPanel.java

Zobrazit dokumentaci tohoto souboru.

    00001
    00004 package cz.neubauer.tomas.hazardanalysis.viewcontroller.dangeranalysis;
    00005
    00006 import java.awt.Color;
    00007 import java.awt.Dimension;
    00008 import java.awt.Font;
    00009 import java.awt.GridBagConstraints;
    00010 import java.awt.GridBagLayout;
    00011 import java.awt.Insets;
    00012
    00013 import javax.swing.BorderFactory;
    00014 import javax.swing.JLabel;
    00015 import javax.swing.JPanel;
    00016 import javax.swing.JScrollPane;
    00017 import javax.swing.JTextArea;
    00018
    00022 public class StepPanel extends JPanel {
    00026         private static final long serialVersionUID = -9154626557899756747L;
    00027
    00028         private int stepIndex;
    00029
    00030         private String stepDesctiption, dangerDescription, counterAct;
    00031
    00032         private DangerCalculatorPanel dangerCalculatorPanel;
    00033
    00034         private JTextArea txaCounterActDescription;
    00035
    00040         public StepPanel(int stepIndex, String stepDesctiption,
    00041                         String dangerDescription, String counterAct) {
    00042                 this.stepIndex = stepIndex;
    00043                 this.stepDesctiption = stepDesctiption;
    00044                 this.counterAct = counterAct;
    00045                 this.dangerDescription = dangerDescription;
    00046
    00047                 initGUI();
    00048         }
    00049
    00054         public StepPanel(int stepIndex, String stepDesctiption,
    00055                         String dangerDescription) {
    00056                 this.stepIndex = stepIndex;
    00057                 this.stepDesctiption = stepDesctiption;
    00058                 counterAct = "";
    00059                 this.dangerDescription = dangerDescription;
    00060
    00061                 initGUI();
    00062         }
    00063
    00067         private void initGUI() {
    00068                 GridBagLayout gbl = new GridBagLayout();
    00069                 gbl.rowHeights = new int[] { 13, 50, 60 };
    00070                 gbl.columnWidths = new int[] { 80, 600 };
    00071                 setLayout(gbl);
    00072
    00073                 GridBagConstraints c = new GridBagConstraints();
    00074                 c.anchor = GridBagConstraints.NORTHWEST;
    00075                 c.fill = GridBagConstraints.BOTH;
    00076                 c.insets = new Insets(2, 6, 2, 6);
    00077
    00078                 c.gridx = 0;
    00079                 c.gridy = 0;
    00080                 c.gridwidth = 2;
    00081                 c.gridheight = 1;
    00082                 JLabel label = new JLabel("KROK " + stepIndex + ": " + stepDesctiption);
    00083                 label.setFont(new Font(label.getFont().getName(), Font.BOLD, 14));
    00084                 this.add(label, c);
    00085
    00086                 c.gridx = 0;
    00087                 c.gridy = 1;
    00088                 c.gridwidth = 1;
    00089                 this.add(new JLabel("Popis opatření"), c);
    00090
    00091                 c.gridx = 1;
    00092                 c.gridy = 1;
    00093                 c.gridwidth = 1;
    00094                 txaCounterActDescription = new JTextArea(counterAct);
    00095                 JScrollPane scroll = new JScrollPane(txaCounterActDescription);
    00096                 scroll.setViewportView(txaCounterActDescription);
    00097                 this.add(scroll, c);
    00098
    00099                 c.gridx = 0;
    00100                 c.gridy = 2;
    00101                 c.gridwidth = 2;
    00102                 dangerCalculatorPanel = new DangerCalculatorPanel(dangerDescription);
    00103                 this.add(dangerCalculatorPanel, c);
    00104
    00105                 setPreferredSize(new Dimension(700, 180));
    00106                 setBorder(BorderFactory.createLineBorder(Color.black, 1));
    00107         }
    00108
    00109         public String getStepDesctiption() {
    00110                 return stepDesctiption;
    00111         }
    00112
    00113         public void setStepDesctiption(String stepDesctiption) {
    00114                 this.stepDesctiption = stepDesctiption;
    00115
    00116         }
    00117
    00118         public String getDangerDescription() {
    00119                 return dangerDescription;
    00120         }
    00121
    00122         public void setDangerDescription(String dangerDescription) {
    00123                 this.dangerDescription = dangerDescription;
    00124         }
    00125
    00126         public void setCounterActDescription(String desc) {
    00127                 counterAct = desc;
    00128                 txaCounterActDescription.setText(counterAct);
    00129         }
    00130
    00131         public String getCounterActDescription() {
    00132                 counterAct = txaCounterActDescription.getText();
    00133                 return counterAct;
    00134         }
    00135
    00136         public void setS(int s) {
    00137                 dangerCalculatorPanel.setS(s);
    00138         }
    00139
    00140         public int getS() {
    00141                 return dangerCalculatorPanel.getS();
    00142         }
    00143
    00144         public void setA(int a) {
    00145                 dangerCalculatorPanel.setA(a);
    00146         }
    00147
    00148         public int getA() {
    00149                 return dangerCalculatorPanel.getA();
    00150         }
    00151
    00152         public void setE(int e) {
    00153                 dangerCalculatorPanel.setE(e);
    00154         }
    00155
    00156         public int getE() {
    00157                 return dangerCalculatorPanel.getE();
    00158         }
    00159
    00160         public void setW(int w) {
    00161                 dangerCalculatorPanel.setW(w);
    00162         }
    00163
    00164         public int getW() {
    00165                 return dangerCalculatorPanel.getW();
    00166         }
    00167
    00168         public String getCurrentS() {
    00169                 return dangerCalculatorPanel.getCurrentS();
    00170         }
    00171
    00172         public String getCurrentA() {
    00173                 return dangerCalculatorPanel.getCurrentA();
    00174         }
    00175
    00176         public String getCurrentW() {
    00177                 return dangerCalculatorPanel.getCurrentW();
    00178         }
    00179
    00180         public String getCurrentE() {
    00181                 return dangerCalculatorPanel.getCurrentE();
    00182         }
    00183
    00184         public String getCurrentDangerLevel() {
    00185                 return dangerCalculatorPanel.getCurrentDangerLevel();
    00186         }
    00187 }