- Timestamp:
- 2010-06-18T16:08:27+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/atlas-src/trunk/src/org/greenstone/client/GS3MapLibrary.java
r22272 r22277 11 11 import com.google.gwt.event.dom.client.ClickEvent; 12 12 import com.google.gwt.event.dom.client.ClickHandler; 13 import com.google.gwt.event.dom.client.MouseDownEvent;14 import com.google.gwt.event.dom.client.MouseDownHandler;15 import com.google.gwt.event.dom.client.MouseEvent;16 13 import com.google.gwt.event.dom.client.MouseMoveEvent; 17 14 import com.google.gwt.event.dom.client.MouseMoveHandler; … … 129 126 130 127 protected ArrayList<ArrayList<Place>> _currentMultiPlaces = null; 131 132 protected HashMap<String, Place> _chosenPlaces = new HashMap<String, Place>(); 128 protected ArrayList<String> _removedPlaces = new ArrayList<String>(); 129 130 protected HashMap<String, Place> _chosenPlaces = new HashMap<String, Place>(); 133 131 134 132 protected HandlerRegistration _fishEyeHandlerReg = null; … … 1595 1593 1596 1594 //If a different place with this name has been chosen then don't use it 1597 if ( _chosenPlaces.containsKey(p.getName()) && !_chosenPlaces.get(p.getName()).equals(p))1595 if ((_chosenPlaces.containsKey(p.getName()) && !_chosenPlaces.get(p.getName()).equals(p)) || _removedPlaces.contains(p.getName())) 1598 1596 { 1599 1597 continue; … … 2325 2323 } 2326 2324 })); 2327 2328 final MenuItem prevMenuItem =new MenuItem("Remove all highlights", new ClickHandler()2325 2326 menuItems.add(new MenuItem("Remove all highlights", new ClickHandler() 2329 2327 { 2330 2328 public void onClick(ClickEvent event) … … 2350 2348 _currentDocumentMenu.hideMenu(); 2351 2349 } 2350 })); 2351 2352 final MenuItem prevMenuItem = new MenuItem("Remove this place", new ClickHandler() 2353 { 2354 public void onClick(ClickEvent event) 2355 { 2356 _removedPlaces.add(_selectedPlaceName); 2357 _currentDocumentMenu.hideMenu(); 2358 2359 JsArray<Element> textPlaces = getElementsByTagName("span"); 2360 2361 //Add the place spans to the array 2362 for (int j = 0; j < textPlaces.length(); j++) 2363 { 2364 Element e = textPlaces.get(j); 2365 if (e.getAttribute("class").equals("place") && e.getInnerText().equals(_selectedPlaceName)) 2366 { 2367 e.getParentElement().insertBefore(e.getFirstChild(), e); 2368 } 2369 } 2370 2371 addPlacesToMap(_currentPlaces, "#FFFFFF", "#00FF00", false); 2372 } 2352 2373 }); 2353 2374 menuItems.add(prevMenuItem); 2354 2375 2355 menuItems.add(new MenuItem("Choose correct place 2376 menuItems.add(new MenuItem("Choose correct place >", new ClickHandler() 2356 2377 { 2357 2378 public void onClick(ClickEvent event) … … 2359 2380 logToConsole("MARKER!"); 2360 2381 ArrayList<MenuItem> places = new ArrayList<MenuItem>(); 2382 2361 2383 ArrayList<Place> matchingPlaces = new ArrayList<Place>(); 2362 2384 … … 2368 2390 } 2369 2391 } 2370 2392 2371 2393 for (final Place p : matchingPlaces) 2372 2394 { … … 2425 2447 placeMenu.showMenu(); 2426 2448 } 2427 })); 2449 }){ 2450 public boolean condition() 2451 { 2452 ArrayList<Place> matchingPlaces = new ArrayList<Place>(); 2453 2454 if(_currentPlaces == null || _currentPlaces.size() == 0) 2455 { 2456 return false; 2457 } 2458 2459 for (Place p : _currentPlaces) 2460 { 2461 if (p.getName().equals(_selectedPlaceName)) 2462 { 2463 matchingPlaces.add(p); 2464 } 2465 } 2466 2467 if(matchingPlaces.size() > 1) 2468 { 2469 return true; 2470 } 2471 return false; 2472 } 2473 }); 2428 2474 2429 2475 documentMenu.addMenuItems(menuItems); … … 2616 2662 public void run() 2617 2663 { 2664 _currentDocumentMenu.refreshMenu(); 2618 2665 _currentDocumentMenu.moveMenu(x, y); 2619 2666 _currentDocumentMenu.showMenu();
Note:
See TracChangeset
for help on using the changeset viewer.