Author: ayukhovich
Date: 2007-08-17 09:28:15 -0400 (Fri, 17 Aug 2007)
New Revision: 3218
Added:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IXulRunnerVpeResizer.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java
Removed:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/DOMElementUtils.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/ElementPositionAndDimention.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizeListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseMotionListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
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
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTagDescription.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-742
Initial restoring functionality of resizing and fixing header
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-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -11,9 +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;
@@ -30,8 +34,7 @@
class MozillaDomEventListener implements nsIClipboardDragDropHooks,
nsIDOMEventListener, nsISelectionListener {
- // TODO Alexey Yukhovich add resizer
-// private XPCOMObject resizeListener;
+ private IVpeResizeListener resizeListener;
// TODO Max Areshkau add DnD
// private XPCOMObject dropListener;
@@ -60,14 +63,18 @@
}
void createCOMInterfaces() {
- // TODO Alexey Yukhovich add resizer
- // IVpeResizeListener
-// resizeListener = new XPCOMObject(new int[]{2,0,0,6}) {
-// public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
-// public int method1(int[] args) {return AddRef();}
-// public int method2(int[] args) {return Release();}
-// public int method3(int[] args) {return EndResizing(args[0], args[1], args[2],
args[3], args[4], args[5]);}
-// };
+ 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
@@ -86,11 +93,9 @@
}
void disposeCOMInterfaces() {
- // TODO Alexey Yukhovich add resizer
-// if (resizeListener != null) {
-// resizeListener.dispose();
-// resizeListener = null;
-// }
+ if (resizeListener != null) {
+ resizeListener = null;
+ }
// TODO Max Areshakau add DnD
// if (dropListener != null) {
@@ -114,6 +119,22 @@
}
/**
+ * @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
*/
@@ -121,12 +142,6 @@
return editorDomEventListener;
}
- // TODO Alexey Yukhovich add resizer support
-// // IVpeResizeListener
-// int EndResizing(int usedHandle, int newTop, int newLeft, int newWidth, int newHeight,
int aResizedObject) {
-// nsIDOMElement element = new nsIDOMElement(aResizedObject);
-// return XPCOM.NS_OK;
-// }
// TODO Max Areshkau add DnD support
// VpeDnD getDnD() {
@@ -392,4 +407,46 @@
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-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -562,14 +562,14 @@
public void showResizer() {
if (contentAreaEventListener != null) {
// TODO Alexey Yukhovich add resizer support
-// visualEditor.showResizer();
+ // xulRunnerEditor.showResizer();
}
}
public void hideResizer() {
if (contentAreaEventListener != null) {
// TODO Alexey Yukhovich add resizer support
-// visualEditor.hideResizer();
+//s 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-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -25,7 +25,6 @@
import org.jboss.tools.vpe.editor.VpeSourceInnerDropInfo;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
-import org.jboss.tools.vpe.editor.template.dnd.VpeDnd;
import org.jboss.tools.vpe.editor.template.resize.VpeResizer;
import org.jboss.tools.vpe.editor.template.textformating.TextFormatingData;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -45,8 +44,9 @@
protected boolean haveVisualPreview;
- // TODO Alexey Yukhovich add resizer support
-// private VpeResizer resizer;\
+ /** a resizer instance */
+ private VpeResizer resizer;
+
// TODO Max Areshkau add DnD support
// private VpeDnd dragger;
private TextFormatingData textFormatingData;
@@ -66,7 +66,7 @@
private int breakerType = BREAKER_TYPE_NONE;
- static private HashSet inlineTags = new HashSet();
+ static private HashSet<String> inlineTags = new HashSet<String>();
static{
inlineTags.add("b");
inlineTags.add("i");
@@ -83,7 +83,7 @@
inlineTags.add("button");
inlineTags.add("label");
}
- static private HashMap tagResizeConstrans = new HashMap();
+ static private HashMap<String, Integer> tagResizeConstrans = new
HashMap<String, Integer>();
static{
tagResizeConstrans.put("table", new
Integer(VpeTagDescription.RESIZE_CONSTRAINS_ALL));
tagResizeConstrans.put("tr", new
Integer(VpeTagDescription.RESIZE_CONSTRAINS_ALL));
@@ -97,7 +97,8 @@
tagResizeConstrans.put("font", new
Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
tagResizeConstrans.put("a", new
Integer(VpeTagDescription.RESIZE_CONSTRAINS_NONE));
}
- static private HashSet breakWithParagraphTags = new HashSet();
+
+ static private HashSet<String> breakWithParagraphTags = new
HashSet<String>();
static{
breakWithParagraphTags.add("b");
breakWithParagraphTags.add("a");
@@ -127,7 +128,7 @@
breakWithParagraphTags.add("u");
breakWithParagraphTags.add("var");
}
- static private HashSet breakWithoutParagraphTags = new HashSet();
+ static private HashSet<String> breakWithoutParagraphTags = new
HashSet<String>();
static{
breakWithoutParagraphTags.add("p");
breakWithoutParagraphTags.add("address");
@@ -202,11 +203,10 @@
}
private void initResizeHandler(Element templateSection) {
- // TODO Alexey Yukhovich add resizer support
-// if (resizer == null) {
-// resizer = new VpeResizer();
-// resizer.setResizeData(templateSection);
-// }
+ if (resizer == null) {
+ resizer = new VpeResizer();
+ resizer.setResizeData(templateSection);
+ }
}
private void initDndHandler(Element templateSection) {
@@ -647,10 +647,9 @@
* @param height Element height
*/
public void resize(VpePageContext pageContext, Element sourceElement, nsIDOMDocument
visualDocument, nsIDOMElement visualElement, Object data, int resizerConstrains, int top,
int left, int width, int height) {
- // TODO Alexey Yukhovich add resizer supports
-// if (resizer != null) {
-// resizer.resize(pageContext, sourceElement, visualDocument, visualElement, data,
resizerConstrains, top, left, width, height);
-// }
+ if (resizer != null) {
+ resizer.resize(pageContext, sourceElement, visualDocument, visualElement, data,
resizerConstrains, top, left, width, height);
+ }
}
/**
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTagDescription.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTagDescription.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTagDescription.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -10,32 +10,21 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.template;
-// TODO Alexey Yukhovich add resizer support
-//import org.jboss.tools.vpe.mozilla.internal.swt.xpl.VpeResizer;
+import org.jboss.tools.vpe.xulrunner.editor.IXulRunnerVpeResizer;
public class VpeTagDescription {
public static final int DISPLAY_TYPE_NONE = 0;
public static final int DISPLAY_TYPE_BLOCK = 1;
public static final int DISPLAY_TYPE_INLINE = 2;
- // TODO Alexey Yukhovich add resuzer support
-// public static final int RESIZE_CONSTRAINS_TOPLEFT = VpeResizer.eTopLeft;
-// public static final int RESIZE_CONSTRAINS_TOP = VpeResizer.eTop;
-// public static final int RESIZE_CONSTRAINS_TOPRIGHT = VpeResizer.eTopRight;
-// public static final int RESIZE_CONSTRAINS_LEFT = VpeResizer.eLeft;
-// public static final int RESIZE_CONSTRAINS_RIGHT = VpeResizer.eRight;
-// public static final int RESIZE_CONSTRAINS_BOTTOMLEFT = VpeResizer.eBottomLeft;
-// public static final int RESIZE_CONSTRAINS_BOTTOM = VpeResizer.eBottom;
-// public static final int RESIZE_CONSTRAINS_BOTTOMRIGHT = VpeResizer.eBottomRight;
- // TODO Alexey Yukhovich restore above resizer constraints
- public static final int RESIZE_CONSTRAINS_TOPLEFT = 1;
- public static final int RESIZE_CONSTRAINS_TOP = 2;
- public static final int RESIZE_CONSTRAINS_TOPRIGHT = 4;
- public static final int RESIZE_CONSTRAINS_LEFT = 8;
- public static final int RESIZE_CONSTRAINS_RIGHT = 16;
- public static final int RESIZE_CONSTRAINS_BOTTOMLEFT = 32;
- public static final int RESIZE_CONSTRAINS_BOTTOM = 64;
- public static final int RESIZE_CONSTRAINS_BOTTOMRIGHT = 128;
+ public static final int RESIZE_CONSTRAINS_TOPLEFT =
IXulRunnerVpeResizer.RESIZER_MARKER_TOPLEFT;
+ public static final int RESIZE_CONSTRAINS_TOP =
IXulRunnerVpeResizer.RESIZER_MARKER_TOP;
+ public static final int RESIZE_CONSTRAINS_TOPRIGHT =
IXulRunnerVpeResizer.RESIZER_MARKER_TOPRIGHT;
+ public static final int RESIZE_CONSTRAINS_LEFT =
IXulRunnerVpeResizer.RESIZER_MARKER_LEFT;
+ public static final int RESIZE_CONSTRAINS_RIGHT =
IXulRunnerVpeResizer.RESIZER_MARKER_RIGHT;
+ public static final int RESIZE_CONSTRAINS_BOTTOMLEFT =
IXulRunnerVpeResizer.RESIZER_MARKER_BOTTOMLEFT;
+ public static final int RESIZE_CONSTRAINS_BOTTOM =
IXulRunnerVpeResizer.RESIZER_MARKER_BOTTOM;
+ public static final int RESIZE_CONSTRAINS_BOTTOMRIGHT =
IXulRunnerVpeResizer.RESIZER_MARKER_BOTTOMRIGHT;
public static final int RESIZE_CONSTRAINS_NONE = 0;
public static final int RESIZE_CONSTRAINS_ALL = RESIZE_CONSTRAINS_TOPLEFT |
RESIZE_CONSTRAINS_TOP | RESIZE_CONSTRAINS_TOPRIGHT | RESIZE_CONSTRAINS_LEFT |
RESIZE_CONSTRAINS_RIGHT | RESIZE_CONSTRAINS_BOTTOMLEFT | RESIZE_CONSTRAINS_BOTTOM |
RESIZE_CONSTRAINS_BOTTOMRIGHT;
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -10,11 +10,6 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.template.resize;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeTagDescription;
@@ -25,27 +20,32 @@
import org.jboss.tools.vpe.editor.template.expression.VpeValue;
import org.jboss.tools.vpe.editor.util.SourceDomUtil;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
-// "position:absolute; top:200px; left:100px"
-
+/**
+ *
+ */
public class VpeResizer {
- static final String TAG_WIDTH = VpeTemplateManager.VPE_PREFIX + "width";
- static final String TAG_HEIGHT = VpeTemplateManager.VPE_PREFIX + "height";
+ /** TAG_WIDTH */
+ private static final String TAG_WIDTH = VpeTemplateManager.VPE_PREFIX +
"width";
- static final String ATTRIBUTE_WIDTH = "width-attr";
- static final String ATTRIBUTE_HEIGHT = "height-attr";
- static final String ATTRIBUTE_TAG_XPATH = "tag-xpath";
- static final String ATTRIBUTE_TEST = "test";
- static final String ATTRIBUTE_DISABLE_ABSOLUTE_POSITION =
"disable-absolute-position";
+ /** TAG_HEIGHT */
+ private static final String TAG_HEIGHT = VpeTemplateManager.VPE_PREFIX +
"height";
- private TemplateResizeData horizontalData = null;
- private TemplateResizeData verticalData = null;
+ private static final String ATTRIBUTE_WIDTH =
"width-attr";
+ private static final String ATTRIBUTE_HEIGHT =
"height-attr";
+ private static final String ATTRIBUTE_TAG_XPATH =
"tag-xpath";
+ private static final String ATTRIBUTE_TEST = "test";
+ private static final String ATTRIBUTE_DISABLE_ABSOLUTE_POSITION =
"disable-absolute-position";
- public VpeResizer(){
-
- }
+ private TemplateResizeData horizontalData;
+ private TemplateResizeData verticalData;
- public void setResizeData(Element node){
+ public void setResizeData(Element node) {
TemplateResizeData resizeWidth = null;
TemplateResizeData resizeHeight = null;
@@ -79,8 +79,21 @@
}
}
}
-
- public void resize(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Element visualElement, Object data, int resizeConstrant, int top, int
left, int width, int height) {
+
+ /**
+ *
+ * @param pageContext
+ * @param sourceElement
+ * @param visualDocument
+ * @param visualElement
+ * @param data
+ * @param resizeConstrant
+ * @param top
+ * @param left
+ * @param width
+ * @param height
+ */
+ public void resize(VpePageContext pageContext, Element sourceElement, nsIDOMDocument
visualDocument, nsIDOMElement visualElement, Object data, int resizeConstrant, int top,
int left, int width, int height) {
pageContext.getEditPart().getSourceEditor().getTextViewer().getUndoManager().beginCompoundChange();
if (pageContext.isAbsolutePosition() && (
resizeConstrant == VpeTagDescription.RESIZE_CONSTRAINS_BOTTOMLEFT||
@@ -104,6 +117,7 @@
runResize(pageContext, sourceElement, false, top, height, verticalData);
}
}
+
pageContext.getEditPart().getSourceEditor().getTextViewer().getUndoManager().endCompoundChange();
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/DOMElementUtils.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/DOMElementUtils.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/DOMElementUtils.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.vpe.xulrunner.editor;
import org.mozilla.interfaces.nsIDOMElement;
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/ElementPositionAndDimention.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/ElementPositionAndDimention.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/ElementPositionAndDimention.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.vpe.xulrunner.editor;
/**
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizeListener.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizeListener.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizeListener.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.vpe.xulrunner.editor;
import org.mozilla.interfaces.nsIDOMElement;
Deleted:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -1,84 +0,0 @@
-package org.jboss.tools.vpe.xulrunner.editor;
-
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMEvent;
-
-/**
- * IVpeResize interface class
- * @author A. Yukhovich
- */
-public interface IVpeResizer {
- /** RESIZER_MARKER_TOPLEFT */
- final static public int RESIZER_MARKER_TOPLEFT = 1;
-
- /** RESIZER_MARKER_TOP */
- final static public int RESIZER_MARKER_TOP = 2;
-
- /** RESIZER_MARKER_TOPRIGHT */
- final static public int RESIZER_MARKER_TOPRIGHT = 4;
-
- /** RESIZER_MARKER_LEFT */
- final static public int RESIZER_MARKER_LEFT = 8;
-
- /** RESIZER_MARKER_RIGHT */
- final static public int RESIZER_MARKER_RIGHT = 16;
-
- /** RESIZER_MARKER_BOTTOMLEFT */
- final static public int RESIZER_MARKER_BOTTOMLEFT = 32;
-
- /** RESIZER_MARKER_BOTTOM */
- final static public int RESIZER_MARKER_BOTTOM = 64;
-
- /** RESIZER_MARKER_BOTTOMRIGHT */
- final static public int RESIZER_MARKER_BOTTOMRIGHT = 128;
-
-
- public void init(nsIDOMDocument domDocument);
-
- /**
- * Show resize markers
- * @param domElement
- * @param resizers
- */
- public void show(nsIDOMElement domElement, int resizers);
-
- /**
- * Hide resize markers
- */
- public void hide();
-
- /**
- * Event handler MouseDown
- * @param clientX
- * @param clientY
- * @param domElement a target nsIDOMElement
- */
- public void mouseDown(int clientX, int clientY, nsIDOMElement domElement);
-
- /**
- * Event handler MouseMove
- * @param event
- */
- public void mouseMove(nsIDOMEvent event);
-
- /**
- * Event handler MouseUp
- * @param clientX
- * @param clientY
- * @param target a target nsIDOMElement
- */
- public void mouseUp(int clientX, int clientY, nsIDOMElement target);
-
- /**
- * add resize listener to queue
- * @param aListener a IVpeResizeListener object
- */
- public void addResizeListener(IVpeResizeListener aListener);
-
- /**
- * remove resize listener from queue
- * @param aListener a IVpeResizeListener object
- */
- public void removeResizeListener(IVpeResizeListener aListener);
-}
Copied:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IXulRunnerVpeResizer.java
(from rev 3200,
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IVpeResizer.java)
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IXulRunnerVpeResizer.java
(rev 0)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/IXulRunnerVpeResizer.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.vpe.xulrunner.editor;
+
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMEvent;
+
+/**
+ * IXulRunnerVpeResizer interface class
+ * @author A. Yukhovich
+ */
+public interface IXulRunnerVpeResizer {
+ /** RESIZER_MARKER_TOPLEFT */
+ final static public int RESIZER_MARKER_TOPLEFT = 1;
+
+ /** RESIZER_MARKER_TOP */
+ final static public int RESIZER_MARKER_TOP = 2;
+
+ /** RESIZER_MARKER_TOPRIGHT */
+ final static public int RESIZER_MARKER_TOPRIGHT = 4;
+
+ /** RESIZER_MARKER_LEFT */
+ final static public int RESIZER_MARKER_LEFT = 8;
+
+ /** RESIZER_MARKER_RIGHT */
+ final static public int RESIZER_MARKER_RIGHT = 16;
+
+ /** RESIZER_MARKER_BOTTOMLEFT */
+ final static public int RESIZER_MARKER_BOTTOMLEFT = 32;
+
+ /** RESIZER_MARKER_BOTTOM */
+ final static public int RESIZER_MARKER_BOTTOM = 64;
+
+ /** RESIZER_MARKER_BOTTOMRIGHT */
+ final static public int RESIZER_MARKER_BOTTOMRIGHT = 128;
+
+
+ public void init(nsIDOMDocument domDocument);
+
+ /**
+ * Show resize markers
+ * @param domElement
+ * @param resizers
+ */
+ public void show(nsIDOMElement domElement, int resizers);
+
+ /**
+ * Hide resize markers
+ */
+ public void hide();
+
+ /**
+ * Event handler MouseDown
+ * @param clientX
+ * @param clientY
+ * @param domElement a target nsIDOMElement
+ */
+ public void mouseDown(int clientX, int clientY, nsIDOMElement domElement);
+
+ /**
+ * Event handler MouseMove
+ * @param event
+ */
+ public void mouseMove(nsIDOMEvent event);
+
+ /**
+ * Event handler MouseUp
+ * @param clientX
+ * @param clientY
+ * @param target a target nsIDOMElement
+ */
+ public void mouseUp(int clientX, int clientY, nsIDOMElement target);
+
+ /**
+ * add resize listener to queue
+ * @param aListener a IVpeResizeListener object
+ */
+ public void addResizeListener(IVpeResizeListener aListener);
+
+ /**
+ * remove resize listener from queue
+ * @param aListener a IVpeResizeListener object
+ */
+ public void removeResizeListener(IVpeResizeListener aListener);
+}
Deleted:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -1,790 +0,0 @@
-package org.jboss.tools.vpe.xulrunner.editor;
-
-import java.util.ArrayList;
-
-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.nsIDOMEventTarget;
-import org.mozilla.interfaces.nsIDOMHTMLDocument;
-import org.mozilla.interfaces.nsIDOMHTMLElement;
-import org.mozilla.interfaces.nsIDOMMouseEvent;
-import org.mozilla.interfaces.nsIDOMNode;
-
-/**
- * IVPEResizer implementation
- * @author A. Yukhovich
- */
-public class VpeResizer implements IVpeResizer {
- /** COEFFICIENT_TYPE */
- enum COEFFICIENT_TYPE { X, Y, WIDTH, HEIGHT };
-
-
- /** RESIZER_MARKER_STRING_TOPLEFT */
- final static private String RESIZER_MARKER_STRING_TOPLEFT = "nw";
-
- /** RESIZER_MARKER_STRING_TOP */
- final static private String RESIZER_MARKER_STRING_TOP = "n";
-
- /** RESIZER_MARKER_STRING_TOPRIGHT */
- final static private String RESIZER_MARKER_STRING_TOPRIGHT = "ne";
-
- /** RESIZER_MARKER_STRING_LEFT */
- final static private String RESIZER_MARKER_STRING_LEFT = "w";
-
- /** RESIZER_MARKER_STRING_BOTTOMLEFT */
- final static private String RESIZER_MARKER_STRING_RIGHT = "e";
-
- /** RESIZER_MARKER_STRING_BOTTOMLEFT */
- final static private String RESIZER_MARKER_STRING_BOTTOMLEFT = "sw";
-
- /** RESIZER_MARKER_STRING_BOTTOM */
- final static private String RESIZER_MARKER_STRING_BOTTOM = "s";
-
- /** RESIZER_MARKER_STRING_BOTTOMRIGHT */
- final static private String RESIZER_MARKER_STRING_BOTTOMRIGHT = "se";
-
- /** MAX_SIZE */
- final static private int MAX_SIZE = 20000000;
-
-
- nsIDOMEventListener mouseListener;
- nsIDOMEventListener mouseMotionListener;
-
-
- private ArrayList<IVpeResizeListener> objectResizeEventListeners = new
ArrayList<IVpeResizeListener>();
-
- private boolean isResizing;
- private int originalX;
- private int originalY;
-
- private int usedEResizeMarkerHandle;
-
- private int incrementFactorX;
- private int incrementFactorY;
- private int incrementFactorWidth;
- private int incrementFactorHeight;
-
-
- /** resizingObject */
- private nsIDOMElement resizingObject;
-
- /** resizingShadow */
- private nsIDOMElement resizingShadow;
-
- /** domDocument */
- private nsIDOMDocument domDocument;
-
- private nsIDOMElement activeHandle;
-
- private ElementPositionAndDimention elementPositionAndDimention;
-
- /** resizer marker top-left */
- private nsIDOMElement markerTopLeft = null;
-
- /** resizer marker top */
- private nsIDOMElement markerTop = null;
-
- /** resizer marker top-right */
- private nsIDOMElement markerTopRight = null;
-
- /** resizer marker left */
- private nsIDOMElement markerLeft = null;
-
- /** resizer marker right */
- private nsIDOMElement markerRight = null;
-
- /** resizer marker bottom */
- private nsIDOMElement markerBottom = null;
-
- /** resizer marker bottom-left */
- private nsIDOMElement markerBottomLeft = null;
-
- /** resizer marker bottom-right */
- private nsIDOMElement markerBottomRight = null;
-
-
- /**
- *
- * @param domDocument
- */
- public void init(nsIDOMDocument domDocument)
- {
-
- this.domDocument = domDocument;
-
- mouseListener = new VpeResizerMouseListener(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
org.jboss.vpe.mozilla.resizer.IVpeResizer#show(org.mozilla.interfaces.nsIDOMElement,
- * int)
- */
- public void show(nsIDOMElement domElement, int resizers) {
- resizingObject = domElement;
-
- elementPositionAndDimention =
DOMElementUtils.getElementPositionAndDimention(domElement);
-
- if ((elementPositionAndDimention.getWidth() <= 0) ||
- (elementPositionAndDimention.getWidth() > MAX_SIZE) ||
- (elementPositionAndDimention.getHeight() <= 0) ||
- (elementPositionAndDimention.getHeight() > MAX_SIZE)) return;
-
- nsIDOMElement bodyElement = getRootElement();
-
- if (bodyElement == null ) return;
-
- if ((resizers & RESIZER_MARKER_TOPLEFT) == RESIZER_MARKER_TOPLEFT) {
- markerTopLeft = createResizer( RESIZER_MARKER_STRING_TOPLEFT, bodyElement);
- if (markerTopLeft == null) {
- return ;
- }
- }
-
- if ((resizers & RESIZER_MARKER_TOP) == RESIZER_MARKER_TOP) {
- markerTop = createResizer( RESIZER_MARKER_STRING_TOP, bodyElement);
- if (markerTop == null) {
- return ;
- }
- }
-
- if ((resizers & RESIZER_MARKER_TOPRIGHT) == RESIZER_MARKER_TOPRIGHT) {
- markerTopRight = createResizer(RESIZER_MARKER_STRING_TOPRIGHT, bodyElement);
- if (markerTopRight == null) {
- return ;
- }
- }
-
- if ((resizers & RESIZER_MARKER_LEFT) == RESIZER_MARKER_LEFT) {
- markerLeft = createResizer(RESIZER_MARKER_STRING_LEFT, bodyElement);
- if (markerLeft == null) {
- return ;
- }
- }
-
- if ((resizers & RESIZER_MARKER_RIGHT) == RESIZER_MARKER_RIGHT) {
- markerRight = createResizer(RESIZER_MARKER_STRING_RIGHT, bodyElement);
- if (markerRight == null) {
- return ;
- }
- }
-
- if ((resizers & RESIZER_MARKER_BOTTOMLEFT) == RESIZER_MARKER_BOTTOMLEFT) {
- markerBottomLeft = createResizer(RESIZER_MARKER_STRING_BOTTOMLEFT, bodyElement);
- if (markerBottomLeft == null) {
- return ;
- }
- }
-
- if ((resizers & RESIZER_MARKER_BOTTOM) == RESIZER_MARKER_BOTTOM) {
- markerBottom = createResizer(RESIZER_MARKER_STRING_BOTTOM, bodyElement);
- if (markerBottom == null) {
- return ;
- }
- }
-
- if ((resizers & RESIZER_MARKER_BOTTOMRIGHT) == RESIZER_MARKER_BOTTOMRIGHT) {
- markerBottomRight = createResizer(RESIZER_MARKER_STRING_BOTTOMRIGHT, bodyElement);
- if (markerBottomRight == null) {
- return ;
- }
- }
-
- setAllResizersPosition();
-
- resizingShadow = createShadow(bodyElement, resizingObject);
-
- setShadowPosition(resizingShadow, elementPositionAndDimention.getLeft(),
elementPositionAndDimention.getTop());
- }
-
-
- /* (non-Javadoc)
- * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#hide()
- */
- public void hide()
- {
- nsIDOMElement bodyElement;
-
- bodyElement = getRootElement();
- if ( bodyElement == null ) {
- return;
- }
-
- nsIDOMNode parentNode = (nsIDOMNode)
bodyElement.queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
-
- if ( parentNode == null) {
- return;
- }
-
- if ( markerTopLeft != null) {
- parentNode.removeChild(markerTopLeft);
- }
-
- if ( markerTop != null) {
- parentNode.removeChild(markerTop);
- }
-
-
- if ( markerTopRight != null) {
- parentNode.removeChild(markerTopRight);
- }
-
- if ( markerLeft != null) {
- parentNode.removeChild(markerLeft);
- }
-
- if ( markerRight != null) {
- parentNode.removeChild(markerRight);
- }
-
- if ( markerBottomLeft != null) {
- parentNode.removeChild(markerBottomLeft);
- }
-
- if ( markerBottom != null) {
- parentNode.removeChild(markerBottom);
- }
-
- if ( markerBottomRight != null) {
- parentNode.removeChild(markerBottomRight);
- }
-
-
- if ( resizingShadow != null ) {
- parentNode.removeChild(resizingShadow);
- }
-
- markerBottom = null;
- markerTop = null;
- markerLeft = null;
- markerRight = null;
- markerBottomRight = null;
- markerBottomLeft = null;
- markerTopRight = null;
- markerTopLeft = null;
-
- resizingShadow = null;
- resizingObject = null;
- }
-
-
- /* (non-Javadoc)
- * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseDown(int, int,
org.mozilla.interfaces.nsIDOMElement)
- */
- public void mouseDown(int clientX, int clientY, nsIDOMElement domElement) {
-
-
- if ( domElement != null ) {
-
- boolean isAnonElement =
domElement.hasAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS);
-
- if (isAnonElement) {
- String anonclass = domElement.getAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS);
-
- if ( anonclass != null ) {
- if ( anonclass.equals(XulRunnerConstants.VPE_CLASSNAME_MOZ_RESIZER) ) {
- originalX = clientX;
- originalY = clientY;
- startResizing(domElement);
- } // if
- } // if
- } // if
- } // if
- }
-
-
- /* (non-Javadoc)
- * @see
org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseMove(org.mozilla.interfaces.nsIDOMEvent)
- */
- public void mouseMove(nsIDOMEvent event) {
- if (isResizing) {
- nsIDOMMouseEvent mouseEvent =
(nsIDOMMouseEvent)event.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
- int clientX, clientY;
-
- clientX = mouseEvent.getClientX();
- clientY = mouseEvent.getClientY();
-
- int newX = getNewResizingX(clientX, clientY);
- int newY = getNewResizingY(clientX, clientY);
- int newWidth = getNewResizingWidth(clientX, clientY);
- int newHeight = getNewResizingHeight(clientX, clientY);
-
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_LEFT, newX);
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_TOP, newY);
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_WIDTH, newWidth);
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_HEIGHT,
newHeight);
- } // if
- }
-
-
- /* (non-Javadoc)
- * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseUp(int, int,
org.mozilla.interfaces.nsIDOMElement)
- */
- public void mouseUp(int aX, int aY, nsIDOMElement target) {
- if (isResizing) {
- isResizing = false;
-
-
- hideShadow();
- endResizing(aX, aY);
-
- nsIDOMEventTarget erP = getDOMEventTarget();
-
- if (erP != null) {
- erP.removeEventListener(XulRunnerConstants.EVENT_NAME_MOUSEMOVE,
mouseMotionListener, true);
- erP.removeEventListener(XulRunnerConstants.EVENT_NAME_MOUSEUP, mouseListener, true);
- mouseMotionListener = null;
- }
- }
- }
-
-
-
- /* (non-Javadoc)
- * @see
org.jboss.vpe.mozilla.resizer.IVpeResizer#addResizeListener(org.jboss.vpe.mozilla.resizer.IVpeResizeListener)
- */
- public void addResizeListener(IVpeResizeListener listener) {
- if ( (objectResizeEventListeners.size() != 0 ) &&
- ( objectResizeEventListeners.indexOf(listener) != -1)) {
- return;
- }
- objectResizeEventListeners.add(listener);
- }
-
-
- /* (non-Javadoc)
- * @see
org.jboss.vpe.mozilla.resizer.IVpeResizer#removeResizeListener(org.jboss.vpe.mozilla.resizer.IVpeResizeListener)
- */
- public void removeResizeListener(IVpeResizeListener listener) {
- if ( (objectResizeEventListeners.size() == 0 ) ||
- ( objectResizeEventListeners.indexOf(listener) == -1)) {
- return;
- }
- objectResizeEventListeners.remove(listener);
- }
-
- /**
- * Setting a position of shadow
- * @param shadowElement
- * @param aOriginalObjectX
- * @param aOriginalObjectY
- */
- private void setShadowPosition(nsIDOMElement shadowElement, int aOriginalObjectX, int
aOriginalObjectY)
- {
- setAnonymousElementPosition(aOriginalObjectX, aOriginalObjectY, shadowElement);
- }
-
-
- /**
- * create a anonymous dom-element
- *
- * @param aTag
- * a tag of dom element
- * @param aParentNode
- * @param aAnonClass
- * @param isCreatedHidden
- * @return
- */
- private nsIDOMElement createAnonymousElement(String aTag, nsIDOMNode aParentNode, String
aAnonClass, boolean isCreatedHidden) {
- nsIDOMElement returnElement = null;
-
- returnElement = domDocument.createElement(aTag);
-
- // add the "hidden" class if needed
- if (isCreatedHidden) {
- returnElement.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS,
XulRunnerConstants.HTML_VALUE_HIDDEN);
- }
-
- // add an _moz_anonclass attribute if needed
- if ( aAnonClass.length() != 0 ) {
- returnElement.setAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS, aAnonClass);
- }
-
- aParentNode.appendChild(returnElement);
-
- return returnElement;
- }
-
- /**
- *
- * @param parentNode
- * @param originalObject
- * @return
- */
- private nsIDOMElement createShadow(nsIDOMNode parentNode, nsIDOMElement originalObject)
{
- nsIDOMElement returnElement = null;
-
- returnElement = createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN, parentNode,
XulRunnerConstants.VPE_CLASS_NAME_MOZ_RESIZING_SHADOW, true );
-
- return returnElement;
- }
-
- /**
- *
- * @param domElement
- */
- private void startResizing(nsIDOMElement domElement) {
- isResizing = true;
-
- activeHandle = domElement;
- activeHandle.setAttribute(XulRunnerConstants.STRING_MOZ_ACTIVATED,
XulRunnerConstants.HTML_VALUE_TRUE);
-
-
- String locationStr =
activeHandle.getAttribute(XulRunnerConstants.HTML_ATTR_ANONLOCATION);
-
- if (locationStr == null ) {
- return;
- }
-
- if (locationStr.equals(RESIZER_MARKER_STRING_TOPLEFT)) {
- usedEResizeMarkerHandle = RESIZER_MARKER_TOPLEFT;
- setResizeIncrements(1, 1, -1, -1, false);
- } else if (locationStr.equals(RESIZER_MARKER_STRING_TOP)) {
- usedEResizeMarkerHandle = RESIZER_MARKER_TOP;
- setResizeIncrements(0, 1, 0, -1, false);
- } else if (locationStr.equals(RESIZER_MARKER_STRING_TOPRIGHT)) {
- usedEResizeMarkerHandle = RESIZER_MARKER_TOPRIGHT;
- setResizeIncrements(0, 1, 1, -1, false);
- } else if (locationStr.equals(RESIZER_MARKER_STRING_LEFT)) {
- usedEResizeMarkerHandle = RESIZER_MARKER_LEFT;
- setResizeIncrements(1, 0, -1, 0, false);
- } else if (locationStr.equals(RESIZER_MARKER_STRING_RIGHT)) {
- usedEResizeMarkerHandle = RESIZER_MARKER_RIGHT;
- setResizeIncrements(0, 0, 1, 0, false);
- } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOMLEFT)) {
- usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOMLEFT;
- setResizeIncrements(1, 0, -1, 1, false);
- } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOM)) {
- usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOM;
- setResizeIncrements(0, 0, 0, 1, false);
- } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOMRIGHT)) {
- usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOMRIGHT;
- setResizeIncrements(0, 0, 1, 1, false);
- }
-
- // make the shadow appear
- resizingShadow.removeAttribute(XulRunnerConstants.HTML_ATTR_CLASS);
-
- // position it
- setShadowPosition(resizingShadow, elementPositionAndDimention.getLeft(),
elementPositionAndDimention.getTop());
-
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_WIDTH,
elementPositionAndDimention.getWidth() );
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_HEIGHT,
elementPositionAndDimention.getTop() );
-
-
- if (mouseMotionListener != null) {
- return;
- }
-
- mouseMotionListener = new VpeResizerMouseMotionListener(this);
- if ( mouseMotionListener != null ) {
- return;
- }
-
- nsIDOMEventTarget eventTarget = getDOMEventTarget();
-
- if ( eventTarget != null ) {
- eventTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEMOVE,
mouseMotionListener, true);
- eventTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEUP, mouseListener,
true);
- }
-
- return;
- }
-
- /**
- * getting a nsIDOMEventTarget from nsIDOMDocument
- * @return nsIDOMEventTarget from nsIDOMDocument
- */
- private nsIDOMEventTarget getDOMEventTarget() {
-
- nsIDOMEventTarget eventTarget = (nsIDOMEventTarget)
domDocument.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
- if (eventTarget == null) {
- throw new RuntimeException("nsIDOMEventTarget is null");
- }
-
- return eventTarget;
- }
-
-
- /**
- *
- * @param aX
- * @param aY
- * @return
- */
- private int getNewResizingX(int aX, int aY)
- {
- int resized = elementPositionAndDimention.getLeft() + getNewResizingIncrement(aX, aY,
COEFFICIENT_TYPE.X) * incrementFactorX;
- int max = elementPositionAndDimention.getLeft() +
elementPositionAndDimention.getWidth();
- return Math.min(resized, max);
- }
-
- /**
- *
- * @param aX
- * @param aY
- * @return
- */
- private int getNewResizingY(int aX, int aY)
- {
- int resized = elementPositionAndDimention.getTop() + getNewResizingIncrement(aX, aY,
COEFFICIENT_TYPE.Y) * incrementFactorY;
- int max = elementPositionAndDimention.getTop() +
elementPositionAndDimention.getHeight();
- return Math.min(resized, max);
- }
-
- /**
- *
- * @param aX
- * @param aY
- * @return
- */
- private int getNewResizingWidth(int aX, int aY)
- {
- int resized = elementPositionAndDimention.getWidth() + getNewResizingIncrement(aX, aY,
COEFFICIENT_TYPE.WIDTH) * incrementFactorWidth;
- return Math.max(resized, 1);
- }
-
- /**
- *
- * @param aX
- * @param aY
- * @return
- */
- private int getNewResizingHeight(int aX, int aY)
- {
- int resized = elementPositionAndDimention.getHeight() + getNewResizingIncrement(aX, aY,
COEFFICIENT_TYPE.HEIGHT) * incrementFactorHeight;
- return Math.max(resized, 1);
- }
-
- /**
- *
- * @param aX
- * @param aY
- * @param coefficient_type
- * @return
- */
- private int getNewResizingIncrement(int aX, int aY, COEFFICIENT_TYPE coefficient_type)
- {
- int result = 0;
-
- switch (coefficient_type) {
- case X:
- case WIDTH:
- result = aX - originalX;
- break;
- case Y:
- case HEIGHT:
- result = aY - originalY;
- break;
- }
- return result;
- }
-
-
- /**
- * Get root element
- *
- * @return root element
- */
- private nsIDOMElement getRootElement() {
-
- nsIDOMElement bodyElement = null;
-
- nsIDOMHTMLDocument htmlDocument = (nsIDOMHTMLDocument)
domDocument.queryInterface(nsIDOMHTMLDocument.NS_IDOMHTMLDOCUMENT_IID);
-
- if ( htmlDocument != null ) {
- nsIDOMHTMLElement htmlBody = htmlDocument.getBody();
-
- if ( htmlBody != null ) {
- bodyElement = (nsIDOMElement)
htmlBody.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- } // if
- } // if
-
- return bodyElement;
- }
-
- /**
- * Create a new resizer element
- * @param resizerMarkerString
- * @param parentNode
- * @return a new resizer element
- */
- private nsIDOMElement createResizer(String resizerMarkerString, nsIDOMNode parentNode)
{
- nsIDOMElement aNewResizer = createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN,
parentNode, XulRunnerConstants.VPE_CLASSNAME_MOZ_RESIZER, false );
-
- nsIDOMEventTarget evtTarget = (nsIDOMEventTarget)
aNewResizer.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
-
- evtTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEDOWN, mouseListener,
true);
-
- aNewResizer.setAttribute(XulRunnerConstants.HTML_ATTR_ANONLOCATION,
resizerMarkerString);
-
- return aNewResizer;
- }
-
-
- /**
- * Set all positions of resizer's markers
- */
- private void setAllResizersPosition() {
- int left = elementPositionAndDimention.getLeft();
- int top = elementPositionAndDimention.getTop();
- int width = elementPositionAndDimention.getWidth();
- int height = elementPositionAndDimention.getHeight();
-
- int resizerWidth = 5;
- int resizerHeight = 5;
-
- int rw = (int)((resizerWidth + 1) / 2);
- int rh = (int)((resizerHeight+ 1) / 2);
-
- if (markerTopLeft != null) {
- setAnonymousElementPosition(left-resizerWidth-2, top-resizerHeight-2, markerTopLeft);
- }
-
- if (markerTop != null) {
- setAnonymousElementPosition(left+width/2-rw, top-resizerHeight-2, markerTop);
- }
-
- if (markerTopRight != null) {
- setAnonymousElementPosition(left+width, top-resizerHeight-2, markerTopRight);
- }
-
- if (markerLeft != null) {
- setAnonymousElementPosition(left-resizerWidth-2, top+height/2-rh, markerLeft);
- }
-
- if (markerRight != null) {
- setAnonymousElementPosition(left+width, top+height/2-rh, markerRight);
- }
-
- if (markerBottomLeft != null) {
- setAnonymousElementPosition(left-resizerWidth-2, top+height, markerBottomLeft);
- }
-
- if (markerBottom != null) {
- setAnonymousElementPosition(left+width/2-rw, top+height, markerBottom);
- }
-
- if (markerBottomRight != null) {
- setAnonymousElementPosition(left+width, top+height, markerBottomRight);
- }
-
- }
-
- /**
- *
- * @param left
- * @param top
- * @param domElement
- */
- private void setAnonymousElementPosition(int left, int top,nsIDOMElement domElement) {
- setStylePropertyPixels(domElement,XulRunnerConstants.HTML_ATTR_LEFT, left);
- setStylePropertyPixels(domElement,XulRunnerConstants.HTML_ATTR_TOP, top);
- }
-
- /**
- *
- * @param aElement
- * @param aProperty
- * @param aValue
- */
- private void setStylePropertyPixels(nsIDOMElement aElement, String aProperty, int
aValue) {
- setStyle(aElement, aProperty, aValue + "px");
- }
-
- /**
- *
- * @param aX
- * @param aY
- * @param aW
- * @param aH
- * @param aPreserveRatio
- */
- private void setResizeIncrements(int aX, int aY, int aW, int aH, boolean
aPreserveRatio) {
- incrementFactorX = aX;
- incrementFactorY = aY;
- incrementFactorWidth = aW;
- incrementFactorHeight = aH;
- // mPreserveRatio = aPreserveRatio;
- }
-
-
- /**
- * 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);
- }
- }
-
-
- /**
- *
- * @param aClientX
- * @param aClientY
- */
- private void endResizing(int aClientX, int aClientY)
- {
- if (resizingShadow == null) {
- return;
- }
-
- if( activeHandle != null) {
- activeHandle.removeAttribute(XulRunnerConstants.STRING_MOZ_ACTIVATED);
- activeHandle = null;
- }
-
- int left = getNewResizingX(aClientX, aClientY);
- int top = getNewResizingY(aClientX, aClientY);
- int width = getNewResizingWidth(aClientX, aClientY);
- int height = getNewResizingHeight(aClientX, aClientY);
-
- int listenersCount = objectResizeEventListeners.size();
- if (listenersCount != 0) {
- IVpeResizeListener listener;
- int index;
- for (index = 0; index < listenersCount; index++) {
- listener = objectResizeEventListeners.get(index);
- listener.onEndResizing(usedEResizeMarkerHandle,top,left,width,height,resizingObject);
- }
- }
-
- usedEResizeMarkerHandle = 0;
- }
-
- /**
- * Hide of shadow box
- */
- private void hideShadow() {
- if (resizingShadow != null ) {
- resizingShadow.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS,
XulRunnerConstants.HTML_VALUE_HIDDEN);
- }
- }
-
-}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.vpe.xulrunner.editor;
import org.eclipse.core.runtime.Platform;
@@ -16,12 +27,12 @@
*/
public class VpeResizerMouseListener implements nsIDOMEventListener {
- private IVpeResizer vpeResizer;
+ private IXulRunnerVpeResizer vpeResizer;
/**
* Default contructor
*/
- public VpeResizerMouseListener(IVpeResizer vpeResizer) {
+ public VpeResizerMouseListener(IXulRunnerVpeResizer vpeResizer) {
super();
this.vpeResizer = vpeResizer;
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseMotionListener.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseMotionListener.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseMotionListener.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.vpe.xulrunner.editor;
import org.mozilla.interfaces.nsIDOMEvent;
@@ -11,13 +22,13 @@
*/
public class VpeResizerMouseMotionListener implements nsIDOMEventListener {
/** vpeRezizer */
- private IVpeResizer vpeResizer;
+ private IXulRunnerVpeResizer vpeResizer;
/**
* Default constructor
* @param vpeResizer a IVpeResizer object
*/
- public VpeResizerMouseMotionListener(IVpeResizer vpeResizer) {
+ public VpeResizerMouseMotionListener(IXulRunnerVpeResizer vpeResizer) {
this.vpeResizer = vpeResizer;
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.vpe.xulrunner.editor;
/**
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2007-08-17
12:49:27 UTC (rev 3217)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -33,7 +33,6 @@
import org.mozilla.interfaces.nsISupports;
import org.mozilla.interfaces.nsITransferable;
import org.mozilla.xpcom.Mozilla;
-import org.mozilla.xpcom.XPCOMException;
/**
* @author Sergey Vasilyev (svasilyev(a)exadel.com)
Copied:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java
(from rev 3200,
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizer.java)
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java
(rev 0)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java 2007-08-17
13:28:15 UTC (rev 3218)
@@ -0,0 +1,802 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.vpe.xulrunner.editor;
+
+
+import java.util.ArrayList;
+
+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.nsIDOMEventTarget;
+import org.mozilla.interfaces.nsIDOMHTMLDocument;
+import org.mozilla.interfaces.nsIDOMHTMLElement;
+import org.mozilla.interfaces.nsIDOMMouseEvent;
+import org.mozilla.interfaces.nsIDOMNode;
+
+/**
+ * IXulRunnerVpeResizer implementation
+ * @author A. Yukhovich
+ */
+public class XulRunnerVpeResizer implements IXulRunnerVpeResizer {
+ /** COEFFICIENT_TYPE */
+ enum COEFFICIENT_TYPE { X, Y, WIDTH, HEIGHT };
+
+
+ /** RESIZER_MARKER_STRING_TOPLEFT */
+ final static private String RESIZER_MARKER_STRING_TOPLEFT = "nw";
+
+ /** RESIZER_MARKER_STRING_TOP */
+ final static private String RESIZER_MARKER_STRING_TOP = "n";
+
+ /** RESIZER_MARKER_STRING_TOPRIGHT */
+ final static private String RESIZER_MARKER_STRING_TOPRIGHT = "ne";
+
+ /** RESIZER_MARKER_STRING_LEFT */
+ final static private String RESIZER_MARKER_STRING_LEFT = "w";
+
+ /** RESIZER_MARKER_STRING_BOTTOMLEFT */
+ final static private String RESIZER_MARKER_STRING_RIGHT = "e";
+
+ /** RESIZER_MARKER_STRING_BOTTOMLEFT */
+ final static private String RESIZER_MARKER_STRING_BOTTOMLEFT = "sw";
+
+ /** RESIZER_MARKER_STRING_BOTTOM */
+ final static private String RESIZER_MARKER_STRING_BOTTOM = "s";
+
+ /** RESIZER_MARKER_STRING_BOTTOMRIGHT */
+ final static private String RESIZER_MARKER_STRING_BOTTOMRIGHT = "se";
+
+ /** MAX_SIZE */
+ final static private int MAX_SIZE = 20000000;
+
+
+ nsIDOMEventListener mouseListener;
+ nsIDOMEventListener mouseMotionListener;
+
+
+ private ArrayList<IVpeResizeListener> objectResizeEventListeners = new
ArrayList<IVpeResizeListener>();
+
+ private boolean isResizing;
+ private int originalX;
+ private int originalY;
+
+ private int usedEResizeMarkerHandle;
+
+ private int incrementFactorX;
+ private int incrementFactorY;
+ private int incrementFactorWidth;
+ private int incrementFactorHeight;
+
+
+ /** resizingObject */
+ private nsIDOMElement resizingObject;
+
+ /** resizingShadow */
+ private nsIDOMElement resizingShadow;
+
+ /** domDocument */
+ private nsIDOMDocument domDocument;
+
+ private nsIDOMElement activeHandle;
+
+ private ElementPositionAndDimention elementPositionAndDimention;
+
+ /** resizer marker top-left */
+ private nsIDOMElement markerTopLeft = null;
+
+ /** resizer marker top */
+ private nsIDOMElement markerTop = null;
+
+ /** resizer marker top-right */
+ private nsIDOMElement markerTopRight = null;
+
+ /** resizer marker left */
+ private nsIDOMElement markerLeft = null;
+
+ /** resizer marker right */
+ private nsIDOMElement markerRight = null;
+
+ /** resizer marker bottom */
+ private nsIDOMElement markerBottom = null;
+
+ /** resizer marker bottom-left */
+ private nsIDOMElement markerBottomLeft = null;
+
+ /** resizer marker bottom-right */
+ private nsIDOMElement markerBottomRight = null;
+
+
+ /**
+ *
+ * @param domDocument
+ */
+ public void init(nsIDOMDocument domDocument)
+ {
+
+ this.domDocument = domDocument;
+
+ mouseListener = new VpeResizerMouseListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.vpe.mozilla.resizer.IVpeResizer#show(org.mozilla.interfaces.nsIDOMElement,
+ * int)
+ */
+ public void show(nsIDOMElement domElement, int resizers) {
+ resizingObject = domElement;
+
+ elementPositionAndDimention =
DOMElementUtils.getElementPositionAndDimention(domElement);
+
+ if ((elementPositionAndDimention.getWidth() <= 0) ||
+ (elementPositionAndDimention.getWidth() > MAX_SIZE) ||
+ (elementPositionAndDimention.getHeight() <= 0) ||
+ (elementPositionAndDimention.getHeight() > MAX_SIZE)) return;
+
+ nsIDOMElement bodyElement = getRootElement();
+
+ if (bodyElement == null ) return;
+
+ if ((resizers & RESIZER_MARKER_TOPLEFT) == RESIZER_MARKER_TOPLEFT) {
+ markerTopLeft = createResizer( RESIZER_MARKER_STRING_TOPLEFT, bodyElement);
+ if (markerTopLeft == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_TOP) == RESIZER_MARKER_TOP) {
+ markerTop = createResizer( RESIZER_MARKER_STRING_TOP, bodyElement);
+ if (markerTop == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_TOPRIGHT) == RESIZER_MARKER_TOPRIGHT) {
+ markerTopRight = createResizer(RESIZER_MARKER_STRING_TOPRIGHT, bodyElement);
+ if (markerTopRight == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_LEFT) == RESIZER_MARKER_LEFT) {
+ markerLeft = createResizer(RESIZER_MARKER_STRING_LEFT, bodyElement);
+ if (markerLeft == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_RIGHT) == RESIZER_MARKER_RIGHT) {
+ markerRight = createResizer(RESIZER_MARKER_STRING_RIGHT, bodyElement);
+ if (markerRight == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_BOTTOMLEFT) == RESIZER_MARKER_BOTTOMLEFT) {
+ markerBottomLeft = createResizer(RESIZER_MARKER_STRING_BOTTOMLEFT, bodyElement);
+ if (markerBottomLeft == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_BOTTOM) == RESIZER_MARKER_BOTTOM) {
+ markerBottom = createResizer(RESIZER_MARKER_STRING_BOTTOM, bodyElement);
+ if (markerBottom == null) {
+ return ;
+ }
+ }
+
+ if ((resizers & RESIZER_MARKER_BOTTOMRIGHT) == RESIZER_MARKER_BOTTOMRIGHT) {
+ markerBottomRight = createResizer(RESIZER_MARKER_STRING_BOTTOMRIGHT, bodyElement);
+ if (markerBottomRight == null) {
+ return ;
+ }
+ }
+
+ setAllResizersPosition();
+
+ resizingShadow = createShadow(bodyElement, resizingObject);
+
+ setShadowPosition(resizingShadow, elementPositionAndDimention.getLeft(),
elementPositionAndDimention.getTop());
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#hide()
+ */
+ public void hide()
+ {
+ nsIDOMElement bodyElement;
+
+ bodyElement = getRootElement();
+ if ( bodyElement == null ) {
+ return;
+ }
+
+ nsIDOMNode parentNode = (nsIDOMNode)
bodyElement.queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+
+ if ( parentNode == null) {
+ return;
+ }
+
+ if ( markerTopLeft != null) {
+ parentNode.removeChild(markerTopLeft);
+ }
+
+ if ( markerTop != null) {
+ parentNode.removeChild(markerTop);
+ }
+
+
+ if ( markerTopRight != null) {
+ parentNode.removeChild(markerTopRight);
+ }
+
+ if ( markerLeft != null) {
+ parentNode.removeChild(markerLeft);
+ }
+
+ if ( markerRight != null) {
+ parentNode.removeChild(markerRight);
+ }
+
+ if ( markerBottomLeft != null) {
+ parentNode.removeChild(markerBottomLeft);
+ }
+
+ if ( markerBottom != null) {
+ parentNode.removeChild(markerBottom);
+ }
+
+ if ( markerBottomRight != null) {
+ parentNode.removeChild(markerBottomRight);
+ }
+
+
+ if ( resizingShadow != null ) {
+ parentNode.removeChild(resizingShadow);
+ }
+
+ markerBottom = null;
+ markerTop = null;
+ markerLeft = null;
+ markerRight = null;
+ markerBottomRight = null;
+ markerBottomLeft = null;
+ markerTopRight = null;
+ markerTopLeft = null;
+
+ resizingShadow = null;
+ resizingObject = null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseDown(int, int,
org.mozilla.interfaces.nsIDOMElement)
+ */
+ public void mouseDown(int clientX, int clientY, nsIDOMElement domElement) {
+
+
+ if ( domElement != null ) {
+
+ boolean isAnonElement =
domElement.hasAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS);
+
+ if (isAnonElement) {
+ String anonclass = domElement.getAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS);
+
+ if ( anonclass != null ) {
+ if ( anonclass.equals(XulRunnerConstants.VPE_CLASSNAME_MOZ_RESIZER) ) {
+ originalX = clientX;
+ originalY = clientY;
+ startResizing(domElement);
+ } // if
+ } // if
+ } // if
+ } // if
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseMove(org.mozilla.interfaces.nsIDOMEvent)
+ */
+ public void mouseMove(nsIDOMEvent event) {
+ if (isResizing) {
+ nsIDOMMouseEvent mouseEvent =
(nsIDOMMouseEvent)event.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
+ int clientX, clientY;
+
+ clientX = mouseEvent.getClientX();
+ clientY = mouseEvent.getClientY();
+
+ int newX = getNewResizingX(clientX, clientY);
+ int newY = getNewResizingY(clientX, clientY);
+ int newWidth = getNewResizingWidth(clientX, clientY);
+ int newHeight = getNewResizingHeight(clientX, clientY);
+
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_LEFT, newX);
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_TOP, newY);
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_WIDTH, newWidth);
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_HEIGHT,
newHeight);
+ } // if
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseUp(int, int,
org.mozilla.interfaces.nsIDOMElement)
+ */
+ public void mouseUp(int aX, int aY, nsIDOMElement target) {
+ if (isResizing) {
+ isResizing = false;
+
+
+ hideShadow();
+ endResizing(aX, aY);
+
+ nsIDOMEventTarget erP = getDOMEventTarget();
+
+ if (erP != null) {
+ erP.removeEventListener(XulRunnerConstants.EVENT_NAME_MOUSEMOVE,
mouseMotionListener, true);
+ erP.removeEventListener(XulRunnerConstants.EVENT_NAME_MOUSEUP, mouseListener, true);
+ mouseMotionListener = null;
+ }
+ }
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see
org.jboss.vpe.mozilla.resizer.IVpeResizer#addResizeListener(org.jboss.vpe.mozilla.resizer.IVpeResizeListener)
+ */
+ public void addResizeListener(IVpeResizeListener listener) {
+ if ( (objectResizeEventListeners.size() != 0 ) &&
+ ( objectResizeEventListeners.indexOf(listener) != -1)) {
+ return;
+ }
+ objectResizeEventListeners.add(listener);
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.jboss.vpe.mozilla.resizer.IVpeResizer#removeResizeListener(org.jboss.vpe.mozilla.resizer.IVpeResizeListener)
+ */
+ public void removeResizeListener(IVpeResizeListener listener) {
+ if ( (objectResizeEventListeners.size() == 0 ) ||
+ ( objectResizeEventListeners.indexOf(listener) == -1)) {
+ return;
+ }
+ objectResizeEventListeners.remove(listener);
+ }
+
+ /**
+ * Setting a position of shadow
+ * @param shadowElement
+ * @param aOriginalObjectX
+ * @param aOriginalObjectY
+ */
+ private void setShadowPosition(nsIDOMElement shadowElement, int aOriginalObjectX, int
aOriginalObjectY)
+ {
+ setAnonymousElementPosition(aOriginalObjectX, aOriginalObjectY, shadowElement);
+ }
+
+
+ /**
+ * create a anonymous dom-element
+ *
+ * @param aTag
+ * a tag of dom element
+ * @param aParentNode
+ * @param aAnonClass
+ * @param isCreatedHidden
+ * @return
+ */
+ private nsIDOMElement createAnonymousElement(String aTag, nsIDOMNode aParentNode, String
aAnonClass, boolean isCreatedHidden) {
+ nsIDOMElement returnElement = null;
+
+ returnElement = domDocument.createElement(aTag);
+
+ // add the "hidden" class if needed
+ if (isCreatedHidden) {
+ returnElement.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS,
XulRunnerConstants.HTML_VALUE_HIDDEN);
+ }
+
+ // add an _moz_anonclass attribute if needed
+ if ( aAnonClass.length() != 0 ) {
+ returnElement.setAttribute(XulRunnerConstants.STRING_MOZ_ANONCLASS, aAnonClass);
+ }
+
+ aParentNode.appendChild(returnElement);
+
+ return returnElement;
+ }
+
+ /**
+ *
+ * @param parentNode
+ * @param originalObject
+ * @return
+ */
+ private nsIDOMElement createShadow(nsIDOMNode parentNode, nsIDOMElement originalObject)
{
+ nsIDOMElement returnElement = null;
+
+ returnElement = createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN, parentNode,
XulRunnerConstants.VPE_CLASS_NAME_MOZ_RESIZING_SHADOW, true );
+
+ return returnElement;
+ }
+
+ /**
+ *
+ * @param domElement
+ */
+ private void startResizing(nsIDOMElement domElement) {
+ isResizing = true;
+
+ activeHandle = domElement;
+ activeHandle.setAttribute(XulRunnerConstants.STRING_MOZ_ACTIVATED,
XulRunnerConstants.HTML_VALUE_TRUE);
+
+
+ String locationStr =
activeHandle.getAttribute(XulRunnerConstants.HTML_ATTR_ANONLOCATION);
+
+ if (locationStr == null ) {
+ return;
+ }
+
+ if (locationStr.equals(RESIZER_MARKER_STRING_TOPLEFT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_TOPLEFT;
+ setResizeIncrements(1, 1, -1, -1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_TOP)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_TOP;
+ setResizeIncrements(0, 1, 0, -1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_TOPRIGHT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_TOPRIGHT;
+ setResizeIncrements(0, 1, 1, -1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_LEFT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_LEFT;
+ setResizeIncrements(1, 0, -1, 0, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_RIGHT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_RIGHT;
+ setResizeIncrements(0, 0, 1, 0, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOMLEFT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOMLEFT;
+ setResizeIncrements(1, 0, -1, 1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOM)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOM;
+ setResizeIncrements(0, 0, 0, 1, false);
+ } else if (locationStr.equals(RESIZER_MARKER_STRING_BOTTOMRIGHT)) {
+ usedEResizeMarkerHandle = RESIZER_MARKER_BOTTOMRIGHT;
+ setResizeIncrements(0, 0, 1, 1, false);
+ }
+
+ // make the shadow appear
+ resizingShadow.removeAttribute(XulRunnerConstants.HTML_ATTR_CLASS);
+
+ // position it
+ setShadowPosition(resizingShadow, elementPositionAndDimention.getLeft(),
elementPositionAndDimention.getTop());
+
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_WIDTH,
elementPositionAndDimention.getWidth() );
+ setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_HEIGHT,
elementPositionAndDimention.getTop() );
+
+
+ if (mouseMotionListener != null) {
+ return;
+ }
+
+ mouseMotionListener = new VpeResizerMouseMotionListener(this);
+ if ( mouseMotionListener != null ) {
+ return;
+ }
+
+ nsIDOMEventTarget eventTarget = getDOMEventTarget();
+
+ if ( eventTarget != null ) {
+ eventTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEMOVE,
mouseMotionListener, true);
+ eventTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEUP, mouseListener,
true);
+ }
+
+ return;
+ }
+
+ /**
+ * getting a nsIDOMEventTarget from nsIDOMDocument
+ * @return nsIDOMEventTarget from nsIDOMDocument
+ */
+ private nsIDOMEventTarget getDOMEventTarget() {
+
+ nsIDOMEventTarget eventTarget = (nsIDOMEventTarget)
domDocument.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
+ if (eventTarget == null) {
+ throw new RuntimeException("nsIDOMEventTarget is null");
+ }
+
+ return eventTarget;
+ }
+
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @return
+ */
+ private int getNewResizingX(int aX, int aY)
+ {
+ int resized = elementPositionAndDimention.getLeft() + getNewResizingIncrement(aX, aY,
COEFFICIENT_TYPE.X) * incrementFactorX;
+ int max = elementPositionAndDimention.getLeft() +
elementPositionAndDimention.getWidth();
+ return Math.min(resized, max);
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @return
+ */
+ private int getNewResizingY(int aX, int aY)
+ {
+ int resized = elementPositionAndDimention.getTop() + getNewResizingIncrement(aX, aY,
COEFFICIENT_TYPE.Y) * incrementFactorY;
+ int max = elementPositionAndDimention.getTop() +
elementPositionAndDimention.getHeight();
+ return Math.min(resized, max);
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @return
+ */
+ private int getNewResizingWidth(int aX, int aY)
+ {
+ int resized = elementPositionAndDimention.getWidth() + getNewResizingIncrement(aX, aY,
COEFFICIENT_TYPE.WIDTH) * incrementFactorWidth;
+ return Math.max(resized, 1);
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @return
+ */
+ private int getNewResizingHeight(int aX, int aY)
+ {
+ int resized = elementPositionAndDimention.getHeight() + getNewResizingIncrement(aX, aY,
COEFFICIENT_TYPE.HEIGHT) * incrementFactorHeight;
+ return Math.max(resized, 1);
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @param coefficient_type
+ * @return
+ */
+ private int getNewResizingIncrement(int aX, int aY, COEFFICIENT_TYPE coefficient_type)
+ {
+ int result = 0;
+
+ switch (coefficient_type) {
+ case X:
+ case WIDTH:
+ result = aX - originalX;
+ break;
+ case Y:
+ case HEIGHT:
+ result = aY - originalY;
+ break;
+ }
+ return result;
+ }
+
+
+ /**
+ * Get root element
+ *
+ * @return root element
+ */
+ private nsIDOMElement getRootElement() {
+
+ nsIDOMElement bodyElement = null;
+
+ nsIDOMHTMLDocument htmlDocument = (nsIDOMHTMLDocument)
domDocument.queryInterface(nsIDOMHTMLDocument.NS_IDOMHTMLDOCUMENT_IID);
+
+ if ( htmlDocument != null ) {
+ nsIDOMHTMLElement htmlBody = htmlDocument.getBody();
+
+ if ( htmlBody != null ) {
+ bodyElement = (nsIDOMElement)
htmlBody.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ } // if
+ } // if
+
+ return bodyElement;
+ }
+
+ /**
+ * Create a new resizer element
+ * @param resizerMarkerString
+ * @param parentNode
+ * @return a new resizer element
+ */
+ private nsIDOMElement createResizer(String resizerMarkerString, nsIDOMNode parentNode)
{
+ nsIDOMElement aNewResizer = createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN,
parentNode, XulRunnerConstants.VPE_CLASSNAME_MOZ_RESIZER, false );
+
+ nsIDOMEventTarget evtTarget = (nsIDOMEventTarget)
aNewResizer.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
+
+ evtTarget.addEventListener(XulRunnerConstants.EVENT_NAME_MOUSEDOWN, mouseListener,
true);
+
+ aNewResizer.setAttribute(XulRunnerConstants.HTML_ATTR_ANONLOCATION,
resizerMarkerString);
+
+ return aNewResizer;
+ }
+
+
+ /**
+ * Set all positions of resizer's markers
+ */
+ private void setAllResizersPosition() {
+ int left = elementPositionAndDimention.getLeft();
+ int top = elementPositionAndDimention.getTop();
+ int width = elementPositionAndDimention.getWidth();
+ int height = elementPositionAndDimention.getHeight();
+
+ int resizerWidth = 5;
+ int resizerHeight = 5;
+
+ int rw = (int)((resizerWidth + 1) / 2);
+ int rh = (int)((resizerHeight+ 1) / 2);
+
+ if (markerTopLeft != null) {
+ setAnonymousElementPosition(left-resizerWidth-2, top-resizerHeight-2, markerTopLeft);
+ }
+
+ if (markerTop != null) {
+ setAnonymousElementPosition(left+width/2-rw, top-resizerHeight-2, markerTop);
+ }
+
+ if (markerTopRight != null) {
+ setAnonymousElementPosition(left+width, top-resizerHeight-2, markerTopRight);
+ }
+
+ if (markerLeft != null) {
+ setAnonymousElementPosition(left-resizerWidth-2, top+height/2-rh, markerLeft);
+ }
+
+ if (markerRight != null) {
+ setAnonymousElementPosition(left+width, top+height/2-rh, markerRight);
+ }
+
+ if (markerBottomLeft != null) {
+ setAnonymousElementPosition(left-resizerWidth-2, top+height, markerBottomLeft);
+ }
+
+ if (markerBottom != null) {
+ setAnonymousElementPosition(left+width/2-rw, top+height, markerBottom);
+ }
+
+ if (markerBottomRight != null) {
+ setAnonymousElementPosition(left+width, top+height, markerBottomRight);
+ }
+
+ }
+
+ /**
+ *
+ * @param left
+ * @param top
+ * @param domElement
+ */
+ private void setAnonymousElementPosition(int left, int top,nsIDOMElement domElement) {
+ setStylePropertyPixels(domElement,XulRunnerConstants.HTML_ATTR_LEFT, left);
+ setStylePropertyPixels(domElement,XulRunnerConstants.HTML_ATTR_TOP, top);
+ }
+
+ /**
+ *
+ * @param aElement
+ * @param aProperty
+ * @param aValue
+ */
+ private void setStylePropertyPixels(nsIDOMElement aElement, String aProperty, int
aValue) {
+ setStyle(aElement, aProperty, aValue + "px");
+ }
+
+ /**
+ *
+ * @param aX
+ * @param aY
+ * @param aW
+ * @param aH
+ * @param aPreserveRatio
+ */
+ private void setResizeIncrements(int aX, int aY, int aW, int aH, boolean
aPreserveRatio) {
+ incrementFactorX = aX;
+ incrementFactorY = aY;
+ incrementFactorWidth = aW;
+ incrementFactorHeight = aH;
+ // mPreserveRatio = aPreserveRatio;
+ }
+
+
+ /**
+ * 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);
+ }
+ }
+
+
+ /**
+ *
+ * @param aClientX
+ * @param aClientY
+ */
+ private void endResizing(int aClientX, int aClientY)
+ {
+ if (resizingShadow == null) {
+ return;
+ }
+
+ if( activeHandle != null) {
+ activeHandle.removeAttribute(XulRunnerConstants.STRING_MOZ_ACTIVATED);
+ activeHandle = null;
+ }
+
+ int left = getNewResizingX(aClientX, aClientY);
+ int top = getNewResizingY(aClientX, aClientY);
+ int width = getNewResizingWidth(aClientX, aClientY);
+ int height = getNewResizingHeight(aClientX, aClientY);
+
+ int listenersCount = objectResizeEventListeners.size();
+ if (listenersCount != 0) {
+ IVpeResizeListener listener;
+ int index;
+ for (index = 0; index < listenersCount; index++) {
+ listener = objectResizeEventListeners.get(index);
+ listener.onEndResizing(usedEResizeMarkerHandle,top,left,width,height,resizingObject);
+ }
+ }
+
+ usedEResizeMarkerHandle = 0;
+ }
+
+ /**
+ * Hide of shadow box
+ */
+ private void hideShadow() {
+ if (resizingShadow != null ) {
+ resizingShadow.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS,
XulRunnerConstants.HTML_VALUE_HIDDEN);
+ }
+ }
+
+}