Author: ayukhovich
Date: 2007-08-21 06:59:53 -0400 (Tue, 21 Aug 2007)
New Revision: 3249
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-742
add functionality of resizing
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-08-21
10:59:44 UTC (rev 3248)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-08-21
10:59:53 UTC (rev 3249)
@@ -11,18 +11,13 @@
package org.jboss.tools.vpe.editor.mozilla;
import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.xulrunner.editor.IVpeResizeListener;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIClipboardDragDropHooks;
-import org.mozilla.interfaces.nsIDOMCSSStyleDeclaration;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMElementCSSInlineStyle;
import org.mozilla.interfaces.nsIDOMEvent;
import org.mozilla.interfaces.nsIDOMEventListener;
import org.mozilla.interfaces.nsIDOMKeyEvent;
import org.mozilla.interfaces.nsIDOMMouseEvent;
-import org.mozilla.interfaces.nsIDOMNSHTMLElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDragSession;
import org.mozilla.interfaces.nsISelection;
@@ -34,7 +29,6 @@
class MozillaDomEventListener implements nsIClipboardDragDropHooks,
nsIDOMEventListener, nsISelectionListener {
- private IVpeResizeListener resizeListener;
// TODO Max Areshkau add DnD
// private XPCOMObject dropListener;
@@ -63,18 +57,6 @@
}
void createCOMInterfaces() {
- resizeListener = new IVpeResizeListener() {
- public void onEndResizing(int usedResizeMarkerHandle, int top,
- int left, int width, int height,
- nsIDOMElement resizedDomElement) {
- endResizing(usedResizeMarkerHandle, top, left, width, height, resizedDomElement);
- }
-
- public nsISupports queryInterface(String uuid) {
- // TODO Auto-generated method stub
- return null;
- }
- };
// TODO Max Areshkau add DnD
// VpeDnD
@@ -93,10 +75,6 @@
}
void disposeCOMInterfaces() {
- if (resizeListener != null) {
- resizeListener = null;
- }
-
// TODO Max Areshakau add DnD
// if (dropListener != null) {
// dropListener.dispose();
@@ -118,22 +96,7 @@
editorDomEventListener = listener;
}
- /**
- * @param usedHandle
- * @param newTop
- * @param newLeft
- * @param newWidth
- * @param newHeight
- * @param aResizedObject
- */
- private void endResizing(int usedHandle, int newTop, int newLeft, int newWidth, int
newHeight, nsIDOMElement aResizedObject) {
- setStylePropertyPixels(aResizedObject, "top", newTop);
- setStylePropertyPixels(aResizedObject, "left", newLeft);
- setStylePropertyPixels(aResizedObject, "height", newHeight);
- setStylePropertyPixels(aResizedObject, "width", newWidth);
- }
-
/**
* Returns event handler
* @return
@@ -405,46 +368,4 @@
editorDomEventListener.notifySelectionChanged(domDocument, selection, reason);
}
}
-
-
- /**
- *
- * @param aElement
- * @param aProperty
- * @param aValue
- */
- private void setStylePropertyPixels(nsIDOMElement aElement, String aProperty, int
aValue) {
- setStyle(aElement, aProperty, aValue + "px");
- }
-
-
- /**
- * Set style for nsIDOMElement
- * @param domElement
- * @param cssPropertyName
- * @param cssPropertyValue
- */
- private void setStyle(nsIDOMElement domElement, String cssPropertyName, String
cssPropertyValue) {
- nsIDOMElementCSSInlineStyle inlineStyles = (nsIDOMElementCSSInlineStyle)
domElement.queryInterface(nsIDOMElementCSSInlineStyle.NS_IDOMELEMENTCSSINLINESTYLE_IID);
-
- if ( inlineStyles == null) {
- return;
- }
-
- nsIDOMCSSStyleDeclaration cssDecl = inlineStyles.getStyle();
-
- if ( cssDecl == null) {
- return;
- }
-
- if (cssPropertyValue.length() == 0 ) {
- // an empty value means we have to remove the property
- cssDecl.removeProperty(cssPropertyName);
- } else {
- // let's recreate the declaration as it was
- String priority = cssDecl.getPropertyPriority(cssPropertyName);
- cssDecl.setProperty(cssPropertyName, cssPropertyValue, priority);
- }
- }
-
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-08-21
10:59:44 UTC (rev 3248)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-08-21
10:59:53 UTC (rev 3249)
@@ -521,17 +521,21 @@
}
}
+ /**
+ * Show resizer markers
+ */
public void showResizer() {
if (contentAreaEventListener != null) {
- // TODO Alexey Yukhovich add resizer support
- // xulRunnerEditor.showResizer();
+ xulRunnerEditor.showResizer();
}
}
+ /**
+ * Hide resizer markers
+ */
public void hideResizer() {
if (contentAreaEventListener != null) {
- // TODO Alexey Yukhovich add resizer support
-//s xulRunnerEditor.hideResizer();
+ xulRunnerEditor.hideResizer();
}
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-08-21
10:59:44 UTC (rev 3248)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-08-21
10:59:53 UTC (rev 3249)
@@ -770,10 +770,10 @@
if (inlineTags.contains(visualElement.getNodeName().toLowerCase())) {
tagDescription.setDisplayType(VpeTagDescription.DISPLAY_TYPE_INLINE);
}
- // TODO Alexey Yukhovich add DnD support
-// if (resizer != null) {
-// resizer.modifyTagDescription(tagDescription);
-// }
+
+ if (resizer != null) {
+ resizer.modifyTagDescription(tagDescription);
+ }
return tagDescription;
}