Merge lp:~danilovesky/workcraft/trunk-bug-1351503 into lp:workcraft
- trunk-bug-1351503
- Merge into trunk
Proposed by
Danil Sokolov
Status: | Merged |
---|---|
Merged at revision: | 537 |
Proposed branch: | lp:~danilovesky/workcraft/trunk-bug-1351503 |
Merge into: | lp:workcraft |
Diff against target: |
364 lines (+51/-74) 5 files modified
CpogsPlugin/src/org/workcraft/plugins/cpog/CpogProgrammer.java (+19/-36) CpogsPlugin/src/org/workcraft/plugins/cpog/CpogSettings.java (+24/-1) CpogsPlugin/src/org/workcraft/plugins/cpog/EncoderSettings.java (+6/-6) CpogsPlugin/src/org/workcraft/plugins/cpog/gui/EncoderConfigurationDialog.java (+2/-8) WorkcraftCore/src/org/workcraft/gui/graph/tools/SelectionTool.java (+0/-23) |
To merge this branch: | bzr merge lp:~danilovesky/workcraft/trunk-bug-1351503 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danil Sokolov | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Danil Sokolov (danilovesky) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/CpogProgrammer.java' | |||
2 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/CpogProgrammer.java 2014-07-29 11:59:53 +0000 | |||
3 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/CpogProgrammer.java 2014-08-04 14:17:33 +0000 | |||
4 | @@ -32,19 +32,22 @@ | |||
5 | 32 | import org.workcraft.plugins.cpog.optimisation.expressions.Zero; | 32 | import org.workcraft.plugins.cpog.optimisation.expressions.Zero; |
6 | 33 | import org.workcraft.plugins.cpog.optimisation.javacc.BooleanParser; | 33 | import org.workcraft.plugins.cpog.optimisation.javacc.BooleanParser; |
7 | 34 | import org.workcraft.plugins.cpog.optimisation.javacc.ParseException; | 34 | import org.workcraft.plugins.cpog.optimisation.javacc.ParseException; |
8 | 35 | import org.workcraft.util.FileUtils; | ||
9 | 35 | import org.workcraft.util.Func; | 36 | import org.workcraft.util.Func; |
10 | 36 | import org.workcraft.util.Geometry; | 37 | import org.workcraft.util.Geometry; |
11 | 37 | import org.workcraft.util.Hierarchy; | 38 | import org.workcraft.util.Hierarchy; |
12 | 38 | import org.workcraft.workspace.WorkspaceEntry; | 39 | import org.workcraft.workspace.WorkspaceEntry; |
13 | 39 | 40 | ||
14 | 40 | public class CpogProgrammer { | 41 | public class CpogProgrammer { |
16 | 41 | 42 | // FIXME: Relative path to the directory with programmer results. Currently this is hard-coded in programmer. | |
17 | 43 | private static final String genEncodingDir = "../tools/results/generated_encoding/"; | ||
18 | 44 | |||
19 | 42 | private EncoderSettings settings; | 45 | private EncoderSettings settings; |
20 | 43 | private File scenarioFile, encodingFile ; | 46 | private File scenarioFile, encodingFile ; |
21 | 44 | private Double minArea; | 47 | private Double minArea; |
23 | 45 | 48 | ||
24 | 46 | // SETTING PARAMETERS FOR CALLING PROGRAMMER | 49 | // SETTING PARAMETERS FOR CALLING PROGRAMMER |
26 | 47 | private String programmerCommand = "programmer"; | 50 | private String programmerCommand; |
27 | 48 | private String espressoCommand; | 51 | private String espressoCommand; |
28 | 49 | private String abcFolder; | 52 | private String abcFolder; |
29 | 50 | private String gatesLibrary; | 53 | private String gatesLibrary; |
30 | @@ -262,10 +265,6 @@ | |||
31 | 262 | abcFolder = ""; | 265 | abcFolder = ""; |
32 | 263 | gateLibFlag = "-lib"; | 266 | gateLibFlag = "-lib"; |
33 | 264 | gatesLibrary = ""; | 267 | gatesLibrary = ""; |
34 | 265 | JOptionPane.showMessageDialog(null, | ||
35 | 266 | "You can download it at http://www.eecs.berkeley.edu/~alanmi/abc/ to improve the outcome of the encoding.", | ||
36 | 267 | "Abc tool disabled", | ||
37 | 268 | JOptionPane.INFORMATION_MESSAGE); | ||
38 | 269 | } | 268 | } |
39 | 270 | 269 | ||
40 | 271 | // FILL IN PARAMETERS FOR CALLING PROGRAMER PROPERLY | 270 | // FILL IN PARAMETERS FOR CALLING PROGRAMER PROPERLY |
41 | @@ -330,11 +329,10 @@ | |||
42 | 330 | System.out.println("Error"); | 329 | System.out.println("Error"); |
43 | 331 | } | 330 | } |
44 | 332 | 331 | ||
50 | 333 | deleteDir(new File("results/")); | 332 | FileUtils.deleteDirectoryTree(new File(genEncodingDir)); |
51 | 334 | File d = new File("results/generated_encoding/"); | 333 | new File(genEncodingDir).mkdirs(); |
52 | 335 | d.mkdirs(); | 334 | |
53 | 336 | 335 | // IF SCENCO MODE IS NOT SELECTED, PROGRAMMER IS CALLED ITERATIVELY | |
49 | 337 | // IF SCENCO MODE IS NOT SELECTED, PROGRAMMER IS CALLED ITERATIVELY | ||
54 | 338 | // BECAUSE, IF CONTINUOUS OPTION IS SELECTED, TOOL IS CALLED | 336 | // BECAUSE, IF CONTINUOUS OPTION IS SELECTED, TOOL IS CALLED |
55 | 339 | // TILL USER PRESSES STOP BUTTON | 337 | // TILL USER PRESSES STOP BUTTON |
56 | 340 | if(!SCENCO){ | 338 | if(!SCENCO){ |
57 | @@ -673,22 +671,6 @@ | |||
58 | 673 | } | 671 | } |
59 | 674 | } | 672 | } |
60 | 675 | 673 | ||
61 | 676 | // REMOVE DIRECTORY CONTAINS ALL THE CONTROLLER SYNTHESISED | ||
62 | 677 | // FOR EACH ENCODING SOLUTION | ||
63 | 678 | private static boolean deleteDir(File dir) { | ||
64 | 679 | if (dir.isDirectory()) { | ||
65 | 680 | String[] children = dir.list(); | ||
66 | 681 | for (int i = 0; i < children.length; i++) { | ||
67 | 682 | boolean success = deleteDir(new File(dir, children[i])); | ||
68 | 683 | if (!success) { | ||
69 | 684 | return false; | ||
70 | 685 | } | ||
71 | 686 | } | ||
72 | 687 | } | ||
73 | 688 | |||
74 | 689 | return dir.delete(); // The directory is empty now and can be deleted. | ||
75 | 690 | } | ||
76 | 691 | |||
77 | 692 | // BUILD CONSTRAINT FOR EACH ELEMENTS LOOPING ON THE SCENARIOS | 674 | // BUILD CONSTRAINT FOR EACH ELEMENTS LOOPING ON THE SCENARIOS |
78 | 693 | private String generateConstraint(char [][][] constraints, int numScenarios, int event1, int event2) | 675 | private String generateConstraint(char [][][] constraints, int numScenarios, int event1, int event2) |
79 | 694 | { | 676 | { |
80 | @@ -856,7 +838,7 @@ | |||
81 | 856 | // THE MICROCONTROLLER SYNTHESISED WITH ABC TOOL | 838 | // THE MICROCONTROLLER SYNTHESISED WITH ABC TOOL |
82 | 857 | private void printController(int m){ | 839 | private void printController(int m){ |
83 | 858 | System.out.println(); | 840 | System.out.println(); |
85 | 859 | String fileName = "results/generated_encoding/"; | 841 | String fileName = genEncodingDir; |
86 | 860 | for(int i=0; i<m; i++) fileName = fileName.concat(binaryToInt(opt_enc[i]) + "_"); | 842 | for(int i=0; i<m; i++) fileName = fileName.concat(binaryToInt(opt_enc[i]) + "_"); |
87 | 861 | fileName = fileName.concat(".prg"); | 843 | fileName = fileName.concat(".prg"); |
88 | 862 | File f = new File(fileName); | 844 | File f = new File(fileName); |
89 | @@ -896,14 +878,14 @@ | |||
90 | 896 | // TO WORKCRAFT TO BUILD THE COMPOSITIONAL GRAPH | 878 | // TO WORKCRAFT TO BUILD THE COMPOSITIONAL GRAPH |
91 | 897 | private int callingProgrammer(Double currArea, WorkspaceEntry we, int it, boolean continuous) throws IOException{ | 879 | private int callingProgrammer(Double currArea, WorkspaceEntry we, int it, boolean continuous) throws IOException{ |
92 | 898 | //Debug Printing: launching executable | 880 | //Debug Printing: launching executable |
98 | 899 | /*System.out.println(programmerCommand + " " + scenarioFile.getAbsolutePath() + " " + | 881 | // System.out.println(programmerCommand + " " + scenarioFile.getAbsolutePath() + " " + |
99 | 900 | "-m" + " " + effort + " " + genMode + " " + numSol + " " + customFlag + " " + customPath + " " + | 882 | // "-m" + " " + effort + " " + genMode + " " + numSol + " " + customFlag + " " + customPath + " " + |
100 | 901 | verbose + " " + cpogSize + " " + disableFunction + " " + oldSynt + " " + | 883 | // verbose + " " + cpogSize + " " + disableFunction + " " + oldSynt + " " + |
101 | 902 | espressoFlag + " " + espressoCommand + " " + abcFlag + " " + abcFolder + " " + gateLibFlag + " " + | 884 | // espressoFlag + " " + espressoCommand + " " + abcFlag + " " + abcFolder + " " + gateLibFlag + " " + |
102 | 903 | gatesLibrary);*/ | 885 | // gatesLibrary); |
103 | 904 | process = new ProcessBuilder(programmerCommand, scenarioFile.getAbsolutePath(), | 886 | process = new ProcessBuilder(programmerCommand, scenarioFile.getAbsolutePath(), |
106 | 905 | "-m",effort,genMode, numSol,customFlag,customPath,verbose,cpogSize,disableFunction,oldSynt, | 887 | "-m", effort, genMode, numSol, customFlag, customPath, verbose, cpogSize, disableFunction, oldSynt, |
107 | 906 | espressoFlag,espressoCommand, abcFlag, abcFolder, gateLibFlag, gatesLibrary).start(); | 888 | espressoFlag, espressoCommand, abcFlag, abcFolder, gateLibFlag, gatesLibrary).start(); |
108 | 907 | InputStream is = process.getInputStream(); | 889 | InputStream is = process.getInputStream(); |
109 | 908 | InputStreamReader isr = new InputStreamReader(is); | 890 | InputStreamReader isr = new InputStreamReader(is); |
110 | 909 | BufferedReader br = new BufferedReader(isr); | 891 | BufferedReader br = new BufferedReader(isr); |
111 | @@ -1069,6 +1051,7 @@ | |||
112 | 1069 | opt_formulaeArcs = new String[elements*elements]; | 1051 | opt_formulaeArcs = new String[elements*elements]; |
113 | 1070 | truthTableArcs = new String[elements*elements]; | 1052 | truthTableArcs = new String[elements*elements]; |
114 | 1071 | arcNames = new String[elements*elements]; | 1053 | arcNames = new String[elements*elements]; |
115 | 1054 | programmerCommand = CpogSettings.getProgrammerCommand(); | ||
116 | 1072 | espressoCommand = CpogSettings.getEspressoCommand(); | 1055 | espressoCommand = CpogSettings.getEspressoCommand(); |
117 | 1073 | abcFolder = CpogSettings.getAbcFolder(); | 1056 | abcFolder = CpogSettings.getAbcFolder(); |
118 | 1074 | gatesLibrary = CpogSettings.getGatesLibrary(); | 1057 | gatesLibrary = CpogSettings.getGatesLibrary(); |
119 | 1075 | 1058 | ||
120 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/CpogSettings.java' | |||
121 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/CpogSettings.java 2014-07-25 14:53:23 +0000 | |||
122 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/CpogSettings.java 2014-08-04 14:17:33 +0000 | |||
123 | @@ -38,6 +38,7 @@ | |||
124 | 38 | private static final String keyCircuitSize = prefix + ".circuitSize"; | 38 | private static final String keyCircuitSize = prefix + ".circuitSize"; |
125 | 39 | private static final String keyClaspCommand = prefix + ".claspCommand"; | 39 | private static final String keyClaspCommand = prefix + ".claspCommand"; |
126 | 40 | private static final String keyMinisatCommand = prefix + ".minisatCommand"; | 40 | private static final String keyMinisatCommand = prefix + ".minisatCommand"; |
127 | 41 | private static final String keyProgrammerCommand = prefix + ".programmerCommand"; | ||
128 | 41 | private static final String keyEspressoCommand = prefix + ".espressoCommand"; | 42 | private static final String keyEspressoCommand = prefix + ".espressoCommand"; |
129 | 42 | private static final String keyAbcFolder = prefix + ".abcFolder"; | 43 | private static final String keyAbcFolder = prefix + ".abcFolder"; |
130 | 43 | private static final String keyGatesLibrary = prefix + ".gatesLibrary"; | 44 | private static final String keyGatesLibrary = prefix + ".gatesLibrary"; |
131 | @@ -46,6 +47,7 @@ | |||
132 | 46 | private static final int defaultCircuitSize = 4; | 47 | private static final int defaultCircuitSize = 4; |
133 | 47 | private static final String defaultClaspCommand = "clasp"; | 48 | private static final String defaultClaspCommand = "clasp"; |
134 | 48 | private static final String defaultMinisatCommand = "minisat"; | 49 | private static final String defaultMinisatCommand = "minisat"; |
135 | 50 | private static final String defaultProgrammerCommand = "programmer"; | ||
136 | 49 | private static final String defaultEspressoCommand = "espresso"; | 51 | private static final String defaultEspressoCommand = "espresso"; |
137 | 50 | private static final String defaultAbcFolder = "abc/"; | 52 | private static final String defaultAbcFolder = "abc/"; |
138 | 51 | private static final String defaultGatesLibrary = "90nm.genlib"; | 53 | private static final String defaultGatesLibrary = "90nm.genlib"; |
139 | @@ -54,6 +56,7 @@ | |||
140 | 54 | private static int circuitSize = defaultCircuitSize; | 56 | private static int circuitSize = defaultCircuitSize; |
141 | 55 | private static String claspCommand = defaultClaspCommand; | 57 | private static String claspCommand = defaultClaspCommand; |
142 | 56 | private static String minisatCommand = defaultMinisatCommand; | 58 | private static String minisatCommand = defaultMinisatCommand; |
143 | 59 | private static String programmerCommand = defaultProgrammerCommand; | ||
144 | 57 | private static String espressoCommand = defaultEspressoCommand; | 60 | private static String espressoCommand = defaultEspressoCommand; |
145 | 58 | private static String abcFolder = defaultAbcFolder; | 61 | private static String abcFolder = defaultAbcFolder; |
146 | 59 | private static String gatesLibrary = defaultGatesLibrary; | 62 | private static String gatesLibrary = defaultGatesLibrary; |
147 | @@ -100,7 +103,17 @@ | |||
148 | 100 | }); | 103 | }); |
149 | 101 | 104 | ||
150 | 102 | properties.add(new PropertyDeclaration<CpogSettings, String>( | 105 | properties.add(new PropertyDeclaration<CpogSettings, String>( |
152 | 103 | this, "Espresso solver", String.class) { | 106 | this, "Programmer command", String.class) { |
153 | 107 | protected void setter(CpogSettings object, String value) { | ||
154 | 108 | CpogSettings.setProgrammerCommand(value); | ||
155 | 109 | } | ||
156 | 110 | protected String getter(CpogSettings object) { | ||
157 | 111 | return CpogSettings.getProgrammerCommand(); | ||
158 | 112 | } | ||
159 | 113 | }); | ||
160 | 114 | |||
161 | 115 | properties.add(new PropertyDeclaration<CpogSettings, String>( | ||
162 | 116 | this, "Espresso command", String.class) { | ||
163 | 104 | protected void setter(CpogSettings object, String value) { | 117 | protected void setter(CpogSettings object, String value) { |
164 | 105 | CpogSettings.setEspressoCommand(value); | 118 | CpogSettings.setEspressoCommand(value); |
165 | 106 | } | 119 | } |
166 | @@ -136,6 +149,7 @@ | |||
167 | 136 | setCircuitSize(config.getInt(keyCircuitSize, defaultCircuitSize)); | 149 | setCircuitSize(config.getInt(keyCircuitSize, defaultCircuitSize)); |
168 | 137 | setClaspCommand(config.getString(keyClaspCommand, defaultClaspCommand)); | 150 | setClaspCommand(config.getString(keyClaspCommand, defaultClaspCommand)); |
169 | 138 | setMinisatCommand(config.getString(keyMinisatCommand, defaultMinisatCommand)); | 151 | setMinisatCommand(config.getString(keyMinisatCommand, defaultMinisatCommand)); |
170 | 152 | setProgrammerCommand(config.getString(keyProgrammerCommand, defaultProgrammerCommand)); | ||
171 | 139 | setEspressoCommand(config.getString(keyEspressoCommand, defaultEspressoCommand)); | 153 | setEspressoCommand(config.getString(keyEspressoCommand, defaultEspressoCommand)); |
172 | 140 | setAbcFolder(config.getString(keyAbcFolder, defaultAbcFolder)); | 154 | setAbcFolder(config.getString(keyAbcFolder, defaultAbcFolder)); |
173 | 141 | setGatesLibrary(config.getString(keyGatesLibrary, defaultGatesLibrary)); | 155 | setGatesLibrary(config.getString(keyGatesLibrary, defaultGatesLibrary)); |
174 | @@ -147,6 +161,7 @@ | |||
175 | 147 | config.setInt(keyCircuitSize, getCircuitSize()); | 161 | config.setInt(keyCircuitSize, getCircuitSize()); |
176 | 148 | config.set(keyClaspCommand, getClaspCommand()); | 162 | config.set(keyClaspCommand, getClaspCommand()); |
177 | 149 | config.set(keyMinisatCommand, getMinisatCommand()); | 163 | config.set(keyMinisatCommand, getMinisatCommand()); |
178 | 164 | config.set(keyProgrammerCommand, getProgrammerCommand()); | ||
179 | 150 | config.set(keyEspressoCommand, getEspressoCommand()); | 165 | config.set(keyEspressoCommand, getEspressoCommand()); |
180 | 151 | config.set(keyAbcFolder, getAbcFolder()); | 166 | config.set(keyAbcFolder, getAbcFolder()); |
181 | 152 | config.set(keyGatesLibrary, getGatesLibrary()); | 167 | config.set(keyGatesLibrary, getGatesLibrary()); |
182 | @@ -199,6 +214,14 @@ | |||
183 | 199 | minisatCommand = value; | 214 | minisatCommand = value; |
184 | 200 | } | 215 | } |
185 | 201 | 216 | ||
186 | 217 | public static String getProgrammerCommand() { | ||
187 | 218 | return programmerCommand; | ||
188 | 219 | } | ||
189 | 220 | |||
190 | 221 | public static void setProgrammerCommand(String value) { | ||
191 | 222 | programmerCommand = value; | ||
192 | 223 | } | ||
193 | 224 | |||
194 | 202 | public static String getEspressoCommand() { | 225 | public static String getEspressoCommand() { |
195 | 203 | return espressoCommand; | 226 | return espressoCommand; |
196 | 204 | } | 227 | } |
197 | 205 | 228 | ||
198 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/EncoderSettings.java' | |||
199 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/EncoderSettings.java 2014-07-29 11:59:53 +0000 | |||
200 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/EncoderSettings.java 2014-08-04 14:17:33 +0000 | |||
201 | @@ -37,12 +37,6 @@ | |||
202 | 37 | return choice; | 37 | return choice; |
203 | 38 | } | 38 | } |
204 | 39 | } | 39 | } |
205 | 40 | |||
206 | 41 | public EncoderSettings(String espressoPath, String abcPath, String libPath) { | ||
207 | 42 | this.espressoPath = espressoPath; | ||
208 | 43 | this.abcPath = abcPath; | ||
209 | 44 | this.libPath = libPath; | ||
210 | 45 | } | ||
211 | 46 | 40 | ||
212 | 47 | private int solutionNumber = 10, numPO,bits; | 41 | private int solutionNumber = 10, numPO,bits; |
213 | 48 | private GenerationMode genMode = GenerationMode.OPTIMAL_ENCODING; | 42 | private GenerationMode genMode = GenerationMode.OPTIMAL_ENCODING; |
214 | @@ -50,6 +44,12 @@ | |||
215 | 50 | private String[] customEnc; | 44 | private String[] customEnc; |
216 | 51 | private String espressoPath,abcPath,libPath; | 45 | private String espressoPath,abcPath,libPath; |
217 | 52 | 46 | ||
218 | 47 | public EncoderSettings(String espressoPath, String abcPath, String libPath) { | ||
219 | 48 | this.espressoPath = espressoPath; | ||
220 | 49 | this.abcPath = abcPath; | ||
221 | 50 | this.libPath = libPath; | ||
222 | 51 | } | ||
223 | 52 | |||
224 | 53 | public boolean isCpogSize() { | 53 | public boolean isCpogSize() { |
225 | 54 | return cpogSize; | 54 | return cpogSize; |
226 | 55 | } | 55 | } |
227 | 56 | 56 | ||
228 | === modified file 'CpogsPlugin/src/org/workcraft/plugins/cpog/gui/EncoderConfigurationDialog.java' | |||
229 | --- CpogsPlugin/src/org/workcraft/plugins/cpog/gui/EncoderConfigurationDialog.java 2014-07-29 11:59:53 +0000 | |||
230 | +++ CpogsPlugin/src/org/workcraft/plugins/cpog/gui/EncoderConfigurationDialog.java 2014-08-04 14:17:33 +0000 | |||
231 | @@ -18,7 +18,6 @@ | |||
232 | 18 | import javax.swing.JComboBox; | 18 | import javax.swing.JComboBox; |
233 | 19 | import javax.swing.JComponent; | 19 | import javax.swing.JComponent; |
234 | 20 | import javax.swing.JDialog; | 20 | import javax.swing.JDialog; |
235 | 21 | import javax.swing.JFrame; | ||
236 | 22 | import javax.swing.JLabel; | 21 | import javax.swing.JLabel; |
237 | 23 | import javax.swing.JOptionPane; | 22 | import javax.swing.JOptionPane; |
238 | 24 | import javax.swing.JPanel; | 23 | import javax.swing.JPanel; |
239 | @@ -36,6 +35,7 @@ | |||
240 | 36 | import org.workcraft.plugins.shared.presets.PresetManager; | 35 | import org.workcraft.plugins.shared.presets.PresetManager; |
241 | 37 | import org.workcraft.workspace.WorkspaceEntry; | 36 | import org.workcraft.workspace.WorkspaceEntry; |
242 | 38 | 37 | ||
243 | 38 | @SuppressWarnings("serial") | ||
244 | 39 | public class EncoderConfigurationDialog extends JDialog { | 39 | public class EncoderConfigurationDialog extends JDialog { |
245 | 40 | 40 | ||
246 | 41 | private JLabel numberOfSolutionsLabel, contLabel, | 41 | private JLabel numberOfSolutionsLabel, contLabel, |
247 | @@ -45,7 +45,6 @@ | |||
248 | 45 | private JCheckBox verboseModeCheck, customEncodings, | 45 | private JCheckBox verboseModeCheck, customEncodings, |
249 | 46 | contCheck, abcCheck; | 46 | contCheck, abcCheck; |
250 | 47 | private JComboBox generationModeBox,OptimiseBox, guidedModeBox; | 47 | private JComboBox generationModeBox,OptimiseBox, guidedModeBox; |
251 | 48 | private JFrame frame; | ||
252 | 49 | private JPanel generationPanel, buttonsPanel, content; | 48 | private JPanel generationPanel, buttonsPanel, content; |
253 | 50 | private JButton saveButton, closeButton; | 49 | private JButton saveButton, closeButton; |
254 | 51 | private JTextField numberOfSolutionsText, bitsText; | 50 | private JTextField numberOfSolutionsText, bitsText; |
255 | @@ -56,13 +55,11 @@ | |||
256 | 56 | private int m,bits; | 55 | private int m,bits; |
257 | 57 | private JRadioButton slow,normal,fast; | 56 | private JRadioButton slow,normal,fast; |
258 | 58 | private ButtonGroup group; | 57 | private ButtonGroup group; |
259 | 59 | private JPanel speedPanel, encodingPanel; | ||
260 | 60 | 58 | ||
261 | 61 | // Core variables | 59 | // Core variables |
262 | 62 | private CpogProgrammer encoder; | 60 | private CpogProgrammer encoder; |
263 | 63 | private EncoderSettings settings; | 61 | private EncoderSettings settings; |
264 | 64 | private WorkspaceEntry we; | 62 | private WorkspaceEntry we; |
265 | 65 | private static boolean settingsPresent = false; | ||
266 | 66 | 63 | ||
267 | 67 | // sizes | 64 | // sizes |
268 | 68 | Dimension dimensionLabel = new Dimension(270, 22); | 65 | Dimension dimensionLabel = new Dimension(270, 22); |
269 | @@ -190,7 +187,6 @@ | |||
270 | 190 | } | 187 | } |
271 | 191 | 188 | ||
272 | 192 | // Set them on encoder | 189 | // Set them on encoder |
273 | 193 | settingsPresent = true; | ||
274 | 194 | encoder = new CpogProgrammer(settings); | 190 | encoder = new CpogProgrammer(settings); |
275 | 195 | 191 | ||
276 | 196 | // Execute programmer | 192 | // Execute programmer |
277 | @@ -214,13 +210,12 @@ | |||
278 | 214 | private void createGenerationPanel() { | 210 | private void createGenerationPanel() { |
279 | 215 | setMinimumSize(new Dimension(600, 400)); | 211 | setMinimumSize(new Dimension(600, 400)); |
280 | 216 | generationPanel = new JPanel(new SimpleFlowLayout()); | 212 | generationPanel = new JPanel(new SimpleFlowLayout()); |
281 | 217 | JPanel numberOfSolutionsPanel = new JPanel (new FlowLayout(FlowLayout.LEFT, 3, 0)); | ||
282 | 218 | VisualCPOG cpog = (VisualCPOG)(we.getModelEntry().getVisualModel()); | 213 | VisualCPOG cpog = (VisualCPOG)(we.getModelEntry().getVisualModel()); |
283 | 219 | ArrayList<VisualScenario> scenarios = new ArrayList<VisualScenario>(cpog.getGroups()); | 214 | ArrayList<VisualScenario> scenarios = new ArrayList<VisualScenario>(cpog.getGroups()); |
284 | 220 | m = scenarios.size(); | 215 | m = scenarios.size(); |
285 | 221 | 216 | ||
286 | 222 | // ABC TOOL DISABLE FLAG | 217 | // ABC TOOL DISABLE FLAG |
288 | 223 | abcCheck = new JCheckBox("",settings.isAbcFlag()); | 218 | abcCheck = new JCheckBox("", !settings.isAbcFlag()); |
289 | 224 | abcLabel = new JLabel("Disable Abc Tool"); | 219 | abcLabel = new JLabel("Disable Abc Tool"); |
290 | 225 | abcLabel.setPreferredSize(new Dimension(150, 15)); | 220 | abcLabel.setPreferredSize(new Dimension(150, 15)); |
291 | 226 | abcCheck.addActionListener(new ActionListener() { | 221 | abcCheck.addActionListener(new ActionListener() { |
292 | @@ -547,7 +542,6 @@ | |||
293 | 547 | encodingTable.setEnabled(false); | 542 | encodingTable.setEnabled(false); |
294 | 548 | encodingTable.setBackground(Color.LIGHT_GRAY); | 543 | encodingTable.setBackground(Color.LIGHT_GRAY); |
295 | 549 | 544 | ||
296 | 550 | |||
297 | 551 | // VERBOSE MODE INSTANTIATION | 545 | // VERBOSE MODE INSTANTIATION |
298 | 552 | verboseModeLabel = new JLabel("Verbose mode"); | 546 | verboseModeLabel = new JLabel("Verbose mode"); |
299 | 553 | verboseModeLabel.setPreferredSize(dimensionLabel); | 547 | verboseModeLabel.setPreferredSize(dimensionLabel); |
300 | 554 | 548 | ||
301 | === modified file 'WorkcraftCore/src/org/workcraft/gui/graph/tools/SelectionTool.java' | |||
302 | --- WorkcraftCore/src/org/workcraft/gui/graph/tools/SelectionTool.java 2014-08-01 09:23:25 +0000 | |||
303 | +++ WorkcraftCore/src/org/workcraft/gui/graph/tools/SelectionTool.java 2014-08-04 14:17:33 +0000 | |||
304 | @@ -63,7 +63,6 @@ | |||
305 | 63 | import org.workcraft.dom.visual.VisualGroup; | 63 | import org.workcraft.dom.visual.VisualGroup; |
306 | 64 | import org.workcraft.dom.visual.VisualModel; | 64 | import org.workcraft.dom.visual.VisualModel; |
307 | 65 | import org.workcraft.dom.visual.VisualModelTransformer; | 65 | import org.workcraft.dom.visual.VisualModelTransformer; |
308 | 66 | import org.workcraft.dom.visual.VisualNode; | ||
309 | 67 | import org.workcraft.dom.visual.VisualPage; | 66 | import org.workcraft.dom.visual.VisualPage; |
310 | 68 | import org.workcraft.dom.visual.connections.DefaultAnchorGenerator; | 67 | import org.workcraft.dom.visual.connections.DefaultAnchorGenerator; |
311 | 69 | import org.workcraft.exceptions.ArgumentException; | 68 | import org.workcraft.exceptions.ArgumentException; |
312 | @@ -81,8 +80,6 @@ | |||
313 | 81 | static private final Color selectionBorderColor = new Color(200, 200, 200); | 80 | static private final Color selectionBorderColor = new Color(200, 200, 200); |
314 | 82 | static private final Color selectionFillColor = new Color(99, 130, 191, 32); | 81 | static private final Color selectionFillColor = new Color(99, 130, 191, 32); |
315 | 83 | static private final Color grayOutColor = Color.LIGHT_GRAY; | 82 | static private final Color grayOutColor = Color.LIGHT_GRAY; |
316 | 84 | // node for the MouseOver events | ||
317 | 85 | private VisualNode mouseOverNode = null; | ||
318 | 86 | 83 | ||
319 | 87 | protected JPanel interfacePanel; | 84 | protected JPanel interfacePanel; |
320 | 88 | protected JPanel controlPanel; | 85 | protected JPanel controlPanel; |
321 | @@ -235,29 +232,15 @@ | |||
322 | 235 | rotatePanel.add(rotateCounterclockwiseButton); | 232 | rotatePanel.add(rotateCounterclockwiseButton); |
323 | 236 | } | 233 | } |
324 | 237 | 234 | ||
325 | 238 | private void resetState(GraphEditor editor) { | ||
326 | 239 | mouseOverNode = null; | ||
327 | 240 | } | ||
328 | 241 | |||
329 | 242 | private void updateState(GraphEditorMouseEvent e) { | ||
330 | 243 | Point2D mousePosition = e.getPosition(); | ||
331 | 244 | |||
332 | 245 | VisualNode node = (VisualNode) HitMan.hitTestForSelection(mousePosition, e.getModel()); | ||
333 | 246 | mouseOverNode = node; | ||
334 | 247 | |||
335 | 248 | } | ||
336 | 249 | |||
337 | 250 | @Override | 235 | @Override |
338 | 251 | public void activated(final GraphEditor editor) { | 236 | public void activated(final GraphEditor editor) { |
339 | 252 | super.activated(editor); | 237 | super.activated(editor); |
340 | 253 | editor.getWorkspaceEntry().setCanModify(true); | 238 | editor.getWorkspaceEntry().setCanModify(true); |
341 | 254 | resetState(editor); | ||
342 | 255 | } | 239 | } |
343 | 256 | 240 | ||
344 | 257 | @Override | 241 | @Override |
345 | 258 | public void deactivated(GraphEditor editor) { | 242 | public void deactivated(GraphEditor editor) { |
346 | 259 | editor.getModel().selectNone(); | 243 | editor.getModel().selectNone(); |
347 | 260 | resetState(editor); | ||
348 | 261 | } | 244 | } |
349 | 262 | 245 | ||
350 | 263 | @Override | 246 | @Override |
351 | @@ -334,13 +317,7 @@ | |||
352 | 334 | selected.addAll(model.boxHitTest(e.getStartPosition(), e.getPosition())); | 317 | selected.addAll(model.boxHitTest(e.getStartPosition(), e.getPosition())); |
353 | 335 | selectionBox = selectionRect(e.getStartPosition(), e.getPosition()); | 318 | selectionBox = selectionRect(e.getStartPosition(), e.getPosition()); |
354 | 336 | e.getEditor().repaint(); | 319 | e.getEditor().repaint(); |
355 | 337 | } else { | ||
356 | 338 | // "mouse over" events | ||
357 | 339 | |||
358 | 340 | } | 320 | } |
359 | 341 | |||
360 | 342 | updateState(e); | ||
361 | 343 | |||
362 | 344 | } | 321 | } |
363 | 345 | 322 | ||
364 | 346 | @Override | 323 | @Override |