Author: yradtsevich
Date: 2010-03-26 10:43:50 -0400 (Fri, 26 Mar 2010)
New Revision: 21054
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-2buttons.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-4buttons.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-4button.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-8button.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1682/JBIDE-1682-with-popup.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/pickList/pickList.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DraggablePattern.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5042
Enhance DnD support in VPE:
- Now new Drag&Drop button is rendered over draggable elements.
- JUnit tests have been fixed according to changes in UI.
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-2buttons.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1579/JBIDE-1579-4buttons.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-4button.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-4button.xhtml 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-4button.xhtml 2010-03-26
14:43:50 UTC (rev 21054)
@@ -10,7 +10,7 @@
</head>
<body>
-<rich:listShuttle sourceValue="#{person.source}"
+<rich:listShuttle id="testElement" sourceValue="#{person.source}"
targetValue="#{person.target}" var="items"
targetListWidth="200"
sourceCaptionLabel="source label" targetCaptionLabel="target label"
orderControlsVerticalAlign="top" fastMoveControlsVisible="false"
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-8button.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-8button.xhtml 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1580/JBIDE-1580-8button.xhtml 2010-03-26
14:43:50 UTC (rev 21054)
@@ -10,7 +10,7 @@
</head>
<body>
-<rich:listShuttle sourceValue="#{person.source}"
+<rich:listShuttle id="testElement" sourceValue="#{person.source}"
targetValue="#{person.target}" var="items"
targetListWidth="200"
sourceCaptionLabel="source label" targetCaptionLabel="target label"
orderControlsVerticalAlign="top">
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml 2010-03-26
14:43:50 UTC (rev 21054)
@@ -16,6 +16,6 @@
<body>
<!-- Spacer component -->
-<rich:spacer width="720" height="50"
styleClass="spacerStyle"/>
+<rich:spacer id="testElement" width="720" height="50"
styleClass="spacerStyle"/>
</body>
</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1682/JBIDE-1682-with-popup.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/pickList/pickList.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/pickList/pickList.xhtml 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/pickList/pickList.xhtml 2010-03-26
14:43:50 UTC (rev 21054)
@@ -10,6 +10,6 @@
</head>
<body>
<!-- PickList -->
- <rich:pickList/>
+ <rich:pickList id="testElement"/>
</body>
</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -18,9 +18,14 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -31,6 +36,8 @@
* @author Eugene Stherbin
*/
public class RichFacesPickListTemplateTestCase extends VpeTest {
+ private static final String FILE_NAME = "components/pickList/pickList.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
/**
* The Constructor.
@@ -44,33 +51,45 @@
/**
* Test simple pick list.
*/
- public void testSimplePickList() {
- nsIDOMElement rst;
- try {
- rst = TestUtil.performTestForRichFacesComponent((IFile)
TestUtil.getComponentPath("components/pickList/pickList.xhtml", //$NON-NLS-1$
- RichFacesAllTests.IMPORT_PROJECT_NAME));
+ public void testSimplePickList() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME,
+ RichFacesAllTests.IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get dom document
+ nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
+ assertNotNull(document);
+
+ VpeController controller = TestUtil.getVpeController(part);
+
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
+ assertNotNull(element);
+
final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_TABLE);
+ TestUtil.findAllElementsByName(element, elements, HTML.TAG_TABLE);
assertEquals("Count of tables should be 3", 3, elements.size());
//$NON-NLS-1$
nsIDOMElement tableOne = (nsIDOMElement)
elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
assertEquals("Style class should be equals",
"rich-list-picklist", tableOne.getAttribute(HTML.ATTR_CLASS)); //$NON-NLS-1$
//$NON-NLS-2$
assertEquals("Style should be empty", "",
tableOne.getAttribute(HTML.ATTR_STYLE)); //$NON-NLS-1$ //$NON-NLS-2$
elements.clear();
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_DIV);
- assertEquals("Count of divs should be 18", 18, elements.size());
//$NON-NLS-1$
+ TestUtil.findAllElementsByName(element, elements, HTML.TAG_DIV);
+ assertEquals("Count of divs should be 15", 15, elements.size());
//$NON-NLS-1$
elements.clear();
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_IMG);
- assertEquals("Count of divs should be 18", 4, elements.size());
//$NON-NLS-1$
-
- } catch (CoreException e) {
- TestUtil.fail(e);
- } catch (Throwable e) {
- TestUtil.fail(e);
- }
-
+ TestUtil.findAllElementsByName(element, elements, HTML.TAG_IMG);
+ assertEquals("Count of img should be 4", 4, elements.size());
//$NON-NLS-1$
}
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -8,6 +8,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jsf.vpe.richfaces.test.RichFacesAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -19,6 +20,7 @@
private static final String TEST_PAGE_NAME_2BUTTONS =
"JBIDE/1579/JBIDE-1579-2buttons.xhtml";
private static final String TEST_PAGE_NAME_4BUTTONS =
"JBIDE/1579/JBIDE-1579-4buttons.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
public JBIDE1579Test(String name) {
super(name);
@@ -42,10 +44,9 @@
assertNotNull("Editor input is null", input);
// open and get editor
JSPMultiPageEditor part = openEditor(input);
+ VpeController controller = TestUtil.getVpeController(part);
- // get dom document
- nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
- nsIDOMElement element = document.getDocumentElement();
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
//check that element is not null
assertNotNull(element);
@@ -80,10 +81,9 @@
assertNotNull("Editor input is null", input);
// open and get editor
JSPMultiPageEditor part = openEditor(input);
+ VpeController controller = TestUtil.getVpeController(part);
- // get dom document
- nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
- nsIDOMElement element = document.getDocumentElement();
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
//check that element is not null
assertNotNull(element);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -21,6 +21,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jsf.vpe.richfaces.test.RichFacesAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -38,6 +39,7 @@
public static final String FILE_NAME1 =
"JBIDE/1580/JBIDE-1580-8button.xhtml";
public static final String FILE_NAME2 =
"JBIDE/1580/JBIDE-1580-4button.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
public Jbide1580Test(String name) {
super(name);
@@ -63,8 +65,9 @@
nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
assertNotNull(document);
- // get dom element
- nsIDOMElement element = document.getDocumentElement();
+ VpeController controller = TestUtil.getVpeController(part);
+
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
assertNotNull(element);
// get root node
@@ -105,8 +108,9 @@
nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
assertNotNull(document);
- // get dom element
- nsIDOMElement element = document.getDocumentElement();
+ VpeController controller = TestUtil.getVpeController(part);
+
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
assertNotNull(element);
// get root node
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -21,6 +21,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jsf.vpe.richfaces.test.RichFacesAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -37,6 +38,7 @@
public class Jbide1639Test extends VpeTest {
public static final String FILE_NAME = "JBIDE/1639/JBIDE-1639.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
public Jbide1639Test(String name) {
super(name);
@@ -62,23 +64,11 @@
nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
assertNotNull(document);
- // get dom element
- nsIDOMElement element = document.getDocumentElement();
- assertNotNull(element);
+ VpeController controller = TestUtil.getVpeController(part);
- // get root node
- nsIDOMNode node = (nsIDOMNode) element
- .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+ nsIDOMElement img = findElementById(controller, TEST_ELEMENT_ID);
+ Assert.assertTrue(HTML.TAG_IMG.equalsIgnoreCase(img.getNodeName()));
- List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- // find "img" elements
- TestUtil.findElementsByName(node, elements, HTML.TAG_IMG);
-
- Assert.assertEquals(1, elements.size());
-
- nsIDOMNode img = elements.get(0);
-
nsIDOMNamedNodeMap attributes = img.getAttributes();
// "img" must have attributes
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -11,6 +11,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jsf.vpe.richfaces.test.RichFacesAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -26,6 +27,7 @@
public static final String TEST_PAGE_WITH_POPUP =
"JBIDE/1682/JBIDE-1682-with-popup.xhtml";
public static final String TEST_PAGE_WITHOUT_POPUP =
"JBIDE/1682/JBIDE-1682-without-popup.xhtml";
+ private static final String TEST_ELEMENT_ID = "testElement";
public Jbide1682Test(String name) {
super(name);
@@ -50,9 +52,9 @@
// open and get editor
JSPMultiPageEditor part = openEditor(input);
- // get dom document
- nsIDOMDocument document = TestUtil.getVpeVisualDocument(part);
- nsIDOMElement element = document.getDocumentElement();
+ VpeController controller = TestUtil.getVpeController(part);
+
+ nsIDOMElement element = findElementById(controller, TEST_ELEMENT_ID);
//check that element is not null
assertNotNull(element);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DraggablePattern.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DraggablePattern.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DraggablePattern.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -18,6 +18,7 @@
import org.mozilla.interfaces.nsIDOMCSSStyleDeclaration;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMElementCSSInlineStyle;
+import org.mozilla.interfaces.nsIDOMMouseEvent;
import org.mozilla.interfaces.nsIDOMNode;
/**
@@ -86,6 +87,12 @@
return new DragIcon(dragIconElement);
}
+ public boolean isDragIconClicked(nsIDOMMouseEvent mouseEvent) {
+ nsIDOMNode targetNode = (nsIDOMNode) mouseEvent.getTarget()
+ .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+ return getDragIcon().getElement().equals(targetNode);
+ }
+
public nsIDOMNode getNode() {
return node;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -105,18 +105,17 @@
public VpeDnD(VpeController vpeController, MozillaEditor mozillaEditor) {
this.vpeController = vpeController;
- this.draggablePattern = new DraggablePattern(mozillaEditor);
+ draggablePattern = new DraggablePattern(mozillaEditor);
}
public void dragGesture(nsIDOMEvent domEvent) {
- nsIDOMMouseEvent mouseEvent = (nsIDOMMouseEvent) domEvent
- .queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
nsIDOMElement selectedElement = vpeController.getXulRunnerEditor()
.getLastSelectedElement();
- boolean canDragFlag = isDraggable(selectedElement);
// start drag sessionvpe-element
- if (canDragFlag) {
- startDragSession(domEvent);
+ if (isDraggable(selectedElement)) {
+ startDragSession(selectedElement);
+ domEvent.stopPropagation();
+ domEvent.preventDefault();
}
}
@@ -148,28 +147,34 @@
}
vpeController.onRefresh();
}
-
+
public void selectionChanged() {
-
+ nsIDOMElement selectedElement = vpeController.getXulRunnerEditor()
+ .getLastSelectedElement();
+ if (isDraggable(selectedElement)) {
+ draggablePattern.showDragIcon(selectedElement);
+ } else {
+ draggablePattern.hideDragIcon();
+ }
}
+ public boolean isDragIconClicked(nsIDOMMouseEvent mouseEvent) {
+ return draggablePattern.isDragIconClicked(mouseEvent);
+ }
+
/**
* Starts drag session
* @param dragetElement
*/
- private void startDragSession(nsIDOMEvent domEvent) {
+ private void startDragSession(nsIDOMNode node) {
nsISupportsArray transArray = (nsISupportsArray) getComponentManager()
- .createInstanceByContractID(XPCOM.NS_SUPPORTSARRAY_CONTRACTID, null,
- nsISupportsArray.NS_ISUPPORTSARRAY_IID);
+ .createInstanceByContractID(XPCOM.NS_SUPPORTSARRAY_CONTRACTID, null,
+ nsISupportsArray.NS_ISUPPORTSARRAY_IID);
transArray.appendElement(createTransferable());
- getDragService().invokeDragSession((nsIDOMNode)
domEvent.getTarget().queryInterface(nsIDOMNode.NS_IDOMNODE_IID), transArray, null,
+ getDragService().invokeDragSession(node, transArray, null,
nsIDragService.DRAGDROP_ACTION_MOVE
| nsIDragService.DRAGDROP_ACTION_COPY
| nsIDragService.DRAGDROP_ACTION_LINK);
-
- domEvent.stopPropagation();
- domEvent.preventDefault();
-
}
/**
@@ -896,7 +901,6 @@
}
return closestNode;
}
-
// this method is never used
// public VpeSourceInnerDropInfo canExternalDropMacro(XModelObject object, Node
parentNode, int offset) {
// String tagname = vpeController.getTagName(object);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -98,7 +98,6 @@
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
import org.jboss.tools.vpe.editor.mozilla.MozillaEventAdapter;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaContextMenuListener;
-import org.jboss.tools.vpe.editor.mozilla.listener.MozillaDndListener;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaKeyListener;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaMouseListener;
import org.jboss.tools.vpe.editor.mozilla.listener.MozillaResizeListener;
@@ -1195,13 +1194,7 @@
// drag gesture isn't generated in XR 1.9 for Linux Platforms,
// so we start it's manually
// mareshkau
- nsIDOMElement selectedElement = getXulRunnerEditor()
- .getLastSelectedElement();
- if (selectedElement != null
- && VpeVisualDomBuilder.inDragArea(
- XulRunnerVpeUtils.getElementBounds(
- selectedElement),
- VisualDomUtil.getMousePoint(mouseEvent))) {
+ if (vpeDnD.isDragIconClicked(mouseEvent)) {
vpeDnD.dragGesture(mouseEvent);
} else {
selectionManager.setSelection(mouseEvent);
@@ -1284,23 +1277,13 @@
}
public void mouseMove(nsIDOMMouseEvent mouseEvent) {
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
- return;
- }
- try {
- nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
- if (visualNode != null) {
- // if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- // System.out.println("<<< mouseMove visualNode: "
- // + visualNode.getNodeName() + " (" + visualNode
- // + ")");
- // }
- visualBuilder.setMoveCursor(mouseEvent);
- }
- } finally {
- switcher.stopActiveEditor();
- }
+// nsIDOMNode visualNode = VisualDomUtil.getTargetNode(mouseEvent);
+// if (visualNode != null) {
+// if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
+// System.out.println("<<< mouseMove visualNode: "
+// + visualNode.getNodeName() + " (" + visualNode + ")");
+// }
+// }
}
public void keyPress(nsIDOMKeyEvent keyEvent) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -78,7 +78,6 @@
import org.mozilla.interfaces.nsIDOMEvent;
import org.mozilla.interfaces.nsIDOMEventTarget;
import org.mozilla.interfaces.nsIDOMHTMLDocument;
-import org.mozilla.interfaces.nsIDOMMouseEvent;
import org.mozilla.interfaces.nsIDOMNSEvent;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
@@ -2044,21 +2043,6 @@
}
}
- void setMoveCursor(nsIDOMMouseEvent mouseEvent) {
- nsIDOMElement selectedElement = xulRunnerEditor
- .getLastSelectedElement();
- if (selectedElement != null && canInnerDrag(selectedElement)
- && inDragArea(getNodeBounds(selectedElement), VisualDomUtil
- .getMousePoint(mouseEvent))) {
- // change cursor
- showMoveCursor(true);
- //if mouse in drag area, and left button is pressed than we should
- //start drag session manually.
- } else {
- // change cursor style to normal
- showMoveCursor(false);
- }
- }
public static boolean inDragArea(Rectangle dragArea, Point mousePoint) {
// TODO add drag and drop support
@@ -2067,19 +2051,6 @@
&& mousePoint.y < (dragArea.y + DRAG_AREA_HEIGHT);
}
- nsIDOMElement getDragElement(nsIDOMMouseEvent mouseEvent) {
-
- nsIDOMElement selectedElement = xulRunnerEditor
- .getLastSelectedElement();
- if (selectedElement != null && canInnerDrag(selectedElement)) {
- if (inDragArea(getNodeBounds(selectedElement), VisualDomUtil
- .getMousePoint(mouseEvent))) {
- return selectedElement;
- }
- }
- return null;
- }
-
public nsIDOMNode getOriginalTargetNode(nsIDOMEvent event) {
nsIDOMNode targetNode = VisualDomUtil.getTargetNode(event);
if (HTML.TAG_INPUT.equalsIgnoreCase(targetNode.getNodeName())) {
@@ -2346,4 +2317,35 @@
return span;
}
+
+// this method is never used
+// void setMoveCursor(nsIDOMMouseEvent mouseEvent) {
+// nsIDOMElement selectedElement = xulRunnerEditor
+// .getLastSelectedElement();
+// if (selectedElement != null && canInnerDrag(selectedElement)
+// && inDragArea(getNodeBounds(selectedElement), VisualDomUtil
+// .getMousePoint(mouseEvent))) {
+// // change cursor
+// showMoveCursor(true);
+// //if mouse in drag area, and left button is pressed than we should
+// //start drag session manually.
+// } else {
+// // change cursor style to normal
+// showMoveCursor(false);
+// }
+// }
+
+// this method is never used
+// nsIDOMElement getDragElement(nsIDOMMouseEvent mouseEvent) {
+//
+// nsIDOMElement selectedElement = xulRunnerEditor
+// .getLastSelectedElement();
+// if (selectedElement != null && canInnerDrag(selectedElement)) {
+// if (inDragArea(getNodeBounds(selectedElement), VisualDomUtil
+// .getMousePoint(mouseEvent))) {
+// return selectedElement;
+// }
+// }
+// return null;
+// }
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -284,27 +284,6 @@
*
* @param controller
* @param elementId
- * @return
- */
- protected nsIDOMElement findElementById(VpeController controller,
- String elementId) {
-
- Element sourceElement = findSourceElementById(controller, elementId);
-
- VpeNodeMapping nodeMapping = controller.getDomMapping().getNodeMapping(
- sourceElement);
-
- if (nodeMapping == null)
- return null;
-
- return (nsIDOMElement) nodeMapping.getVisualNode();
- }
-
- /**
- * find visual element by "id" entered in source part of vpe
- *
- * @param controller
- * @param elementId
* @param idle try element for some time period, for example when we need
* to wait for refresh job
* @return
@@ -340,22 +319,9 @@
}
/**
- * find source element by "id"
*
- * @param controller
- * @param elementId
* @return
*/
- protected Element findSourceElementById(VpeController controller,
- String elementId) {
-
- return getSourceDocument(controller).getElementById(elementId);
- }
-
- /**
- *
- * @return
- */
abstract protected String getTestProjectName();
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-03-26
14:42:18 UTC (rev 21053)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-03-26
14:43:50 UTC (rev 21054)
@@ -45,8 +45,10 @@
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
+import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -375,4 +377,38 @@
final VpeController vpeController = TestUtil.getVpeController(part);
return vpeController;
}
+
+ /**
+ * find source element by "id"
+ *
+ * @param controller
+ * @param elementId
+ * @return
+ */
+ protected Element findSourceElementById(VpeController controller,
+ String elementId) {
+
+ return getSourceDocument(controller).getElementById(elementId);
+ }
+
+ /**
+ * find visual element by "id" entered in source part of vpe
+ *
+ * @param controller
+ * @param elementId
+ * @return
+ */
+ protected nsIDOMElement findElementById(VpeController controller,
+ String elementId) {
+
+ Element sourceElement = findSourceElementById(controller, elementId);
+
+ VpeNodeMapping nodeMapping = controller.getDomMapping().getNodeMapping(
+ sourceElement);
+
+ if (nodeMapping == null)
+ return null;
+
+ return (nsIDOMElement) nodeMapping.getVisualNode();
+ }
}