Merge lp:~tapaal-contributor/tapaal/annotationEditDialog into lp:tapaal/2.1

Proposed by Mathias Grund Sørensen
Status: Merged
Approved by: Kenneth Yrke Jørgensen
Approved revision: 712
Merged at revision: 712
Proposed branch: lp:~tapaal-contributor/tapaal/annotationEditDialog
Merge into: lp:tapaal/2.1
Diff against target: 164 lines (+57/-36)
2 files modified
src/pipe/gui/graphicElements/AnnotationNote.java (+10/-0)
src/pipe/gui/widgets/AnnotationPanel.java (+47/-36)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/annotationEditDialog
Reviewer Review Type Date Requested Status
Kenneth Yrke Jørgensen code Approve
Jiri Srba Approve
Review via email: mp+114154@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

This branch should be merged also into trunk.

Revision history for this message
Jiri Srba (srba) wrote :

Please, change also the layout of OK/CANCEL button to the standard way (like in editing global constant dialog for example). The buttons are larger and OK is all the way to the right.

review: Needs Fixing
Revision history for this message
Jiri Srba (srba) wrote :

> Please, change also the layout of OK/CANCEL button to the standard way (like
> in editing global constant dialog for example). The buttons are larger and OK
> is all the way to the right.

It is done in the correct way in the trunk, so the code can be (probably manually)
copied from there.

712. By Mathias Grund Sørensen

Merged with new gui from trunk

Revision history for this message
Mathias Grund Sørensen (mathias.grund) wrote :

> > Please, change also the layout of OK/CANCEL button to the standard way (like
> > in editing global constant dialog for example). The buttons are larger and
> OK
> > is all the way to the right.
>
> It is done in the correct way in the trunk, so the code can be (probably
> manually)
> copied from there.

It has now been merged with layout from trunk.

Revision history for this message
Jiri Srba (srba) :
review: Approve
Revision history for this message
Kenneth Yrke Jørgensen (yrke) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/pipe/gui/graphicElements/AnnotationNote.java'
2--- src/pipe/gui/graphicElements/AnnotationNote.java 2011-12-05 20:53:01 +0000
3+++ src/pipe/gui/graphicElements/AnnotationNote.java 2012-07-11 08:05:22 +0000
4@@ -32,6 +32,8 @@
5 private ResizePoint[] dragPoints = new ResizePoint[8];
6
7 private AffineTransform prova = new AffineTransform();
8+
9+ private boolean isNew = true;
10
11 public AnnotationNote(int x, int y) {
12 super(x, y);
13@@ -335,5 +337,13 @@
14
15 return annotation;
16 }
17+
18+ public boolean isNew(){
19+ if(isNew){
20+ isNew = false;
21+ return true;
22+ }
23+ return false;
24+ }
25
26 }
27
28=== modified file 'src/pipe/gui/widgets/AnnotationPanel.java'
29--- src/pipe/gui/widgets/AnnotationPanel.java 2011-09-23 21:23:31 +0000
30+++ src/pipe/gui/widgets/AnnotationPanel.java 2012-07-11 08:05:22 +0000
31@@ -1,8 +1,14 @@
32 package pipe.gui.widgets;
33
34 import java.awt.BorderLayout;
35+import java.awt.Color;
36 import java.awt.Dimension;
37+import java.awt.GridBagConstraints;
38+import java.awt.GridBagLayout;
39+import java.awt.Insets;
40+import java.awt.event.KeyEvent;
41
42+import javax.swing.JPanel;
43 import javax.swing.JSplitPane;
44
45 import pipe.gui.graphicElements.AnnotationNote;
46@@ -41,6 +47,10 @@
47 // <editor-fold defaultstate="collapsed"
48 // desc=" Generated Code ">//GEN-BEGIN:initComponents
49 private void initComponents() {
50+ JPanel container;
51+ container = new JPanel();
52+ container.setLayout(new GridBagLayout());
53+
54 java.awt.GridBagConstraints gridBagConstraints;
55
56 panel = new javax.swing.JPanel();
57@@ -66,11 +76,11 @@
58 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
59 gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
60 buttonPanel.setLayout(new java.awt.GridBagLayout());
61-
62 okButton.setText("OK");
63- okButton.setMaximumSize(new java.awt.Dimension(75, 25));
64- okButton.setMinimumSize(new java.awt.Dimension(75, 25));
65- okButton.setPreferredSize(new java.awt.Dimension(75, 25));
66+ okButton.setMaximumSize(new java.awt.Dimension(100, 25));
67+ okButton.setMinimumSize(new java.awt.Dimension(100, 25));
68+ okButton.setPreferredSize(new java.awt.Dimension(100, 25));
69+ okButton.setMnemonic(KeyEvent.VK_O);
70 okButton.addActionListener(new java.awt.event.ActionListener() {
71 public void actionPerformed(java.awt.event.ActionEvent evt) {
72 okButtonActionPerformed(evt);
73@@ -78,59 +88,60 @@
74 });
75
76 gridBagConstraints = new java.awt.GridBagConstraints();
77- gridBagConstraints.gridx = 6;
78+ gridBagConstraints.gridx = 1;
79 gridBagConstraints.gridy = 0;
80- gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
81- gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 6);
82+ gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
83+ gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
84 buttonPanel.add(okButton, gridBagConstraints);
85-
86+
87 cancelButton.setText("Cancel");
88- cancelButton.setMaximumSize(new java.awt.Dimension(75, 25));
89- cancelButton.setMinimumSize(new java.awt.Dimension(75, 25));
90- cancelButton.setPreferredSize(new java.awt.Dimension(75, 25));
91+ cancelButton.setMaximumSize(new java.awt.Dimension(100, 25));
92+ cancelButton.setMinimumSize(new java.awt.Dimension(100, 25));
93+ cancelButton.setPreferredSize(new java.awt.Dimension(100, 25));
94+ cancelButton.setMnemonic(KeyEvent.VK_C);
95 cancelButton.addActionListener(new java.awt.event.ActionListener() {
96 public void actionPerformed(java.awt.event.ActionEvent evt) {
97 cancelButtonActionPerformed(evt);
98 }
99 });
100-
101 gridBagConstraints = new java.awt.GridBagConstraints();
102+ gridBagConstraints.gridx = 0;
103+ gridBagConstraints.gridy = 0;
104+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
105 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
106 gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 6);
107 buttonPanel.add(cancelButton, gridBagConstraints);
108-
109- JSplitPaneFix split = new JSplitPaneFix(JSplitPane.VERTICAL_SPLIT,
110- panel, buttonPanel) {
111- /**
112- *
113- */
114- private static final long serialVersionUID = -3436043116983340340L;
115-
116- @Override
117- public int getMinimumDividerLocation() {
118- return lastDividerLocation;
119- }
120-
121- @Override
122- public int getMaximumDividerLocation() {
123- return lastDividerLocation;
124- }
125- };
126- split.setResizeWeight(1.0);
127- split.setDividerLocation(0.88);
128- split.setContinuousLayout(true);
129- split.setDividerSize(0);
130- add(split);
131- this.setPreferredSize(new Dimension(400, 300));
132+
133+ GridBagConstraints gbc = new GridBagConstraints();
134+ gbc.gridx = 0;
135+ gbc.gridy = 0;
136+ gbc.weightx = 3;
137+ gbc.weighty= 3;
138+ gbc.gridwidth = 2;
139+ gbc.fill = GridBagConstraints.BOTH;
140+ container.add(panel,gbc);
141+
142+ gbc = new GridBagConstraints();
143+ gbc.gridx = 1;
144+ gbc.gridy = 1;
145+ gbc.gridwidth = 1;
146+ gbc.anchor = GridBagConstraints.EAST;
147+ container.add(buttonPanel,gbc);
148+
149+ add(container); this.setPreferredSize(new Dimension(400, 300));
150 }// </editor-fold>//GEN-END:initComponents
151
152 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cancelButtonActionPerformed
153+ if(annotation.isNew()){
154+ annotation.delete();
155+ }
156 exit();
157 }// GEN-LAST:event_cancelButtonActionPerformed
158
159 private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_okButtonActionPerformed
160 annotation.setText(textArea.getText());
161 annotation.repaint();
162+ annotation.isNew();
163 exit();
164 }// GEN-LAST:event_okButtonActionPerformed
165

Subscribers

People subscribed via source and target branches