リビジョン | 27 (tree) |
---|---|
日時 | 2010-10-21 09:41:54 |
作者 | tsukushi1985 |
辞書機能を以前のものに戻した。
ただ、辞書検索を使うと、search scope:nullと出て検索がストップする。(単に登録した範囲が狭すぎるのかもしれないが)。
変更したクラス
com.hexidec.ekit.GSHTMLEditorSearchActionListner(エラーが起きたので同じ内容で書き換えただけ。実質的な変更はしていない)。
smart_gs.dictionary.Dictionary
smart_gs.image_search.normal.swingui.ImageSearchDialog
smart_gs.logical.SpreadTree
smart_gs.smleditor.swingui.GSEditor
@@ -89,7 +89,14 @@ | ||
89 | 89 | this.tabbedPane.getSpreadCanvas().setCenterLocation(point); |
90 | 90 | } |
91 | 91 | public GSEditor(Region region) { |
92 | - this(region.getSpread(),region.getView().getRectangle2D()); | |
92 | + this(region.getSpread()); | |
93 | + View view = region.getView(); | |
94 | + view.setIsEmphasized(true); | |
95 | + Rectangle2D rect = view.getRectangle2D(); | |
96 | + Point point = new Point((int)rect.getX(),(int)rect.getY()); | |
97 | + this.tabbedPane.getSpreadCanvas().setCenterLocation(point); | |
98 | + this.tabbedPane.getSpreadCanvas().addTempView(view); | |
99 | + | |
93 | 100 | } |
94 | 101 | public GSEditor(TextSegment segment) { |
95 | 102 | super("Editor"); |
@@ -18,8 +18,8 @@ | ||
18 | 18 | public void setWord(String word) { |
19 | 19 | this.word = word; |
20 | 20 | } |
21 | - public DictionaryRegion getDictionaryRegionList(int index) { | |
22 | - return dictionaryRegionList.get(index); | |
21 | + public void deleteDictionaryRegionList(int index) { | |
22 | + dictionaryRegionList.remove(index); | |
23 | 23 | } |
24 | 24 | |
25 | 25 |
@@ -1,20 +1,11 @@ | ||
1 | 1 | package smart_gs.dictionary; |
2 | 2 | |
3 | -import java.awt.Image; | |
4 | -import java.awt.Point; | |
5 | -import java.awt.Rectangle; | |
6 | -import java.awt.geom.Point2D; | |
7 | 3 | import java.io.File; |
8 | -import java.io.FileInputStream; | |
9 | 4 | import java.io.FileOutputStream; |
10 | 5 | import java.io.IOException; |
11 | 6 | import java.io.OutputStreamWriter; |
12 | 7 | import java.io.StringWriter; |
13 | -import java.nio.channels.FileChannel; | |
14 | -import java.text.SimpleDateFormat; | |
15 | 8 | import java.util.ArrayList; |
16 | -import java.util.Calendar; | |
17 | -import java.util.Enumeration; | |
18 | 9 | import java.util.HashMap; |
19 | 10 | import java.util.Iterator; |
20 | 11 | import java.util.List; |
@@ -23,9 +14,6 @@ | ||
23 | 14 | import java.util.regex.Pattern; |
24 | 15 | |
25 | 16 | import javax.swing.JOptionPane; |
26 | -import javax.swing.tree.DefaultMutableTreeNode; | |
27 | -import javax.swing.tree.DefaultTreeModel; | |
28 | -import javax.swing.tree.TreePath; | |
29 | 17 | import javax.xml.parsers.DocumentBuilder; |
30 | 18 | import javax.xml.parsers.DocumentBuilderFactory; |
31 | 19 | import javax.xml.parsers.ParserConfigurationException; |
@@ -36,33 +24,20 @@ | ||
36 | 24 | import javax.xml.transform.dom.DOMSource; |
37 | 25 | import javax.xml.transform.stream.StreamResult; |
38 | 26 | |
39 | -import org.apache.commons.lang.StringUtils; | |
40 | 27 | import org.w3c.dom.Document; |
41 | 28 | import org.w3c.dom.Element; |
42 | 29 | import org.w3c.dom.NodeList; |
43 | 30 | import org.xml.sax.SAXException; |
44 | 31 | |
45 | -import reasoning_web.logical.Connection; | |
46 | -import smart_gs.drawing_tool.view.RectangleView; | |
47 | 32 | import smart_gs.logical.GSResource; |
48 | -import smart_gs.logical.LineSegment; | |
49 | 33 | import smart_gs.logical.Preference; |
50 | 34 | import smart_gs.logical.Region; |
51 | 35 | import smart_gs.logical.Spread; |
52 | 36 | import smart_gs.logical.SpreadTree; |
53 | 37 | import smart_gs.logical.XML2ResourceConverter; |
54 | -import smart_gs.reasoning_web.logical.GSExplanatoryNote; | |
55 | -import smart_gs.reasoning_web.logical.GS_RWRepository; | |
56 | 38 | import smart_gs.swingui.WorkspaceWindow; |
57 | -import smart_gs.swingui.toolbar.action.ShowLocalViewAction; | |
58 | -import smart_gs.swingui.tree.action.AddDirectoryAction; | |
59 | -import smart_gs.util.BmpFileCreator; | |
60 | -import smart_gs.util.SegmentInfoCreator; | |
61 | 39 | |
62 | 40 | public class DictionaryXML { |
63 | - private static int[] charint = {Integer.parseInt("FFE5",16)}; | |
64 | -// public static final String DICTIONARY = new String(charint,0,1) + "dictionary"; | |
65 | - public static final String DICTIONARY = "~dictionary"; | |
66 | 41 | |
67 | 42 | protected static DictionaryXML singleton; |
68 | 43 | protected String dictionaryfilename; |
@@ -96,7 +71,7 @@ | ||
96 | 71 | load(false); |
97 | 72 | } |
98 | 73 | */ |
99 | - public void load(){ | |
74 | + protected void load(){ | |
100 | 75 | // XML2ResourceConverter.getSpread(parent, element) |
101 | 76 | loadSpreads.clear(); |
102 | 77 | dictionaryMap.clear(); |
@@ -147,7 +122,7 @@ | ||
147 | 122 | Region region = XML2ResourceConverter.getRegion(spread, regionElement); |
148 | 123 | |
149 | 124 | DictionaryRegion dictionaryRegion = new DictionaryRegion(); |
150 | - dictionaryRegion.setUri(region.getSpread().getURI()); | |
125 | + dictionaryRegion.setImageFile("C:/a"); | |
151 | 126 | dictionaryRegion.setRegion(region); |
152 | 127 | dictionary.addDictionaryRegionList(dictionaryRegion); |
153 | 128 | }else{ |
@@ -223,14 +198,12 @@ | ||
223 | 198 | } |
224 | 199 | return wordList; |
225 | 200 | } |
226 | - public void add(String word,Region region_){ | |
227 | - Region region = createDSC(region_); | |
228 | - | |
201 | + public void add(String word,Region region){ | |
229 | 202 | if(dictionaryMap.containsKey(word)){ |
230 | 203 | Dictionary dictionary = dictionaryMap.get(word); |
231 | 204 | |
232 | 205 | DictionaryRegion dictionaryRegion = new DictionaryRegion(); |
233 | - dictionaryRegion.setUri(region_.getSpread().getURI()); | |
206 | + dictionaryRegion.setImageFile("C:/a"); | |
234 | 207 | dictionaryRegion.setRegion(region); |
235 | 208 | dictionary.addDictionaryRegionList(dictionaryRegion); |
236 | 209 | }else{ |
@@ -238,120 +211,13 @@ | ||
238 | 211 | dictionary.setWord(word); |
239 | 212 | |
240 | 213 | DictionaryRegion dictionaryRegion = new DictionaryRegion(); |
241 | - dictionaryRegion.setUri(region_.getSpread().getURI()); | |
214 | + dictionaryRegion.setImageFile("C:/a"); | |
242 | 215 | dictionaryRegion.setRegion(region); |
243 | 216 | dictionary.addDictionaryRegionList(dictionaryRegion); |
244 | 217 | |
245 | 218 | dictionaryMap.put(word, dictionary); |
246 | 219 | } |
247 | - Spread spread = region.getSpread(); | |
248 | - spread.addRegion(region); | |
249 | - spread.checkDscFile(); | |
250 | - spread.loadLines(); | |
251 | - // リンクを作成 | |
252 | - { | |
253 | - GSExplanatoryNote note = new GSExplanatoryNote("<xml></xml>"); | |
254 | - GS_RWRepository.getInstance().createConnection(region_, region, note,Connection.TARGET_TO_SOURCE); | |
255 | - } | |
256 | - { | |
257 | - GSExplanatoryNote note = new GSExplanatoryNote("<xml></xml>"); | |
258 | - GS_RWRepository.getInstance().createConnection(region, region_, note,Connection.TARGET_TO_SOURCE); | |
259 | - } | |
260 | - if(!loadSpreads.contains(spread)){ | |
261 | - loadSpreads.add(spread); | |
262 | - } | |
263 | - | |
264 | 220 | } |
265 | - | |
266 | - protected Region createDSC(Region region){ | |
267 | - SpreadTree spreadTree = SpreadTree.getInstance(); | |
268 | - Image image = region.getSpread().getImage(); | |
269 | - | |
270 | - String imagepath = Preference.getInstance().getImageFolderPath(); | |
271 | - imagepath = StringUtils.replace(imagepath, "\\", "/"); | |
272 | - if(!imagepath.endsWith("/")){ | |
273 | - imagepath += "/"; | |
274 | - } | |
275 | - imagepath += DICTIONARY + "/"; | |
276 | - File file = new File(imagepath); | |
277 | - if(!file.exists()){ | |
278 | - file.mkdirs(); | |
279 | - } | |
280 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | |
281 | - Calendar cal = Calendar.getInstance(); | |
282 | - String filename = sdf.format(cal.getTime()); | |
283 | - try{ | |
284 | - String extend = ""; | |
285 | - if(region.getSpread().getFile().getName().lastIndexOf(".") != -1){ | |
286 | - extend = region.getSpread().getFile().getName().substring(region.getSpread().getFile().getName().lastIndexOf("."),region.getSpread().getFile().getName().length()); | |
287 | - } | |
288 | - copyTransfer(region.getSpread().getFile().getAbsolutePath(),imagepath + sdf.format(cal.getTime()) + extend); | |
289 | - }catch(IOException e){ | |
290 | - e.printStackTrace(); | |
291 | - } | |
292 | - | |
293 | - | |
294 | - String folderPath = Spread.DSC_FOLDER_PATH; | |
295 | - folderPath = StringUtils.replace(folderPath, "\\", "/"); | |
296 | - if(!folderPath.endsWith("/")){ | |
297 | - folderPath+="/"; | |
298 | - } | |
299 | - folderPath += DICTIONARY + "/"; | |
300 | - new File(folderPath).mkdirs(); | |
301 | - new BmpFileCreator(image,image.getWidth(null),image.getHeight(null)).create(folderPath,filename + ".bmp",false); | |
302 | - | |
303 | - List<LineSegment> segments = new ArrayList<LineSegment>(); | |
304 | - List<Point2D> points = new ArrayList<Point2D>(); | |
305 | - Rectangle rectangle = region.getView().getRectangle(); | |
306 | - | |
307 | - points.add(new Point((int)rectangle.getX(),(int)rectangle.getY())); | |
308 | - points.add(new Point((int)rectangle.getX() + (int)rectangle.getWidth(),(int)rectangle.getY())); | |
309 | - points.add(new Point((int)rectangle.getX() + (int)rectangle.getWidth(),(int)rectangle.getY() + (int)rectangle.getHeight())); | |
310 | - points.add(new Point((int)rectangle.getX(),(int)rectangle.getY() + (int)rectangle.getHeight())); | |
311 | - segments.add(new LineSegment(null,points)); | |
312 | - SegmentInfoCreator creator = new SegmentInfoCreator(); | |
313 | - creator.createSegmentInfo(segments, folderPath,filename); | |
314 | - | |
315 | - File xmlfile = new File(folderPath+ filename + ".xml"); | |
316 | - creator.createDSCFile(xmlfile.getAbsolutePath(),false); | |
317 | - | |
318 | - spreadTree.clearSelection(); | |
319 | - AddDirectoryAction addDirectoryAction = new AddDirectoryAction(spreadTree.getRootSpreadDirectory().getFile(),spreadTree,spreadTree.getRootSpreadDirectory()); | |
320 | - addDirectoryAction.exec(file); | |
321 | - | |
322 | - DefaultMutableTreeNode rootNode = spreadTree.getRootNode(); | |
323 | - Enumeration enumeration = rootNode.children(); | |
324 | - while( enumeration.hasMoreElements() ){ | |
325 | - // 分割した各要素を取得します。 | |
326 | - Object obj = (Object)enumeration.nextElement(); | |
327 | - if(obj instanceof DefaultMutableTreeNode){ | |
328 | - DefaultMutableTreeNode childNode = (DefaultMutableTreeNode)obj; | |
329 | - if(childNode.toString().equals(DICTIONARY)){ | |
330 | - Object pathArray[] = {rootNode,childNode}; | |
331 | - spreadTree.setSelectionPath(new TreePath(pathArray)); | |
332 | - break; | |
333 | - } | |
334 | - } | |
335 | - } | |
336 | - | |
337 | - Spread spread = spreadTree.getSpreadByURI2(DICTIONARY + "/" + filename); | |
338 | - | |
339 | - // 作成ファイルを削除 | |
340 | - new File(folderPath,filename + ".bmp").delete(); | |
341 | - xmlfile.delete(); | |
342 | - | |
343 | - return new Region(spread,new RectangleView(rectangle)); | |
344 | - } | |
345 | - private void copyTransfer(String srcPath, String destPath) throws IOException { | |
346 | - FileChannel srcChannel = new FileInputStream(srcPath).getChannel(); | |
347 | - FileChannel destChannel = new FileOutputStream(destPath).getChannel(); | |
348 | - try { | |
349 | - srcChannel.transferTo(0, srcChannel.size(), destChannel); | |
350 | - } finally { | |
351 | - srcChannel.close(); | |
352 | - destChannel.close(); | |
353 | - } | |
354 | - } | |
355 | 221 | public void add(String word,Dictionary newDictionary){ |
356 | 222 | if(dictionaryMap.containsKey(word)){ |
357 | 223 | Dictionary dictionary = dictionaryMap.get(word); |
@@ -367,101 +233,18 @@ | ||
367 | 233 | public void deleteRegion(String word,int index){ |
368 | 234 | if(dictionaryMap.containsKey(word)){ |
369 | 235 | Dictionary dictionary = dictionaryMap.get(word); |
370 | - DictionaryRegion dictionaryRegion = dictionary.getDictionaryRegionList(index); | |
371 | - String deleteURL = dictionaryRegion.getRegion().getSpread().getURI(); | |
372 | - deleteTree(deleteURL); | |
236 | + dictionary.deleteDictionaryRegionList(index); | |
237 | + ArrayList<DictionaryRegion> list = dictionary.getDictionaryRegionList(); | |
238 | + if(list.size() == 0){ | |
239 | + dictionaryMap.remove(word); | |
240 | + } | |
373 | 241 | } |
374 | 242 | } |
375 | 243 | public void delete(String word){ |
376 | - Dictionary dictionary = null; | |
377 | 244 | if(dictionaryMap.containsKey(word)){ |
378 | - dictionary = dictionaryMap.get(word); | |
379 | - }else{ | |
380 | - return; | |
245 | + dictionaryMap.remove(word); | |
381 | 246 | } |
382 | - ArrayList<DictionaryRegion> dictionaryRegionList = dictionary.getDictionaryRegionList(); | |
383 | - ArrayList<String> deleteUrlList = new ArrayList<String>(); | |
384 | - for(int i=0;i<dictionaryRegionList.size();i++){ | |
385 | - DictionaryRegion dictionaryRegion = dictionaryRegionList.get(i); | |
386 | - deleteUrlList.add(dictionaryRegion.getRegion().getSpread().getURI()); | |
387 | - } | |
388 | - for(int i=0;i<deleteUrlList.size();i++){ | |
389 | - deleteTree(deleteUrlList.get(i)); | |
390 | - } | |
391 | - | |
392 | 247 | } |
393 | - protected void deleteTree(String url){ | |
394 | - SpreadTree spreadTree = SpreadTree.getInstance(); | |
395 | - | |
396 | - DefaultMutableTreeNode rootNode = spreadTree.getRootNode(); | |
397 | - Enumeration enumeration = rootNode.children(); | |
398 | - while( enumeration.hasMoreElements() ){ | |
399 | - // 分割した各要素を取得します。 | |
400 | - Object obj = (Object)enumeration.nextElement(); | |
401 | - if(obj instanceof DefaultMutableTreeNode){ | |
402 | - DefaultMutableTreeNode childNode = (DefaultMutableTreeNode)obj; | |
403 | - if(childNode.toString().equals(DICTIONARY)){ | |
404 | - Enumeration enumeration2 = childNode.children(); | |
405 | - while( enumeration2.hasMoreElements() ){ | |
406 | - // 分割した各要素を取得します。 | |
407 | - Object obj2 = (Object)enumeration2.nextElement(); | |
408 | - if(obj2 instanceof DefaultMutableTreeNode){ | |
409 | - DefaultMutableTreeNode childNode2 = (DefaultMutableTreeNode)obj2; | |
410 | - if(childNode2.getUserObject() instanceof Spread){ | |
411 | - Spread deleteSpread = (Spread)childNode2.getUserObject(); | |
412 | - if(deleteSpread.getURI().equals(url)){ | |
413 | - spreadTree.clearSelection(); | |
414 | - Object pathArray[] = {rootNode,childNode,childNode2}; | |
415 | - spreadTree.setSelectionPath(new TreePath(pathArray)); | |
416 | - spreadTree.remove(); | |
417 | - return; | |
418 | - } | |
419 | - } | |
420 | - } | |
421 | - } | |
422 | - } | |
423 | - } | |
424 | - } | |
425 | - | |
426 | - } | |
427 | - | |
428 | - public void deleteByURL(String url){ | |
429 | - Iterator<String> itr = dictionaryMap.keySet().iterator(); | |
430 | - ArrayList<String> deleteWordList = new ArrayList<String>(); | |
431 | - while(itr.hasNext()){ | |
432 | - String word = itr.next(); | |
433 | - Dictionary dictionary = dictionaryMap.get(word); | |
434 | - ArrayList<DictionaryRegion> dictionaryRegionList = dictionary.getDictionaryRegionList(); | |
435 | - while(true){ | |
436 | - int deleteIndex = -1; | |
437 | - for(int i=0;i<dictionaryRegionList.size();i++){ | |
438 | - DictionaryRegion dictionaryRegion = dictionaryRegionList.get(i); | |
439 | - Region region = dictionaryRegion.getRegion(); | |
440 | - if(region.getSpread().getURI().equals(url)){ | |
441 | - deleteIndex = i; | |
442 | - break; | |
443 | - } | |
444 | - } | |
445 | - if(deleteIndex != -1){ | |
446 | - dictionaryRegionList.remove(deleteIndex); | |
447 | - }else{ | |
448 | - break; | |
449 | - } | |
450 | - } | |
451 | - if(dictionaryRegionList.size() == 0){ | |
452 | - if(!deleteWordList.contains(word)){ | |
453 | - deleteWordList.add(word); | |
454 | - } | |
455 | - } | |
456 | - } | |
457 | - for(int i=0;i<deleteWordList.size();i++){ | |
458 | - String deleteWord = deleteWordList.get(i); | |
459 | - if(dictionaryMap.containsKey(deleteWord)){ | |
460 | - dictionaryMap.remove(deleteWord); | |
461 | - } | |
462 | - } | |
463 | - } | |
464 | - | |
465 | 248 | public Dictionary getDictionary(String word){ |
466 | 249 | if(dictionaryMap.containsKey(word)){ |
467 | 250 | return dictionaryMap.get(word); |
@@ -10,13 +10,13 @@ | ||
10 | 10 | |
11 | 11 | public class DictionaryRegion { |
12 | 12 | protected Region region; |
13 | - protected String uri; | |
13 | + protected String imageFile; | |
14 | 14 | |
15 | - public String getUri() { | |
16 | - return uri; | |
15 | + public String getImageFile() { | |
16 | + return imageFile; | |
17 | 17 | } |
18 | - public void setUri(String uri) { | |
19 | - this.uri = uri; | |
18 | + public void setImageFile(String imageFile) { | |
19 | + this.imageFile = imageFile; | |
20 | 20 | } |
21 | 21 | public Region getRegion() { |
22 | 22 | return region; |
@@ -24,9 +24,6 @@ | ||
24 | 24 | import javax.swing.JPanel; |
25 | 25 | import javax.swing.border.TitledBorder; |
26 | 26 | |
27 | -import org.apache.commons.lang.StringUtils; | |
28 | - | |
29 | -import smart_gs.dictionary.DictionaryXML; | |
30 | 27 | import smart_gs.dictionary.image.ImageSearchFilterImpl; |
31 | 28 | import smart_gs.dictionary.image.ImageSearchFilterTypeAImpl; |
32 | 29 | import smart_gs.dictionary.image.ImageSearchFilterTypeBImpl; |
@@ -40,7 +37,6 @@ | ||
40 | 37 | import smart_gs.logical.Preference; |
41 | 38 | import smart_gs.logical.Region; |
42 | 39 | import smart_gs.logical.Spread; |
43 | -import smart_gs.logical.SpreadDirectory; | |
44 | 40 | import smart_gs.spread_selection.SetScopePanel; |
45 | 41 | import smart_gs.util.BmpFileCreator; |
46 | 42 | import smart_gs.util.ImageCropper; |
@@ -151,76 +147,16 @@ | ||
151 | 147 | this.search(query); |
152 | 148 | |
153 | 149 | } |
154 | - | |
155 | - private void editSearch2(){ | |
156 | - String folderPath = Spread.DSC_FOLDER_PATH; | |
157 | - folderPath = StringUtils.replace(folderPath, "\\", "/"); | |
158 | - if(!folderPath.endsWith("/")){ | |
159 | - folderPath += "/"; | |
160 | - } | |
161 | - folderPath += "temp_"; | |
162 | - if(!new File(folderPath).delete()){ | |
163 | - File[] deleteFiles = new File(folderPath).listFiles(); | |
164 | - if(deleteFiles != null){ | |
165 | - for(int i=0;i<deleteFiles.length;i++){ | |
166 | - deleteFiles[i].delete(); | |
167 | - } | |
168 | - } | |
169 | - } | |
170 | - final Spread spread = region.getSpread(); | |
171 | - folderPath += "/" + spread.getFileNameWithoutExtension() + "/"; | |
172 | - if(!new File(folderPath).exists()){ | |
173 | - new File(folderPath).mkdirs(); | |
174 | - } | |
175 | - Image image2 = spread.getImage(); | |
176 | - new BmpFileCreator(image2,image2.getWidth(null),image2.getHeight(null)).create(folderPath,spread.getFileNameWithoutExtension() + ".bmp",false); | |
177 | - List<LineSegment> segments = new ArrayList<LineSegment>(); | |
178 | - List<Point2D> points = new ArrayList<Point2D>(); | |
179 | - Rectangle rectangle2 = region.getView().getRectangle(); | |
180 | - points.add(new Point((int)rectangle2.getX(),(int)rectangle2.getY())); | |
181 | - points.add(new Point((int)rectangle2.getX() + (int)rectangle2.getWidth(),(int)rectangle2.getY())); | |
182 | - points.add(new Point((int)rectangle2.getX() + (int)rectangle2.getWidth(),(int)rectangle2.getY() + (int)rectangle2.getHeight())); | |
183 | - points.add(new Point((int)rectangle2.getX(),(int)rectangle2.getY() + (int)rectangle2.getHeight())); | |
184 | - segments.add(new LineSegment(null,points)); | |
185 | - SegmentInfoCreator creator = new SegmentInfoCreator(); | |
186 | - creator.createSegmentInfo(segments, folderPath,spread.getFileNameWithoutExtension()); | |
187 | - File file = new File(folderPath+ spread.getFileNameWithoutExtension() + ".xml"); | |
188 | - creator.createDSCFile(file.getAbsolutePath(),false); | |
189 | - final String tempDscPath = folderPath; | |
190 | - Spread tempSpread = new Spread(spread.getVolume(),spread.getFile()){ | |
191 | - public void checkDscFile() { | |
192 | - String a = region.getSpread().getName(); | |
193 | - super.dscFile = new File(tempDscPath+"dsc/" + spread.getFileNameWithoutExtension() + ".dsc"); | |
194 | - } | |
195 | - public File getDscFile() { | |
196 | - return super.dscFile; | |
197 | - } | |
198 | - }; | |
199 | - tempSpread.checkDscFile(); | |
200 | - GSQuery query = new GSQuery(tempSpread,image2,new File(folderPath+"dsc/" + spread.getFileNameWithoutExtension() + ".dsc"),rectangle); | |
201 | - this.search(query); | |
202 | - } | |
203 | - | |
150 | + | |
204 | 151 | private void search(GSQuery query){ |
205 | 152 | // List<Spread> spreads = this.getSpreadsToSearch(); |
206 | 153 | |
207 | 154 | List<Spread> spreads = this.scopePanel.getSpreadsToSearch(); |
208 | 155 | List<Spread> spreadsToSearch = new ArrayList<Spread>(); |
209 | - ArrayList<File> dictionaryDSCList = null; | |
210 | - if(this.scopePanel.isImageDictionary()){ | |
211 | - for(int i=0;i<spreads.size();i++){ | |
212 | - if(spreads.get(i).hasDscFile()){ | |
213 | - spreadsToSearch.add(spreads.get(i)); | |
214 | - } | |
156 | + for(int i=0;i<spreads.size();i++){ | |
157 | + if(spreads.get(i).hasDscFile()){ | |
158 | + spreadsToSearch.add(spreads.get(i)); | |
215 | 159 | } |
216 | - }else{ | |
217 | - for(int i=0;i<spreads.size();i++){ | |
218 | - if(spreads.get(i).hasDscFile()){ | |
219 | - if(!spreads.get(i).getURI().startsWith("smart://" + DictionaryXML.DICTIONARY )){ | |
220 | - spreadsToSearch.add(spreads.get(i)); | |
221 | - } | |
222 | - } | |
223 | - } | |
224 | 160 | } |
225 | 161 | |
226 | 162 | SearchQueryAction searchAction = new SearchQueryAction(query,spreadsToSearch); |
@@ -240,9 +176,8 @@ | ||
240 | 176 | }else{ |
241 | 177 | imageSearchFilterImpl = new ImageSearchFilterTypeAImpl(); |
242 | 178 | } |
243 | - // FIXME フィルターをはずす。 | |
244 | -// imageSearchFilterImpl.init(); | |
245 | -// searchAction.addImageSearchFilter(imageSearchFilterImpl); | |
179 | + imageSearchFilterImpl.init(); | |
180 | + searchAction.addImageSearchFilter(imageSearchFilterImpl); | |
246 | 181 | } |
247 | 182 | searchAction.execute(); |
248 | 183 | List<SearchResult> results = searchAction.getResults(); |
@@ -273,10 +208,6 @@ | ||
273 | 208 | editSearch(); |
274 | 209 | return; |
275 | 210 | } |
276 | - if(scopePanel.isImageDictionary()){ | |
277 | - editSearch2(); | |
278 | - return; | |
279 | - } | |
280 | 211 | GSQuery query = new GSQuery(region.getSpread(),dscFile,rectangle); |
281 | 212 | try{ |
282 | 213 | search(query); |
@@ -239,27 +239,7 @@ | ||
239 | 239 | String nameStr = deletespread.toString(); |
240 | 240 | |
241 | 241 | |
242 | - ///---------------辞書の場合はDSCも画像も削除する。 | |
243 | - if(deletespread.getURI().startsWith("smart://" + DictionaryXML.DICTIONARY)){ | |
244 | - DictionaryXML dictionaryXML = DictionaryXML.getInstance(); | |
245 | - dictionaryXML.deleteByURL(deletespread.getURI()); | |
246 | - try { | |
247 | - dictionaryXML.write(); | |
248 | - dictionaryXML.load(); | |
249 | - } catch (ParserConfigurationException e) { | |
250 | - // TODO 自動生成された catch ブロック | |
251 | - e.printStackTrace(); | |
252 | - } | |
253 | - if(deletespread.getDscFile() != null){ | |
254 | - deletespread.getDscFile().delete(); | |
255 | - } | |
256 | - if(deletespread.getFile() != null){ | |
257 | - deletespread.getFile().delete(); | |
258 | - } | |
259 | - } | |
260 | - //---------------- | |
261 | 242 | |
262 | - | |
263 | 243 | DefaultMutableTreeNode targetNode = (DefaultMutableTreeNode) path.getLastPathComponent(); |
264 | 244 | DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) targetNode.getParent(); |
265 | 245 |
@@ -2,4 +2,5 @@ | ||
2 | 2 | |
3 | 3 | public interface GSHTMLEditorSearchActionListner { |
4 | 4 | public void actionPerformed(); |
5 | + | |
5 | 6 | } |
@@ -1,41 +1,113 @@ | ||
1 | -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
2 | 2 | <dictionary> |
3 | 3 | <index word="sample"> |
4 | -<spread filename="&rootpath;\images\letters\letters007.jpg" name="" uri="smart://letters007/"> | |
5 | -<region name="" protection="normal" uri="smart://letters007/rect/1"> | |
6 | -<view height="110.0" type="rect" width="46.0" x="705.0" y="553.0"/> | |
4 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
5 | +<region name="" protection="normal" uri="line segment"> | |
6 | +<view type="lasso"> | |
7 | +<view type="line" x1="780.0" x2="780.0" y1="296.0" y2="487.0"/> | |
8 | +<view type="line" x1="780.0" x2="726.0" y1="487.0" y2="458.0"/> | |
9 | +<view type="line" x1="726.0" x2="714.0" y1="458.0" y2="318.0"/> | |
10 | +<view type="line" x1="714.0" x2="735.0" y1="318.0" y2="284.0"/> | |
11 | +<view type="line" x1="735.0" x2="735.0" y1="284.0" y2="284.0"/> | |
12 | +</view> | |
7 | 13 | </region> |
8 | 14 | </spread> |
9 | 15 | </index> |
10 | -<index word="人"> | |
11 | -<spread filename="&rootpath;\images\letters\letters001.jpg" name="" uri="smart://letters001/"> | |
12 | -<region name="" protection="normal" uri="smart://letters001/rect/1"> | |
13 | -<view height="52.0" type="rect" width="51.0" x="1738.0" y="514.0"/> | |
16 | +<index word="天地"> | |
17 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
18 | +<region name="" protection="normal" uri="line segment"> | |
19 | +<view type="lasso"> | |
20 | +<view type="line" x1="901.0" x2="966.0" y1="876.0" y2="868.0"/> | |
21 | +<view type="line" x1="966.0" x2="958.0" y1="868.0" y2="973.0"/> | |
22 | +<view type="line" x1="958.0" x2="899.0" y1="973.0" y2="979.0"/> | |
23 | +<view type="line" x1="899.0" x2="899.0" y1="979.0" y2="884.0"/> | |
24 | +<view type="line" x1="899.0" x2="899.0" y1="884.0" y2="884.0"/> | |
25 | +</view> | |
14 | 26 | </region> |
15 | 27 | </spread> |
16 | -<spread filename="&rootpath;\images\letters\letters001.jpg" name="" uri="smart://letters001/"> | |
17 | -<region name="" protection="normal" uri="smart://letters001/rect/3"> | |
18 | -<view height="56.0" type="rect" width="62.0" x="1612.0" y="479.0"/> | |
28 | +</index> | |
29 | +<index word="数"> | |
30 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
31 | +<region name="" protection="normal" uri="line segment"> | |
32 | +<view type="lasso"> | |
33 | +<view type="line" x1="296.0" x2="372.0" y1="1098.0" y2="1104.0"/> | |
34 | +<view type="line" x1="372.0" x2="364.0" y1="1104.0" y2="1157.0"/> | |
35 | +<view type="line" x1="364.0" x2="327.0" y1="1157.0" y2="1167.0"/> | |
36 | +<view type="line" x1="327.0" x2="292.0" y1="1167.0" y2="1155.0"/> | |
37 | +<view type="line" x1="292.0" x2="296.0" y1="1155.0" y2="1098.0"/> | |
38 | +<view type="line" x1="296.0" x2="296.0" y1="1098.0" y2="1098.0"/> | |
39 | +</view> | |
19 | 40 | </region> |
20 | 41 | </spread> |
21 | -<spread filename="&rootpath;\images\letters\letters001.jpg" name="" uri="smart://letters001/"> | |
22 | -<region name="" protection="normal" uri="smart://letters001/rect/5"> | |
23 | -<view height="54.0" type="rect" width="78.0" x="411.0" y="512.0"/> | |
42 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
43 | +<region name="" protection="normal" uri="smart://kaisei\l006040009l/rect/8"> | |
44 | +<view height="70.0" type="rect" width="72.0" x="804.0" y="515.0"/> | |
24 | 45 | </region> |
25 | 46 | </spread> |
47 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
48 | +<region name="" protection="normal" uri="smart://kaisei\l006040009l/rect/8"> | |
49 | +<view height="70.0" type="rect" width="72.0" x="804.0" y="515.0"/> | |
50 | +</region> | |
51 | +</spread> | |
52 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
53 | +<region name="" protection="normal" uri="smart://kaisei\l006040009l/rect/2"> | |
54 | +<view height="62.0" type="rect" width="70.0" x="979.0" y="357.0"/> | |
55 | +</region> | |
56 | +</spread> | |
26 | 57 | </index> |
27 | -<index word="科学"> | |
28 | -<spread filename="&rootpath;\images\letters\letters001.jpg" name="" uri="smart://letters001/"> | |
29 | -<region name="" protection="normal" uri="smart://letters001/rect/4"> | |
30 | -<view height="153.0" type="rect" width="58.0" x="1252.0" y="429.0"/> | |
58 | +<index word="清濁"> | |
59 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
60 | +<region name="" protection="normal" uri="line segment"> | |
61 | +<view type="lasso"> | |
62 | +<view type="line" x1="985.0" x2="1044.0" y1="460.0" y2="466.0"/> | |
63 | +<view type="line" x1="1044.0" x2="1048.0" y1="466.0" y2="591.0"/> | |
64 | +<view type="line" x1="1048.0" x2="989.0" y1="591.0" y2="579.0"/> | |
65 | +<view type="line" x1="989.0" x2="979.0" y1="579.0" y2="460.0"/> | |
66 | +<view type="line" x1="979.0" x2="979.0" y1="460.0" y2="460.0"/> | |
67 | +<view type="line" x1="979.0" x2="979.0" y1="460.0" y2="460.0"/> | |
68 | +</view> | |
31 | 69 | </region> |
32 | 70 | </spread> |
33 | 71 | </index> |
34 | -<index word="簡"> | |
35 | -<spread filename="&rootpath;\images\letters\letters001.jpg" name="" uri="smart://letters001/"> | |
36 | -<region name="" protection="normal" uri="smart://letters001/rect/6"> | |
37 | -<view height="78.0" type="rect" width="46.0" x="1727.0" y="936.0"/> | |
72 | +<index word="礼楽"> | |
73 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
74 | +<region name="" protection="normal" uri="line segment"> | |
75 | +<view type="lasso"> | |
76 | +<view type="line" x1="290.0" x2="359.0" y1="817.0" y2="806.0"/> | |
77 | +<view type="line" x1="359.0" x2="361.0" y1="806.0" y2="940.0"/> | |
78 | +<view type="line" x1="361.0" x2="296.0" y1="940.0" y2="940.0"/> | |
79 | +<view type="line" x1="296.0" x2="292.0" y1="940.0" y2="821.0"/> | |
80 | +<view type="line" x1="292.0" x2="292.0" y1="821.0" y2="821.0"/> | |
81 | +</view> | |
38 | 82 | </region> |
39 | 83 | </spread> |
40 | 84 | </index> |
85 | +<index word="自然"> | |
86 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
87 | +<region name="" protection="normal" uri="line segment"> | |
88 | +<view type="lasso"> | |
89 | +<view type="line" x1="911.0" x2="958.0" y1="1098.0" y2="1094.0"/> | |
90 | +<view type="line" x1="958.0" x2="966.0" y1="1094.0" y2="1196.0"/> | |
91 | +<view type="line" x1="966.0" x2="917.0" y1="1196.0" y2="1208.0"/> | |
92 | +<view type="line" x1="917.0" x2="899.0" y1="1208.0" y2="1157.0"/> | |
93 | +<view type="line" x1="899.0" x2="913.0" y1="1157.0" y2="1096.0"/> | |
94 | +<view type="line" x1="913.0" x2="913.0" y1="1096.0" y2="1096.0"/> | |
95 | +</view> | |
96 | +</region> | |
97 | +</spread> | |
98 | +</index> | |
99 | +<index word="萬物"> | |
100 | +<spread filename="&rootpath;\images\kaisei\l006040009l.png" name="" uri="smart://kaisei\l006040009l/"> | |
101 | +<region name="" protection="normal" uri="line segment"> | |
102 | +<view type="lasso"> | |
103 | +<view type="line" x1="903.0" x2="952.0" y1="523.0" y2="521.0"/> | |
104 | +<view type="line" x1="952.0" x2="966.0" y1="521.0" y2="622.0"/> | |
105 | +<view type="line" x1="966.0" x2="925.0" y1="622.0" y2="644.0"/> | |
106 | +<view type="line" x1="925.0" x2="895.0" y1="644.0" y2="610.0"/> | |
107 | +<view type="line" x1="895.0" x2="899.0" y1="610.0" y2="523.0"/> | |
108 | +<view type="line" x1="899.0" x2="899.0" y1="523.0" y2="523.0"/> | |
109 | +</view> | |
110 | +</region> | |
111 | +</spread> | |
112 | +</index> | |
41 | 113 | </dictionary> |