KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > config > CfgObjectSize


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  *
6  */

7
8 package org.enhydra.jawe.config;
9
10
11
12 import java.awt.*;
13
14 import javax.swing.*;
15
16 import org.enhydra.jawe.*;
17
18 public class CfgObjectSize extends BaseConfigPane{
19
20    private JTextField txtProcessWidth, txtProcessHeight, txtActivtyWidth,
21       txtActivityHeight, txtMinParticipantWidth, txtMinParticipatHeight,
22       txtParticipantNameWidth;
23
24    public CfgObjectSize(String JavaDoc name){
25       super(name);
26
27       txtProcessWidth = new JTextField();
28       addComponent("Config.Size.ProcessWidth.Label",txtProcessWidth );
29       txtProcessHeight = new JTextField();
30       addComponent("Config.Size.ProcessHeight.Label",txtProcessHeight );
31       txtActivtyWidth = new JTextField();
32       addComponent("Config.Size.ActivtyWidth.Label",txtActivtyWidth );
33       txtActivityHeight = new JTextField();
34       addComponent("Config.Size.ActivityHeight.Label",txtActivityHeight );
35       txtMinParticipantWidth = new JTextField();
36       addComponent("Config.Size.MinParticipantWidth.Label",txtMinParticipantWidth );
37       txtMinParticipatHeight = new JTextField();
38       addComponent("Config.Size.MinParticipatHeight.Label",txtMinParticipatHeight );
39       txtParticipantNameWidth = new JTextField();
40       addComponent("Config.Size.ParticipantNameWidth.Label",txtParticipantNameWidth );
41
42       readConf();
43    }
44
45    public void readConf(){
46       txtProcessWidth.setText(
47          Integer.toString(JaWEConfig.getInstance().getProcessWidth()));
48       txtProcessHeight.setText(
49          Integer.toString(JaWEConfig.getInstance().getProcessHeight()));
50       txtActivtyWidth.setText(
51          Integer.toString(JaWEConfig.getInstance().getActivityWidth()));
52       txtActivityHeight.setText(
53          Integer.toString(JaWEConfig.getInstance().getActivityHeight()));
54       txtMinParticipantWidth.setText(
55          Integer.toString(JaWEConfig.getInstance().getMinParticipantWidth()));
56       txtMinParticipatHeight.setText(
57          Integer.toString(JaWEConfig.getInstance().getMinParticipantHeight()));
58       txtParticipantNameWidth.setText(
59          Integer.toString(JaWEConfig.getInstance().getParticipantNameWidth()));
60    }
61
62    public void save(){
63       JaWEConfig.getInstance().setProcessWidth(
64          Integer.parseInt(txtProcessWidth.getText()));
65       JaWEConfig.getInstance().setProcessHeight(
66          Integer.parseInt(txtProcessHeight.getText()));
67       JaWEConfig.getInstance().setActivityWidth(
68          Integer.parseInt(txtActivtyWidth.getText()));
69       JaWEConfig.getInstance().setActivityHeight(
70          Integer.parseInt(txtActivityHeight.getText()));
71       JaWEConfig.getInstance().setMinParticipantWidth(
72          Integer.parseInt(txtMinParticipantWidth.getText()));
73       JaWEConfig.getInstance().setMinParticipantHeight(
74          Integer.parseInt(txtMinParticipatHeight.getText()));
75       JaWEConfig.getInstance().setParticipantNameWidth(
76          Integer.parseInt(txtParticipantNameWidth.getText()));
77    }
78
79    public Component getComponent(){
80       return this;
81   }
82 }
83
Popular Tags