#101461 Moving the virtual forms support action to designer/jsf.
1.1 --- a/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/DomProviderImpl.java Tue Apr 17 21:05:25 2007 +0000
1.2 +++ b/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/DomProviderImpl.java Tue Apr 17 22:34:38 2007 +0000
1.3 @@ -844,24 +844,6 @@
1.4 return getFacesModel().getLiveUnit() != null;
1.5 }
1.6
1.7 - public void paintVirtualForms(Graphics2D g2d,DomProvider.RenderContext renderContext) {
1.8 -// DesignContext designContext = renderContext.getDesignContext();
1.9 -// if (!(designContext instanceof LiveUnit)) {
1.10 -// ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,
1.11 -// new IllegalStateException("DesignContext is not of LiveUnit type, designContext=" + designContext)); // NOI18N
1.12 -// }
1.13 -// LiveUnit liveUnit = (LiveUnit)designContext;
1.14 -// Project project = liveUnit.getModel().getProject();
1.15 - Project project = getFacesModel().getProject();
1.16 - LiveUnit liveUnit = getFacesModel().getLiveUnit();
1.17 - if (liveUnit == null) {
1.18 - // XXX Log problem?
1.19 - return;
1.20 - }
1.21 -
1.22 - ComponentGroupSupport.paint(liveUnit, renderContext, g2d);
1.23 - }
1.24 -
1.25 public boolean isFormComponent(Element componentRootElement) {
1.26 MarkupDesignBean bean = MarkupUnit.getMarkupDesignBeanForElement(componentRootElement);
1.27 if (bean == null) {
1.28 @@ -1347,11 +1329,12 @@
1.29 // }
1.30
1.31 public void tcRepaint(Designer designer) {
1.32 - JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1.33 - if (jsfMultiViewElement == null) {
1.34 - return;
1.35 - }
1.36 - jsfMultiViewElement.getJsfTopComponent().repaint();
1.37 +// JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1.38 +// if (jsfMultiViewElement == null) {
1.39 +// return;
1.40 +// }
1.41 +// jsfMultiViewElement.getJsfTopComponent().repaint();
1.42 + JsfSupportUtilities.tcRepaint(designer);
1.43 }
1.44
1.45 public boolean tcSeenEscape(Designer designer, ActionEvent evt) {
1.46 @@ -1401,4 +1384,34 @@
1.47 return jsfForm.isRenderedNode(node);
1.48 }
1.49
1.50 + // XXX
1.51 + public void paintDesignerDecorations(Graphics2D g, Designer designer) {
1.52 + // Virtual forms
1.53 + if (jsfForm.isVirtualFormsSupportEnabled()) {
1.54 + paintVirtualForms(g, designer.createRenderContext());
1.55 + }
1.56 +
1.57 + // Ajax transacations
1.58 + if (jsfForm.isAjaxTransactionsSupportEnabled()) {
1.59 + // TODO
1.60 + }
1.61 + }
1.62 +
1.63 + private void paintVirtualForms(Graphics2D g2d, Designer.RenderContext renderContext) {
1.64 +// DesignContext designContext = renderContext.getDesignContext();
1.65 +// if (!(designContext instanceof LiveUnit)) {
1.66 +// ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,
1.67 +// new IllegalStateException("DesignContext is not of LiveUnit type, designContext=" + designContext)); // NOI18N
1.68 +// }
1.69 +// LiveUnit liveUnit = (LiveUnit)designContext;
1.70 +// Project project = liveUnit.getModel().getProject();
1.71 + Project project = getFacesModel().getProject();
1.72 + LiveUnit liveUnit = getFacesModel().getLiveUnit();
1.73 + if (liveUnit == null) {
1.74 + // XXX Log problem?
1.75 + return;
1.76 + }
1.77 +
1.78 + ComponentGroupSupport.paint(liveUnit, renderContext, g2d);
1.79 + }
1.80 }
2.1 --- a/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/JsfForm.java Tue Apr 17 21:05:25 2007 +0000
2.2 +++ b/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/JsfForm.java Tue Apr 17 22:34:38 2007 +0000
2.3 @@ -149,7 +149,9 @@
2.4 // XXX For fragments, this represents the assigned context page.
2.5 private JsfForm contextJsfForm;
2.6
2.7 - /** XXX Ajax transactions support (see also WebForm virtualForms support). */
2.8 + /** XXX Virutal forms support painting. */
2.9 + private boolean virtualFormsSupportEnabled;
2.10 + /** XXX Ajax transactions support painting. */
2.11 private boolean ajaxTransactionsSupportEnabled;
2.12
2.13
2.14 @@ -2341,13 +2343,40 @@
2.15
2.16 return node.getOwnerDocument() == getHtmlDom();
2.17 }
2.18 +
2.19 + public void setVirtualFormsSupportEnabled(boolean enabled) {
2.20 + virtualFormsSupportEnabled = enabled;
2.21 +
2.22 + // TODO fire model event and in handler repaint the component.
2.23 + tcRepaint();
2.24 + }
2.25 +
2.26 + public boolean isVirtualFormsSupportEnabled() {
2.27 + return virtualFormsSupportEnabled;
2.28 + }
2.29
2.30 public void setAjaxTransactionsSupportEnabled(boolean enabled) {
2.31 ajaxTransactionsSupportEnabled = enabled;
2.32 +
2.33 + // TODO fire model event and in handler repaint the component.
2.34 + tcRepaint();
2.35 }
2.36
2.37 public boolean isAjaxTransactionsSupportEnabled() {
2.38 return ajaxTransactionsSupportEnabled;
2.39 }
2.40 +
2.41 + public void tcRepaint() {
2.42 + Designer[] designers = findDesigners(this);
2.43 +
2.44 + for (Designer designer : designers) {
2.45 + JsfMultiViewElement jsfMultiViewElement = findJsfMultiViewElementForDesigner(designer);
2.46 + if (jsfMultiViewElement == null) {
2.47 + continue;
2.48 + }
2.49 + jsfMultiViewElement.getJsfTopComponent().repaint();
2.50 + }
2.51 + }
2.52 +
2.53 }
2.54
3.1 --- a/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/JsfSupportUtilities.java Tue Apr 17 21:05:25 2007 +0000
3.2 +++ b/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/JsfSupportUtilities.java Tue Apr 17 22:34:38 2007 +0000
3.3 @@ -27,6 +27,7 @@
3.4 import org.netbeans.modules.visualweb.api.designer.Designer.Box;
3.5 import org.netbeans.modules.visualweb.api.designer.cssengine.StyleData;
3.6 import org.netbeans.modules.visualweb.designer.html.HtmlTag;
3.7 +import org.netbeans.modules.visualweb.designer.jsf.ui.JsfMultiViewElement;
3.8 import org.netbeans.modules.visualweb.insync.Util;
3.9 import org.netbeans.modules.visualweb.insync.markup.MarkupUnit;
3.10 import org.netbeans.modules.visualweb.insync.models.FacesModel;
3.11 @@ -192,5 +193,12 @@
3.12
3.13 return new Point(x, y);
3.14 }
3.15 -
3.16 +
3.17 + public static void tcRepaint(Designer designer) {
3.18 + JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
3.19 + if (jsfMultiViewElement == null) {
3.20 + return;
3.21 + }
3.22 + jsfMultiViewElement.getJsfTopComponent().repaint();
3.23 + }
3.24 }
4.1 --- a/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/action/Bundle.properties Tue Apr 17 21:05:25 2007 +0000
4.2 +++ b/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/action/Bundle.properties Tue Apr 17 22:34:38 2007 +0000
4.3 @@ -18,7 +18,7 @@
4.4
4.5
4.6 # AjaxTransactionsSupportAction
4.7 -LBL_AjaxTransactionsSupportAction=Ajax Transactions
4.8 +LBL_AjaxTransactionsSupportAction=Show Ajax Transactions
4.9
4.10 # AlignAction
4.11 LBL_AlignAction=Align
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/action/VirtualFormsSupportAction.java Tue Apr 17 22:34:38 2007 +0000
5.3 @@ -0,0 +1,92 @@
5.4 +/*
5.5 + * The contents of this file are subject to the terms of the Common Development
5.6 + * and Distribution License (the License). You may not use this file except in
5.7 + * compliance with the License.
5.8 + *
5.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
5.10 + * or http://www.netbeans.org/cddl.txt.
5.11 + *
5.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
5.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
5.14 + * If applicable, add the following below the CDDL Header, with the fields
5.15 + * enclosed by brackets [] replaced by your own identifying information:
5.16 + * "Portions Copyrighted [year] [name of copyright owner]"
5.17 + *
5.18 + * The Original Software is NetBeans. The Initial Developer of the Original
5.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
5.20 + * Microsystems, Inc. All Rights Reserved.
5.21 + */
5.22 +
5.23 +
5.24 +package org.netbeans.modules.visualweb.designer.jsf.action;
5.25 +
5.26 +
5.27 +import java.awt.Component;
5.28 +import javax.swing.Action;
5.29 +import javax.swing.JToggleButton;
5.30 +import org.netbeans.modules.visualweb.designer.jsf.JsfForm;
5.31 +import org.openide.awt.Actions;
5.32 +import org.openide.nodes.Node;
5.33 +import org.openide.util.Lookup;
5.34 +import org.openide.util.NbBundle;
5.35 +
5.36 +/**
5.37 + * Action switching on/off the virtual forms support.
5.38 + *
5.39 + * @author Peter Zavadsky
5.40 + * @author Tor Norbye (old functionality implementation -> performAction impl)
5.41 + */
5.42 +public class VirtualFormsSupportAction extends AbstractJsfFormAction {
5.43 +
5.44 + /** Creates a new instance of RefreshAction */
5.45 + public VirtualFormsSupportAction() {
5.46 + }
5.47 +
5.48 + protected String getDisplayName(JsfForm jsfForm) {
5.49 + return NbBundle.getMessage(VirtualFormsSupportAction.class, "LBL_VirtualFormsSupportAction");
5.50 + }
5.51 +
5.52 + protected String getIconBase(JsfForm jsfForm) {
5.53 + return "org/netbeans/modules/visualweb/designer/jsf/resources/virtualForms.png"; // NOI18N
5.54 + }
5.55 +
5.56 + protected boolean isEnabled(JsfForm jsfForm) {
5.57 + return jsfForm != null;
5.58 + }
5.59 +
5.60 + protected void performAction(JsfForm jsfForm) {
5.61 + if (jsfForm == null) {
5.62 + return;
5.63 + }
5.64 +
5.65 + jsfForm.setVirtualFormsSupportEnabled(!jsfForm.isVirtualFormsSupportEnabled());
5.66 +
5.67 +// // XXX FIXME Why is this here? Move it to more appropriate place.
5.68 +//// webform.getPane().repaint();
5.69 +// DesignerPane designerPane = webForm.getPane();
5.70 +// // XXX #6486455 Possible NPE.
5.71 +// if (designerPane == null) {
5.72 +//// webForm.getTopComponent().repaint();
5.73 +// webForm.tcRepaint();
5.74 +// } else {
5.75 +// designerPane.repaint();
5.76 +// }
5.77 + }
5.78 +
5.79 + /** Overriding to get the toggle button as the toolbar presenter. */
5.80 + protected Component getToolbarPresenter(Action contextAwareAction, Lookup.Result<Node> result) {
5.81 + JsfForm jsfForm = getJsfForm(result);
5.82 + boolean selected;
5.83 + if (jsfForm == null) {
5.84 + selected = false;
5.85 + } else {
5.86 + selected = jsfForm.isVirtualFormsSupportEnabled();
5.87 + }
5.88 +
5.89 + JToggleButton toggleButton = new JToggleButton();
5.90 + Actions.connect(toggleButton, contextAwareAction);
5.91 + toggleButton.setSelected(selected);
5.92 +
5.93 + return toggleButton;
5.94 + }
5.95 +}
6.1 --- a/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/resources/layer.xml Tue Apr 17 21:05:25 2007 +0000
6.2 +++ b/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/resources/layer.xml Tue Apr 17 22:34:38 2007 +0000
6.3 @@ -27,6 +27,7 @@
6.4 <file name="org-netbeans-modules-visualweb-designer-jsf-action-AlignAction.instance"/>
6.5 <file name="org-netbeans-modules-visualweb-designer-jsf-action-InlineEditAction.instance"/>
6.6 <file name="org-netbeans-modules-visualweb-designer-jsf-action-SelectParentAction.instance"/>
6.7 + <file name="org-netbeans-modules-visualweb-designer-jsf-action-VirtualFormsSupportAction.instance"/>
6.8 </folder>
6.9 </folder>
6.10
6.11 @@ -77,6 +78,12 @@
6.12
6.13 <folder name="Toolbars">
6.14 <folder name="Default">
6.15 + <attr name="org-netbeans-modules-visualweb-designer-action-RefreshAction.shadow/org-netbeans-modules-visualweb-designer-jsf-action-VirtualFormsSupportAction.shadow" boolvalue="true"/>
6.16 + <file name="org-netbeans-modules-visualweb-designer-jsf-action-VirtualFormsSupportAction.shadow">
6.17 + <attr name="originalFile" stringvalue="/Actions/JSFSupport/org-netbeans-modules-visualweb-designer-jsf-action-VirtualFormsSupportAction.instance"/>
6.18 + </file>
6.19 + <attr name="org-netbeans-modules-visualweb-designer-jsf-action-VirtualFormsSupportAction.shadow/org-netbeans-modules-visualweb-designer-action-TargetResolutionAction.shadow" boolvalue="true"/>
6.20 +
6.21 <attr name="org-netbeans-modules-visualweb-designer-action-DecorationsAction.shadow/org-netbeans-modules-visualweb-designer-jsf-action-AjaxTransactionsSupportAction.shadow" boolvalue="true"/>
6.22 <file name="org-netbeans-modules-visualweb-designer-jsf-action-AjaxTransactionsSupportAction.shadow">
6.23 <attr name="originalFile" stringvalue="/Actions/JSFSupport/org-netbeans-modules-visualweb-designer-jsf-action-AjaxTransactionsSupportAction.instance"/>
7.1 --- a/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/virtualforms/ComponentGroupSupport.java Tue Apr 17 21:05:25 2007 +0000
7.2 +++ b/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/virtualforms/ComponentGroupSupport.java Tue Apr 17 22:34:38 2007 +0000
7.3 @@ -22,7 +22,6 @@
7.4
7.5
7.6 import com.sun.rave.designtime.markup.MarkupDesignBean;
7.7 -import org.netbeans.modules.visualweb.api.designer.DomProvider;
7.8 import java.awt.BasicStroke;
7.9 import java.awt.Color;
7.10 import java.awt.Dimension;
7.11 @@ -45,6 +44,7 @@
7.12 import com.sun.rave.designtime.ext.componentgroup.impl.ColorWrapperImpl;
7.13 import com.sun.rave.designtime.ext.componentgroup.util.ComponentGroupHelper;
7.14 import javax.faces.component.NamingContainer;
7.15 +import org.netbeans.modules.visualweb.api.designer.Designer;
7.16 import org.w3c.dom.Element;
7.17
7.18
7.19 @@ -90,7 +90,7 @@
7.20 /*
7.21 * <p>Paint legends and the colored borders of appropriate components.</p>
7.22 */
7.23 - public static void paint(LiveUnit liveUnit,DomProvider.RenderContext renderContext, Graphics2D g2d) {
7.24 + public static void paint(LiveUnit liveUnit, Designer.RenderContext renderContext, Graphics2D g2d) {
7.25 ComponentGroupHolder[] holders = null;
7.26 Object dcontextData = liveUnit.getContextData(ComponentGroupHolder.CONTEXT_DATA_KEY);
7.27 if (dcontextData instanceof ComponentGroupHolder[]) {
7.28 @@ -243,7 +243,7 @@
7.29 }
7.30 }
7.31
7.32 - private static void paintChildren(DomProvider.RenderContext renderContext,
7.33 + private static void paintChildren(Designer.RenderContext renderContext,
7.34 DesignBean parent, ComponentGroupHolder[] holders, ComponentGroup[][] groupArr, Graphics2D g2d, String precedingIds) {
7.35 DesignBean[] childBeans = parent.getChildBeans();
7.36 if (childBeans == null || childBeans.length == 0) {
7.37 @@ -343,7 +343,7 @@
7.38 }
7.39 }
7.40
7.41 - private static void paintHighlight(DomProvider.RenderContext renderContext,
7.42 + private static void paintHighlight(Designer.RenderContext renderContext,
7.43 Graphics2D g2d, DesignBean bean, Color color, boolean paintSolid, boolean paintDashed, int nestingLevel) {
7.44 if (bean != null) {
7.45 Element componentRootElement;
8.1 --- a/visualweb.designer/src/org/netbeans/modules/visualweb/api/designer/Designer.java Tue Apr 17 21:05:25 2007 +0000
8.2 +++ b/visualweb.designer/src/org/netbeans/modules/visualweb/api/designer/Designer.java Tue Apr 17 22:34:38 2007 +0000
8.3 @@ -19,7 +19,10 @@
8.4
8.5 package org.netbeans.modules.visualweb.api.designer;
8.6
8.7 +import java.awt.Dimension;
8.8 +import java.awt.FontMetrics;
8.9 import java.awt.Point;
8.10 +import java.awt.Rectangle;
8.11 import java.awt.datatransfer.Transferable;
8.12 import java.awt.event.ActionEvent;
8.13 import java.io.PrintStream;
8.14 @@ -248,4 +251,18 @@
8.15 public Designer getDesigner();
8.16 public Box getBox();
8.17 } // End of DesignerEvent.
8.18 +
8.19 +
8.20 + /** XXX Render Context. */
8.21 + public interface RenderContext {
8.22 +// public DesignBean[] getBeansOfType(Class clazz);
8.23 + public Dimension getVieportDimension();
8.24 + public Point getViewportPosition();
8.25 + public int getNonTabbedTextWidth(char[] s, int offset, int length, FontMetrics metrics);
8.26 +// public Rectangle getBoundsForDesignBean(DesignBean designBean);
8.27 + public Rectangle getBoundsForComponent(Element componentRootElement);
8.28 + } // End of RenderContext.
8.29 +
8.30 + public RenderContext createRenderContext();
8.31 +
8.32 }
9.1 --- a/visualweb.designer/src/org/netbeans/modules/visualweb/api/designer/DomProvider.java Tue Apr 17 21:05:25 2007 +0000
9.2 +++ b/visualweb.designer/src/org/netbeans/modules/visualweb/api/designer/DomProvider.java Tue Apr 17 22:34:38 2007 +0000
9.3 @@ -301,18 +301,18 @@
9.4 // // XXX Designer shoudn't know about class names at all.
9.5 // public String getImageComponentClassName();
9.6
9.7 - // XXX Suspicous this way, provide better interface.
9.8 - public void paintVirtualForms(Graphics2D g, RenderContext renderContext);
9.9 -
9.10 - /** XXX Render Context. */
9.11 - public interface RenderContext {
9.12 -// public DesignBean[] getBeansOfType(Class clazz);
9.13 - public Dimension getVieportDimension();
9.14 - public Point getViewportPosition();
9.15 - public int getNonTabbedTextWidth(char[] s, int offset, int length, FontMetrics metrics);
9.16 -// public Rectangle getBoundsForDesignBean(DesignBean designBean);
9.17 - public Rectangle getBoundsForComponent(Element componentRootElement);
9.18 - } // End of RenderContext.
9.19 +// // XXX Suspicous this way, provide better interface.
9.20 +// public void paintVirtualForms(Graphics2D g, RenderContext renderContext);
9.21 +//
9.22 +// /** XXX Render Context. */
9.23 +// public interface RenderContext {
9.24 +//// public DesignBean[] getBeansOfType(Class clazz);
9.25 +// public Dimension getVieportDimension();
9.26 +// public Point getViewportPosition();
9.27 +// public int getNonTabbedTextWidth(char[] s, int offset, int length, FontMetrics metrics);
9.28 +//// public Rectangle getBoundsForDesignBean(DesignBean designBean);
9.29 +// public Rectangle getBoundsForComponent(Element componentRootElement);
9.30 +// } // End of RenderContext.
9.31
9.32
9.33 public boolean isFormComponent(Element componentRootElement);
9.34 @@ -557,5 +557,7 @@
9.35 public boolean tcSeenEscape(Designer designer, ActionEvent evt);
9.36
9.37 public void tcDeleteSelection(Designer designer);
9.38 -
9.39 +
9.40 + // XXX
9.41 + public void paintDesignerDecorations(Graphics2D g, Designer designer);
9.42 }
10.1 --- a/visualweb.designer/src/org/netbeans/modules/visualweb/designer/InteractionManager.java Tue Apr 17 21:05:25 2007 +0000
10.2 +++ b/visualweb.designer/src/org/netbeans/modules/visualweb/designer/InteractionManager.java Tue Apr 17 22:34:38 2007 +0000
10.3 @@ -879,11 +879,13 @@
10.4 //getPageBox(); // ensure that colors etc. are synced
10.5 webform.getColors().sync();
10.6
10.7 - if (webform.isVirtualFormsEnabled()) {
10.8 -// VirtualFormSupport.paint(webform, g);
10.9 -// paintVirtualForms(webform, g);
10.10 - webform.paintVirtualForms(g, new RenderContextImpl(webform));
10.11 - }
10.12 +// if (webform.isVirtualFormsEnabled()) {
10.13 +//// VirtualFormSupport.paint(webform, g);
10.14 +//// paintVirtualForms(webform, g);
10.15 +// webform.paintVirtualForms(g, new RenderContextImpl(webform));
10.16 +// }
10.17 + // XXX Generic support for various designer decorations (for now virtual forms, ajax transactions).
10.18 + webform.paintDesignerDecorations(g);
10.19
10.20 // Paint both before and after
10.21 webform.getSelection().paintSelection(g);
10.22 @@ -3197,44 +3199,44 @@
10.23 // }
10.24
10.25
10.26 - private static class RenderContextImpl implements /*VirtualFormRenderer*/DomProvider.RenderContext {
10.27 - private final WebForm webForm;
10.28 -
10.29 - public RenderContextImpl(WebForm webForm) {
10.30 - this.webForm = webForm;
10.31 - }
10.32 -
10.33 -// public DesignContext getDesignContext() {
10.34 -// return webForm.getModel().getLiveUnit();
10.35 +// private static class RenderContextImpl implements /*VirtualFormRenderer*/DomProvider.RenderContext {
10.36 +// private final WebForm webForm;
10.37 +//
10.38 +// public RenderContextImpl(WebForm webForm) {
10.39 +// this.webForm = webForm;
10.40 // }
10.41 -// public DesignBean[] getBeansOfType(Class clazz) {
10.42 -// return webForm.getBeansOfType(clazz);
10.43 +//
10.44 +//// public DesignContext getDesignContext() {
10.45 +//// return webForm.getModel().getLiveUnit();
10.46 +//// }
10.47 +//// public DesignBean[] getBeansOfType(Class clazz) {
10.48 +//// return webForm.getBeansOfType(clazz);
10.49 +//// }
10.50 +//
10.51 +//// public Project getProject() {
10.52 +//// return webForm.getProject();
10.53 +//// }
10.54 +//
10.55 +// public Dimension getVieportDimension() {
10.56 +// return webForm.getPane().getPageBox().getViewport().getExtentSize();
10.57 // }
10.58 -
10.59 -// public Project getProject() {
10.60 -// return webForm.getProject();
10.61 +//
10.62 +// public Point getViewportPosition() {
10.63 +// return webForm.getPane().getPageBox().getViewport().getViewPosition();
10.64 // }
10.65 -
10.66 - public Dimension getVieportDimension() {
10.67 - return webForm.getPane().getPageBox().getViewport().getExtentSize();
10.68 - }
10.69 -
10.70 - public Point getViewportPosition() {
10.71 - return webForm.getPane().getPageBox().getViewport().getViewPosition();
10.72 - }
10.73 -
10.74 - public int getNonTabbedTextWidth(char[] s, int offset, int length, FontMetrics metrics) {
10.75 - return DesignerUtils.getNonTabbedTextWidth(s, offset, length, metrics);
10.76 - }
10.77 -
10.78 - public Rectangle getBoundsForComponent(Element componentRootElement) {
10.79 - if (componentRootElement != null) {
10.80 - return ModelViewMapper.getComponentBounds(webForm.getPane().getPageBox(), componentRootElement);
10.81 - } else {
10.82 - return null;
10.83 - }
10.84 - }
10.85 - } // End of RenderContextImpl.
10.86 +//
10.87 +// public int getNonTabbedTextWidth(char[] s, int offset, int length, FontMetrics metrics) {
10.88 +// return DesignerUtils.getNonTabbedTextWidth(s, offset, length, metrics);
10.89 +// }
10.90 +//
10.91 +// public Rectangle getBoundsForComponent(Element componentRootElement) {
10.92 +// if (componentRootElement != null) {
10.93 +// return ModelViewMapper.getComponentBounds(webForm.getPane().getPageBox(), componentRootElement);
10.94 +// } else {
10.95 +// return null;
10.96 +// }
10.97 +// }
10.98 +// } // End of RenderContextImpl.
10.99
10.100
10.101 // XXX Moved from Document.
11.1 --- a/visualweb.designer/src/org/netbeans/modules/visualweb/designer/WebForm.java Tue Apr 17 21:05:25 2007 +0000
11.2 +++ b/visualweb.designer/src/org/netbeans/modules/visualweb/designer/WebForm.java Tue Apr 17 22:34:38 2007 +0000
11.3 @@ -39,6 +39,7 @@
11.4 import org.netbeans.modules.visualweb.designer.ImageCache;
11.5 import java.awt.Dimension;
11.6 import java.awt.EventQueue;
11.7 +import java.awt.FontMetrics;
11.8 import java.awt.Graphics2D;
11.9 import java.awt.Point;
11.10 import java.awt.datatransfer.DataFlavor;
11.11 @@ -128,7 +129,7 @@
11.12 // private RaveElement body;
11.13
11.14 // private VirtualFormSupport virtualForms;
11.15 - private boolean virtualFormsEnabled;
11.16 +// private boolean virtualFormsEnabled;
11.17
11.18 private ColorManager colors;
11.19 // private DesignerActions actions;
11.20 @@ -1082,13 +1083,13 @@
11.21 // return virtualForms;
11.22 // }
11.23
11.24 - public void setVirtualFormsEnabled(boolean virtualFormsEnabled) {
11.25 - this.virtualFormsEnabled = virtualFormsEnabled;
11.26 - }
11.27 -
11.28 - public boolean isVirtualFormsEnabled() {
11.29 - return virtualFormsEnabled;
11.30 - }
11.31 +// public void setVirtualFormsEnabled(boolean virtualFormsEnabled) {
11.32 +// this.virtualFormsEnabled = virtualFormsEnabled;
11.33 +// }
11.34 +//
11.35 +// public boolean isVirtualFormsEnabled() {
11.36 +// return virtualFormsEnabled;
11.37 +// }
11.38
11.39 /**
11.40 * Return the color manager for the webform which stores
11.41 @@ -2083,9 +2084,9 @@
11.42 // return domProvider.getImageComponentClassName();
11.43 // }
11.44
11.45 - void paintVirtualForms(Graphics2D g,DomProvider.RenderContext renderContext) {
11.46 - domProvider.paintVirtualForms(g, renderContext);
11.47 - }
11.48 +// void paintVirtualForms(Graphics2D g,DomProvider.RenderContext renderContext) {
11.49 +// domProvider.paintVirtualForms(g, renderContext);
11.50 +// }
11.51
11.52 public boolean isFormComponent(Element componentRootElement) {
11.53 return domProvider.isFormComponent(componentRootElement);
11.54 @@ -3127,4 +3128,54 @@
11.55 // No op.
11.56 }
11.57 } // End of CssBoxDataHandler.
11.58 +
11.59 +
11.60 + void paintDesignerDecorations(Graphics2D g) {
11.61 + domProvider.paintDesignerDecorations(g, this);
11.62 + }
11.63 +
11.64 + public Designer.RenderContext createRenderContext() {
11.65 + return new RenderContextImpl(this);
11.66 + }
11.67 +
11.68 +
11.69 + private static class RenderContextImpl implements Designer.RenderContext {
11.70 + private final WebForm webForm;
11.71 +
11.72 + public RenderContextImpl(WebForm webForm) {
11.73 + this.webForm = webForm;
11.74 + }
11.75 +
11.76 +// public DesignContext getDesignContext() {
11.77 +// return webForm.getModel().getLiveUnit();
11.78 +// }
11.79 +// public DesignBean[] getBeansOfType(Class clazz) {
11.80 +// return webForm.getBeansOfType(clazz);
11.81 +// }
11.82 +
11.83 +// public Project getProject() {
11.84 +// return webForm.getProject();
11.85 +// }
11.86 +
11.87 + public Dimension getVieportDimension() {
11.88 + return webForm.getPane().getPageBox().getViewport().getExtentSize();
11.89 + }
11.90 +
11.91 + public Point getViewportPosition() {
11.92 + return webForm.getPane().getPageBox().getViewport().getViewPosition();
11.93 + }
11.94 +
11.95 + public int getNonTabbedTextWidth(char[] s, int offset, int length, FontMetrics metrics) {
11.96 + return DesignerUtils.getNonTabbedTextWidth(s, offset, length, metrics);
11.97 + }
11.98 +
11.99 + public Rectangle getBoundsForComponent(Element componentRootElement) {
11.100 + if (componentRootElement != null) {
11.101 + return ModelViewMapper.getComponentBounds(webForm.getPane().getPageBox(), componentRootElement);
11.102 + } else {
11.103 + return null;
11.104 + }
11.105 + }
11.106 + } // End of RenderContextImpl.
11.107 +
11.108 }
12.1 --- a/visualweb.designer/src/org/netbeans/modules/visualweb/designer/resources/layer.xml Tue Apr 17 21:05:25 2007 +0000
12.2 +++ b/visualweb.designer/src/org/netbeans/modules/visualweb/designer/resources/layer.xml Tue Apr 17 22:34:38 2007 +0000
12.3 @@ -32,7 +32,7 @@
12.4 <file name="org-netbeans-modules-visualweb-designer-action-SendToBackAction.instance"/>
12.5 <!--<file name="org-netbeans-modules-visualweb-designer-action-SelectParentAction.instance"/>-->
12.6 <file name="org-netbeans-modules-visualweb-designer-action-TargetResolutionAction.instance"/>
12.7 - <file name="org-netbeans-modules-visualweb-designer-action-VirtualFormsSupportAction.instance"/>
12.8 + <!--<file name="org-netbeans-modules-visualweb-designer-action-VirtualFormsSupportAction.instance"/>-->
12.9 </folder>
12.10 </folder>
12.11
12.12 @@ -159,11 +159,13 @@
12.13 <file name="org-netbeans-modules-visualweb-designer-action-RefreshAction.shadow">
12.14 <attr name="originalFile" stringvalue="/Actions/Designer/org-netbeans-modules-visualweb-designer-action-RefreshAction.instance"/>
12.15 </file>
12.16 + <!--
12.17 <attr name="org-netbeans-modules-visualweb-designer-action-RefreshAction.shadow/org-netbeans-modules-visualweb-designer-action-VirtualFormsSupportAction.shadow" boolvalue="true"/>
12.18 <file name="org-netbeans-modules-visualweb-designer-action-VirtualFormsSupportAction.shadow">
12.19 <attr name="originalFile" stringvalue="/Actions/Designer/org-netbeans-modules-visualweb-designer-action-VirtualFormsSupportAction.instance"/>
12.20 </file>
12.21 <attr name="org-netbeans-modules-visualweb-designer-action-VirtualFormsSupportAction.shadow/org-netbeans-modules-visualweb-designer-action-TargetResolutionAction.shadow" boolvalue="true"/>
12.22 + -->
12.23 <file name="org-netbeans-modules-visualweb-designer-action-TargetResolutionAction.shadow">
12.24 <attr name="originalFile" stringvalue="/Actions/Designer/org-netbeans-modules-visualweb-designer-action-TargetResolutionAction.instance"/>
12.25 </file>