01: package salomeTMF_plug.mantis;
02:
03: import java.awt.BorderLayout;
04: import java.awt.Container;
05: import java.awt.Dimension;
06: import java.awt.GraphicsConfiguration;
07: import java.awt.GraphicsDevice;
08: import java.awt.GraphicsEnvironment;
09: import java.awt.Rectangle;
10:
11: import javax.swing.JDialog;
12:
13: import org.objectweb.salome_tmf.data.Test;
14: import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
15:
16: import salomeTMF_plug.mantis.languages.Language;
17: import salomeTMF_plug.mantis.sqlWrapper.DefectWrapper;
18:
19: public class ViewLinkDialog extends JDialog {
20:
21: MantisPlugin pMantisPlugin;
22: ViewLinkPanel pViewLinkPanel;
23:
24: ViewLinkDialog(DefectWrapper pDefectWrapper,
25: MantisPlugin pMantisPlugin) {
26: super (SalomeTMFContext.getInstance().getSalomeFrame(), true);
27: setModal(true);
28: this .pMantisPlugin = pMantisPlugin;
29: pViewLinkPanel = new ViewLinkPanel(this , pDefectWrapper,
30: pMantisPlugin);
31: makeDialog(Language.getInstance().getText("Liason"));
32: }
33:
34: ViewLinkDialog(DefectWrapper pDefectWrapper,
35: MantisPlugin pMantisPlugin, Test pTest) {
36: super (SalomeTMFContext.getInstance().getSalomeFrame(), true);
37: setModal(true);
38: this .pMantisPlugin = pMantisPlugin;
39: pViewLinkPanel = new ViewLinkPanel(this , pDefectWrapper,
40: pMantisPlugin, pTest);
41: makeDialog(Language.getInstance().getText("Liason"));
42: }
43:
44: void makeDialog(String title) {
45: int t_x = 1024 - 100;
46: int t_y = 768 - 50;
47: int t_x2 = 1024;
48: int t_y2 = 768;
49: try {
50: GraphicsEnvironment ge = GraphicsEnvironment
51: .getLocalGraphicsEnvironment();
52: GraphicsDevice[] gs = ge.getScreenDevices();
53: GraphicsDevice gd = gs[0];
54: GraphicsConfiguration[] gc = gd.getConfigurations();
55: Rectangle r = gc[0].getBounds();
56: t_x = r.width - 100;
57: t_y = r.height - 50;
58: t_x2 = r.width;
59: t_y2 = r.height;
60: } catch (Exception E) {
61:
62: }
63:
64: int seq_x = t_x / 6;
65: int seq_y = t_y / 6;
66:
67: Container contentPane = this .getContentPane();
68: contentPane.setLayout(new BorderLayout());
69: contentPane.add(pViewLinkPanel, BorderLayout.CENTER);
70: pViewLinkPanel.setPreferredSize(new Dimension(seq_x * 4,
71: seq_x * 2));
72: this .setTitle(title);
73: setSize(seq_x * 4 * 4, seq_y * 3);
74: /*this.pack();
75: this.setLocationRelativeTo(this.getParent());
76: this.setVisible(true);*/
77: centerScreen();
78: }
79:
80: void centerScreen() {
81: Dimension dim = getToolkit().getScreenSize();
82: this .pack();
83: Rectangle abounds = getBounds();
84: setLocation((dim.width - abounds.width) / 2,
85: (dim.height - abounds.height) / 2);
86: this .setVisible(true);
87: requestFocus();
88: }
89: }
|