View Javadoc

1   /**********************************************
2    * Copyright (C) 2011 Lukas Laag
3    * This file is part of svgreal.
4    * 
5    * svgreal is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    * 
10   * svgreal is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   * 
15   * You should have received a copy of the GNU General Public License
16   * along with svgreal.  If not, see http://www.gnu.org/licenses/
17   **********************************************/
18  package org.vectomatic.svg.edit.client.command.dnd;
19  
20  import java.util.List;
21  
22  import org.vectomatic.svg.edit.client.command.DndCommandFactory.DropGesture;
23  import org.vectomatic.svg.edit.client.model.ModelConstants;
24  import org.vectomatic.svg.edit.client.model.svg.SVGElementModel;
25  
26  import com.extjs.gxt.ui.client.event.DNDEvent;
27  import com.extjs.gxt.ui.client.util.Format;
28  import com.google.gwt.event.dom.client.KeyCodes;
29  
30  
31  /**
32   * Class to manage instantiation of def elements drag-and-drop interactions
33   * @author laaglu
34   */
35  public class DndLinkHandler extends DndHandlerBase {
36  	@Override
37  	public boolean isValidSource(DNDEvent event, List<SVGElementModel> sourceElements) {
38  		return event.isAltKey() && super.isValidSource(event, sourceElements);
39  	}
40  
41  	@Override
42  	public String getOperationCssAttr() {
43  		return "link";
44  	}
45  
46  	@Override
47  	public String getMessage(List<SVGElementModel> sourceElements) {
48  		return Format.substitute(ModelConstants.INSTANCE.dndLink(), getSourceElementNames(sourceElements));
49  	}
50  
51  	@Override
52  	public int getKeyCode() {
53  		return KeyCodes.KEY_ALT;
54  	}
55  
56  	@Override
57  	public void createCommands(List<SVGElementModel> sourceElements, SVGElementModel target, DropGesture dropGesture) {
58  		// TODO Auto-generated method stub
59  		
60  	}
61  
62  }