Source Code Cross Referenced for DomProviderImpl.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » designer » jsf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » org.netbeans.modules.visualweb.designer.jsf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:
0042:        package org.netbeans.modules.visualweb.designer.jsf;
0043:
0044:        import org.netbeans.modules.visualweb.api.designer.Designer;
0045:        import com.sun.rave.designtime.DesignProperty;
0046:        import java.util.ArrayList;
0047:        import org.netbeans.modules.visualweb.api.designer.DomProvider;
0048:        import org.netbeans.modules.visualweb.api.designer.DomProviderService;
0049:        import org.netbeans.modules.visualweb.api.designer.markup.MarkupService;
0050:        import com.sun.rave.designtime.DesignBean;
0051:        import com.sun.rave.designtime.markup.MarkupDesignBean;
0052:        import org.netbeans.modules.visualweb.insync.Util;
0053:        import org.netbeans.modules.visualweb.insync.beans.BeansUnit;
0054:        import org.netbeans.modules.visualweb.insync.faces.FacesBean;
0055:        import org.netbeans.modules.visualweb.insync.faces.FacesPageUnit;
0056:        import org.netbeans.modules.visualweb.insync.faces.HtmlBean;
0057:        import org.netbeans.modules.visualweb.insync.live.LiveUnit;
0058:        import org.netbeans.modules.visualweb.insync.markup.MarkupUnit;
0059:        import java.awt.Dimension;
0060:        import java.awt.Graphics2D;
0061:        import java.awt.Point;
0062:        import java.awt.datatransfer.DataFlavor;
0063:        import java.awt.datatransfer.Transferable;
0064:        import java.net.URL;
0065:        import java.util.List;
0066:        import javax.swing.JComponent;
0067:        import javax.swing.SwingUtilities;
0068:        import org.netbeans.api.project.Project;
0069:        import org.netbeans.modules.visualweb.api.designer.cssengine.CssProvider;
0070:        import org.netbeans.modules.visualweb.designer.jsf.virtualforms.ComponentGroupSupport;
0071:        import org.netbeans.modules.visualweb.spi.designer.Decoration;
0072:        import org.netbeans.spi.palette.PaletteController;
0073:        import org.openide.windows.TopComponent;
0074:        import org.w3c.dom.Document;
0075:        import org.w3c.dom.DocumentFragment;
0076:        import org.w3c.dom.Element;
0077:        import org.w3c.dom.Node;
0078:
0079:        /**
0080:         * Implementation of <code>DomProvider</code>
0081:         *
0082:         * @author Peter Zavadsky
0083:         */
0084:        class DomProviderImpl implements  DomProvider {
0085:
0086:            private final JsfForm jsfForm;
0087:
0088:            private static final DomProviderService domProviderService = new DomProviderServiceImpl();
0089:
0090:            /** Creates a new instance of DomProviderImpl */
0091:            public DomProviderImpl(JsfForm jsfForm) {
0092:                this .jsfForm = jsfForm;
0093:            }
0094:
0095:            public JsfForm getJsfForm() {
0096:                return jsfForm;
0097:            }
0098:
0099:            //    public void addDomProviderListener(DomProvider.DomProviderListener l) {
0100:            //        jsfForm.addDomProviderListener(l);
0101:            //    }
0102:            //
0103:            //    public void removeDomProviderListener(DomProvider.DomProviderListener l) {
0104:            //        jsfForm.removeDomProviderListener(l);
0105:            //    }
0106:
0107:            public Document getHtmlDom() {
0108:                //        return getFacesModel().getHtmlDom();
0109:                return jsfForm.getHtmlDom();
0110:            }
0111:
0112:            //    public DocumentFragment getHtmlDocumentFragment() {
0113:            ////        return getFacesModel().getHtmlDomFragment();
0114:            //        return jsfForm.getHtmlDomFragment();
0115:            //    }
0116:
0117:            public Element getHtmlBody() {
0118:                //        return getFacesModel().getHtmlBody();
0119:                return jsfForm.getHtmlBody();
0120:            }
0121:
0122:            public PaletteController getPaletteController() {
0123:                return jsfForm.getPaletteController();
0124:            }
0125:
0126:            //    public void requestRefresh() {
0127:            //        jsfForm.requestRefresh();
0128:            //    }
0129:
0130:            //    public void refreshModel(boolean deep) {
0131:            //        jsfForm.refreshModel(deep);
0132:            //    }
0133:
0134:            //    public void setUpdatesSuspended(MarkupDesignBean markupDesignBean, boolean suspend) {
0135:
0136:            //    public void setUpdatesSuspended(MarkupDesignBean markupDesignBean, boolean suspend) {
0137:
0138:            //    public void setUpdatesSuspended(MarkupDesignBean markupDesignBean, boolean suspend) {
0139:
0140:            //    public void setUpdatesSuspended(MarkupDesignBean markupDesignBean, boolean suspend) {
0141:            //        jsfForm.setUpdatesSuspended(markupDesignBean, suspend);
0142:            //    }
0143:
0144:            //    public boolean isRefreshPending() {
0145:            //        return jsfForm.isRefreshPending();
0146:            //    }
0147:
0148:            //    public void attachContext() {
0149:            //        DesignContext context = getFacesModel().getLiveUnit();
0150:            //        if (context != null) {
0151:            //            jsfForm.attachContext(context);
0152:            //        }
0153:            //    }
0154:
0155:            /*public*/
0156:            /*public*/
0157:            /*public*/
0158:            /*public*/
0159:            /*public*/
0160:            /*public*/
0161:            /*public*/
0162:            /*public*/DocumentFragment createSourceFragment(
0163:                    MarkupDesignBean bean) {
0164:                return jsfForm.createSourceFragment(bean);
0165:            }
0166:
0167:            /*public*/
0168:            /*public*/
0169:            /*public*/
0170:            /*public*/
0171:            /*public*/
0172:            /*public*/
0173:            /*public*/
0174:            /*public*/void requestChange(MarkupDesignBean bean) {
0175:                jsfForm.requestChange(bean);
0176:            }
0177:
0178:            /*public*/
0179:            /*public*/
0180:            /*public*/
0181:            /*public*/
0182:            /*public*/
0183:            /*public*/
0184:            /*public*/
0185:            /*public*/void beanChanged(MarkupDesignBean bean) {
0186:                jsfForm.beanChanged(bean);
0187:            }
0188:
0189:            /*public*/
0190:            /*public*/
0191:            /*public*/
0192:            /*public*/
0193:            /*public*/
0194:            /*public*/
0195:            /*public*/
0196:            /*public*/void requestTextUpdate(MarkupDesignBean bean) {
0197:                jsfForm.requestTextUpdate(bean);
0198:            }
0199:
0200:            //    public DataFlavor getImportFlavor(DataFlavor[] flavors) {
0201:            //        return getDndSupport().getImportFlavor(flavors);
0202:            //    }
0203:
0204:            public boolean canImport(JComponent comp,
0205:                    DataFlavor[] transferFlavors, Transferable transferable) {
0206:                //        return getFacesModel().getDnDSupport().canImport(comp, transferFlavors);
0207:                return getDndSupport().canImport(comp, transferFlavors,
0208:                        transferable);
0209:            }
0210:
0211:            //    public DesignBean[] pasteBeans(Transferable t, DesignBean parent, MarkupPosition pos, Point location, DomProvider.CoordinateTranslator coordinateTranslator) {
0212:            //        return getDndSupport().pasteBeans(t, parent, pos, location, coordinateTranslator, jsfForm.getUpdateSuspender());
0213:            //    }
0214:            // XXX Moved to FacesDnDSupport
0215:            //    private /*public*/ Element[] pasteComponents(Transferable t, Element parentComponentRootElement, Point location) {
0216:            //        MarkupDesignBean parent = MarkupUnit.getMarkupDesignBeanForElement(parentComponentRootElement);
0217:            //        DesignBean[] designBeans = getDndSupport().pasteBeans(t, parent, null, location, jsfForm.getUpdateSuspender());
0218:            //        
0219:            //        if (designBeans == null) {
0220:            //            return new Element[0];
0221:            //        }
0222:            //        
0223:            //        List<Element> elements = new ArrayList<Element>();
0224:            //        for (DesignBean designBean : designBeans) {
0225:            //            if (designBean instanceof MarkupDesignBean) {
0226:            //                Element element = getComponentRootElementForMarkupDesignBean((MarkupDesignBean)designBean);
0227:            //                if (element != null) {
0228:            //                    elements.add(element);
0229:            //                }
0230:            //            }
0231:            //        }
0232:            //        return elements.toArray(new Element[elements.size()]);
0233:            //    }
0234:
0235:            //    public void importData(JComponent comp, Transferable t, Object transferData, Dimension dimension,
0236:
0237:            //    public void importData(JComponent comp, Transferable t, Object transferData, Dimension dimension,
0238:
0239:            //    public void importData(JComponent comp, Transferable t, Object transferData, Dimension dimension,
0240:
0241:            //    public void importData(JComponent comp, Transferable t, Object transferData, Dimension dimension,
0242:            //            DomProvider.Location location, DomProvider.CoordinateTranslator coordinateTranslator, int dropAction) {
0243:            //        getDndSupport().importData(comp, t, transferData, dimension, location, coordinateTranslator, dropAction);
0244:            //    }
0245:
0246:            //    public void importString(String string, DomProvider.Location location, DomProvider.CoordinateTranslator coordinateTranslator) {
0247:            //        getDndSupport().importString(string, location, coordinateTranslator);
0248:            //    }
0249:
0250:            //    public String[] getClassNames(DisplayItem[] displayItems) {
0251:            //        return getDndSupport().getClassNames(displayItems);
0252:            //    }
0253:
0254:            //    public boolean importBean(DisplayItem[] items, DesignBean origParent, int nodePos, String facet, List createdBeans, DomProvider.Location location, DomProvider.CoordinateTranslator coordinateTranslator) throws IOException {
0255:            //        return getDndSupport().importBean(items, origParent, nodePos, facet, createdBeans, location, coordinateTranslator);
0256:            //    }
0257:
0258:            //    public MarkupPosition getDefaultPositionUnderParent(DesignBean parent) {
0259:            //        return getDndSupport().getDefaultMarkupPositionUnderParent(parent);
0260:            //    }
0261:
0262:            //    public int computeActions(DesignBean droppee, Transferable transferable, boolean searchUp, int nodePos) {
0263:            public int computeActions(Element dropeeComponentRootElement,
0264:                    Transferable transferable) {
0265:                //        MarkupDesignBean droppee = MarkupUnit.getMarkupDesignBeanForElement(dropeeComponentRootElement);
0266:                //        return getDndSupport().computeActions(droppee, transferable);
0267:                return jsfForm.computeActions(dropeeComponentRootElement,
0268:                        transferable);
0269:            }
0270:
0271:            //    public DesignBean findParent(String className, DesignBean droppee, Node parentNode, boolean searchUp) {
0272:
0273:            //    public DesignBean findParent(String className, DesignBean droppee, Node parentNode, boolean searchUp) {
0274:
0275:            //    public DesignBean findParent(String className, DesignBean droppee, Node parentNode, boolean searchUp) {
0276:
0277:            //    public DesignBean findParent(String className, DesignBean droppee, Node parentNode, boolean searchUp) {
0278:            //        return Util.findParent(className, droppee, parentNode, searchUp, getFacesModel());
0279:            //    }
0280:
0281:            public int processLinks(Element origElement,
0282:                    Element componentRootElement) {
0283:                MarkupDesignBean markupDesignBean = MarkupUnit
0284:                        .getMarkupDesignBeanForElement(componentRootElement);
0285:                List<DesignBean> beans = new ArrayList<DesignBean>();
0286:                if (markupDesignBean != null) {
0287:                    beans.add(markupDesignBean);
0288:                }
0289:                return getDndSupport().processLinks(origElement, beans);
0290:            }
0291:
0292:            //    public boolean setDesignProperty(DesignBean bean, String attribute, int length) {
0293:
0294:            //    public boolean setDesignProperty(DesignBean bean, String attribute, int length) {
0295:
0296:            //    public boolean setDesignProperty(DesignBean bean, String attribute, int length) {
0297:
0298:            //    public boolean setDesignProperty(DesignBean bean, String attribute, int length) {
0299:            //        return Util.setDesignProperty(bean, attribute, length);
0300:            //    }
0301:
0302:            //    public boolean isBraveheartPage() {
0303:            //        return Util.isBraveheartPage(jsfForm.getJspDom());
0304:            //    }
0305:            //
0306:            //    public boolean isWoodstockPage() {
0307:            //        return Util.isWoodstockPage(jsfForm.getJspDom());
0308:            //    }
0309:
0310:            //    private /*public*/ FacesModel getFacesModel() {
0311:            //        return jsfForm.getFacesModel();
0312:            //    }
0313:
0314:            private DndSupport getDndSupport() {
0315:                return jsfForm.getDndSupport();
0316:            }
0317:
0318:            //    public boolean isFragment() {
0319:            //        return jsfForm.isFragment();
0320:            //    }
0321:            //
0322:            //    public boolean isPortlet() {
0323:            //        return jsfForm.isPortlet();
0324:            //    }
0325:
0326:            //    public DataObject getJspDataObject() {
0327:            //////        FileObject file = getFacesModel().getMarkupFile();
0328:            ////        FileObject file = jsfForm.getMarkupFile();
0329:            ////
0330:            ////        try {
0331:            ////            return DataObject.find(file);
0332:            ////        } catch (DataObjectNotFoundException ex) {
0333:            ////            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
0334:            ////
0335:            ////            return null;
0336:            ////        }
0337:            //        return jsfForm.getJspDataObject();
0338:            //    }
0339:
0340:            public URL getBaseUrl() {
0341:                //        MarkupUnit markupUnit = getFacesModel().getMarkupUnit();
0342:                MarkupUnit markupUnit = jsfForm.getMarkupUnit();
0343:                if (markupUnit == null) {
0344:                    // #6457856 NPE
0345:                    return null;
0346:                }
0347:                return markupUnit.getBase();
0348:            }
0349:
0350:            public URL resolveUrl(String urlString) {
0351:                return Util.resolveUrl(getBaseUrl(), jsfForm.getJspDom(),
0352:                        urlString);
0353:            }
0354:
0355:            /*public*/
0356:            /*public*/
0357:            /*public*/
0358:            /*public*/
0359:            /*public*/
0360:            /*public*/
0361:            /*public*/
0362:            /*public*/DocumentFragment renderHtmlForMarkupDesignBean(
0363:                    MarkupDesignBean markupDesignBean) {
0364:                //        return FacesPageUnit.renderHtml(getFacesModel(), markupDesignBean);
0365:                return jsfForm.renderMarkupDesignBean(markupDesignBean);
0366:            }
0367:
0368:            //    public Document getJspDom() {
0369:            //        return getFacesModel().getJspDom();
0370:            //    }
0371:
0372:            //    public void clearHtml() {
0373:            //        getFacesModel().clearHtml();
0374:            //    }
0375:
0376:            //    public List<FileObject> getWebPageFileObjectsInThisProject() {
0377:            //        return Util.getWebPages(getFacesModel().getProject(), true, false);
0378:            //    }
0379:
0380:            ////    public boolean editEventHandlerForDesignBean(DesignBean designBean) {
0381:            //    public boolean editEventHandlerForComponent(Element componentRootElement) {
0382:            ////        DesignBean designBean = MarkupUnit.getMarkupDesignBeanForElement(componentRootElement);
0383:            ////        if (designBean == null) {
0384:            //////            webform.getModel().openDefaultHandler(component);
0385:            ////            getFacesModel().openDefaultHandler();
0386:            ////            return false;
0387:            ////        } else {
0388:            ////            // See if it's an XHTML element; if so just show it in
0389:            ////            // the JSP source
0390:            //////            if (FacesSupport.isXhtmlComponent(component)) {
0391:            ////            if (isXhtmlComponent(designBean)) {
0392:            //////                MarkupBean mb = FacesSupport.getMarkupBean(component);
0393:            ////                MarkupBean mb = Util.getMarkupBean(designBean);
0394:            ////                
0395:            //////                MarkupUnit unit = webform.getMarkup();
0396:            ////                MarkupUnit unit = getFacesModel().getMarkupUnit();
0397:            ////                // <markup_separation>
0398:            //////                Util.show(null, unit.getFileObject(),
0399:            //////                    unit.computeLine((RaveElement)mb.getElement()), 0, true);
0400:            ////                // ====
0401:            //////                MarkupService.show(unit.getFileObject(), unit.computeLine((RaveElement)mb.getElement()), 0, true);
0402:            ////                showLineAt(unit.getFileObject(), unit.computeLine(mb.getElement()), 0);
0403:            ////                // </markup_separation>
0404:            ////            } else {
0405:            //////                webform.getModel().openDefaultHandler(component);
0406:            ////                getFacesModel().openDefaultHandler(designBean);
0407:            ////            }
0408:            ////
0409:            ////            return true;
0410:            ////        }
0411:            //        return jsfForm.editEventHandlerForComponent(componentRootElement);
0412:            //    }
0413:
0414:            //    public boolean canDropDesignBeansAtNode(DesignBean[] designBeans, Node node) {
0415:            public boolean canDropComponentsAtNode(
0416:                    Element[] componentRootElements, Node node) {
0417:                DesignBean parent = null;
0418:                while (node != null) {
0419:                    //            if (curr instanceof RaveElement) {
0420:                    //                parent = ((RaveElement)curr).getDesignBean();
0421:                    if (node instanceof  Element) {
0422:                        //                parent = InSyncService.getProvider().getMarkupDesignBeanForElement((Element)curr);
0423:                        //                parent = WebForm.getDomProviderService().getMarkupDesignBeanForElement((Element)curr);
0424:                        parent = MarkupUnit
0425:                                .getMarkupDesignBeanForElement((Element) node);
0426:
0427:                        if (parent != null) {
0428:                            break;
0429:                        }
0430:                    }
0431:
0432:                    node = node.getParentNode();
0433:                }
0434:
0435:                if (parent == null) {
0436:                    return true;
0437:                }
0438:
0439:                // See if ALL the beans being dragged can be dropped here
0440:                //        LiveUnit unit = webform.getModel().getLiveUnit();
0441:                //        LiveUnit unit = getFacesModel().getLiveUnit();
0442:                LiveUnit unit = jsfForm.getLiveUnit();
0443:
0444:                List<DesignBean> beans = new ArrayList<DesignBean>();
0445:                for (Element componentRootElement : componentRootElements) {
0446:                    MarkupDesignBean markupDesignBean = MarkupUnit
0447:                            .getMarkupDesignBeanForElement(componentRootElement);
0448:                    if (markupDesignBean != null) {
0449:                        beans.add(markupDesignBean);
0450:                    }
0451:                }
0452:                DesignBean[] designBeans = beans.toArray(new DesignBean[beans
0453:                        .size()]);
0454:
0455:                //        for (int i = 0, n = beans.size(); i < n; i++) {
0456:                //            DesignBean bean = (DesignBean)beans.get(i);
0457:                for (DesignBean bean : designBeans) {
0458:                    String className = bean.getInstance().getClass().getName();
0459:
0460:                    if (!unit.canCreateBean(className, parent, null)) {
0461:                        return false;
0462:                    }
0463:
0464:                    // Ensure that we're not trying to drop a html bean on a
0465:                    // renders-children parent
0466:                    boolean isHtmlBean = className.startsWith(HtmlBean.PACKAGE);
0467:
0468:                    if (isHtmlBean) {
0469:                        // We can't drop anywhere below a "renders children" JSF
0470:                        // component
0471:                        //                if (parent != FacesSupport.findHtmlContainer(webform, parent)) {
0472:                        //                if (parent != webform.findHtmlContainer(parent)) {
0473:                        if (parent != Util.findHtmlContainer(parent)) {
0474:                            return false;
0475:                        }
0476:                    }
0477:                }
0478:
0479:                return true;
0480:            }
0481:
0482:            //    public boolean handleMouseClickForElement(Element element, int clickCount) {
0483:            //        MarkupMouseRegion region = findRegion(element);
0484:            //
0485:            //        if ((region != null) && region.isClickable()) {
0486:            //            Result r = region.regionClicked(clickCount);
0487:            ////            ResultHandler.handleResult(r, getFacesModel());
0488:            //            jsfForm.handleResult(r);
0489:            //            // #6353410 If there was performed click on the region
0490:            //            // then do not perform other actions on the same click.
0491:            //            return true;
0492:            //        }
0493:            //        return false;
0494:            //    }
0495:
0496:            //    public boolean isNormalAndHasFacesBean(MarkupDesignBean markupDesignBean) {
0497:
0498:            //    public boolean isNormalAndHasFacesBean(MarkupDesignBean markupDesignBean) {
0499:
0500:            //    public boolean isNormalAndHasFacesBean(MarkupDesignBean markupDesignBean) {
0501:
0502:            //    public boolean isNormalAndHasFacesBean(MarkupDesignBean markupDesignBean) {
0503:            //    public boolean isNormalAndHasFacesComponent(Element componentRootElement) {
0504:            //        MarkupDesignBean markupDesignBean = MarkupUnit.getMarkupDesignBeanForElement(componentRootElement);
0505:            //        if (markupDesignBean != null) {
0506:            //            FacesBean fb = Util.getFacesBean(markupDesignBean);
0507:            //            if ((fb != null) && !Util.isSpecialBean(markupDesignBean)) {
0508:            //                return true;
0509:            //            }
0510:            //        }
0511:            //        return false;
0512:            //    }
0513:
0514:            private/*public*/boolean canHighlightMarkupDesignBean(
0515:                    MarkupDesignBean markupDesignBean) {
0516:                if (markupDesignBean == null) {
0517:                    return false;
0518:                }
0519:                //        FacesPageUnit facesUnit = getFacesModel().getFacesUnit();
0520:                FacesPageUnit facesUnit = jsfForm.getFacesPageUnit();
0521:                if ((facesUnit == null)
0522:                        || ((facesUnit.getDefaultParent() != Util
0523:                                .getMarkupBean(markupDesignBean)) && (markupDesignBean
0524:                                .getElement() != MarkupService
0525:                                .getSourceElementForElement(getHtmlBody())))) {
0526:                    return true;
0527:                }
0528:                return false;
0529:            }
0530:
0531:            public boolean canHighlightComponentRootElmenet(
0532:                    Element componentRootElement) {
0533:                if (componentRootElement == null) {
0534:                    return false;
0535:                }
0536:                MarkupDesignBean markupDesignBean = MarkupUnit
0537:                        .getMarkupDesignBeanForElement(componentRootElement);
0538:                return canHighlightMarkupDesignBean(markupDesignBean);
0539:            }
0540:
0541:            // XXX Copy also in insync/FacesDnDSupport.
0542:
0543:            // XXX Copy also in insync/FacesDnDSupport.
0544:
0545:            // XXX Copy also in insync/FacesDnDSupport.
0546:
0547:            //    // XXX Copy also in insync/FacesDnDSupport.
0548:            //    /*public*/ private DesignBean createBean(String className, Node parent, Node before) {
0549:            //        MarkupPosition pos = new MarkupPosition(parent, before);
0550:            //        DesignBean parentBean = /*FacesSupport.*/Util.findParentBean(parent);
0551:            //        LiveUnit unit = getFacesModel().getLiveUnit();
0552:            //        return unit.createBean(className, parentBean, pos);
0553:            //    }
0554:
0555:            //    // XXX Get rid of too.
0556:            //    public Element createComponent(String className, Node parent, Node before) {
0557:            //        DesignBean designBean = createBean(className, parent, before);
0558:            //        return designBean instanceof MarkupDesignBean ? ((MarkupDesignBean)designBean).getElement() : null;
0559:            //    }
0560:
0561:            //    public boolean isFormBean(DesignBean designBean) {
0562:
0563:            //    public boolean isFormBean(DesignBean designBean) {
0564:
0565:            //    public boolean isFormBean(DesignBean designBean) {
0566:
0567:            //    public boolean isFormBean(DesignBean designBean) {
0568:            //        return Util.isFormBean(getFacesModel(), designBean);
0569:            //    }
0570:
0571:            //    public Element getDefaultParentMarkupBeanElement() {
0572:            //        FacesPageUnit unit = getFacesModel().getFacesUnit();
0573:            //        if (unit != null) {
0574:            //            MarkupBean mb = unit.getDefaultParent();
0575:            ////            RaveElement element = (RaveElement)mb.getElement();
0576:            //            return mb.getElement();
0577:            //        }
0578:            //        return null;
0579:            //    }
0580:
0581:            //    public boolean moveBean(DesignBean bean, Node parentNode, Node before) {
0582:            //        LiveUnit lu = getFacesModel().getLiveUnit();
0583:            //        MarkupPosition markupPos = new MarkupPosition(parentNode, before);
0584:            //        DesignBean parentBean = null;
0585:            //        Node e = parentNode;
0586:            //
0587:            //        while (e != null) {
0588:            ////            if (e instanceof RaveElement) {
0589:            ////                parentBean = ((RaveElement)e).getDesignBean();
0590:            //            if (e instanceof Element) {
0591:            ////                parentBean = InSyncService.getProvider().getMarkupDesignBeanForElement((Element)e);
0592:            //                parentBean = MarkupUnit.getMarkupDesignBeanForElement((Element)e);
0593:            //                
0594:            //                if (parentBean != null) {
0595:            //                    break;
0596:            //                }
0597:            //            }
0598:            //
0599:            //            e = e.getParentNode();
0600:            //        }
0601:            //
0602:            //        if (bean == parentBean) {
0603:            //            return false;
0604:            //        }
0605:            //
0606:            //        return lu.moveBean(bean, parentBean, markupPos);
0607:            //    }
0608:
0609:            /*public*/boolean setPrerenderedBean(
0610:                    MarkupDesignBean markupDesignBean,
0611:                    DocumentFragment documentFragment) {
0612:                //        LiveUnit lu = getFacesModel().getLiveUnit();
0613:                LiveUnit lu = jsfForm.getLiveUnit();
0614:                BeansUnit bu = lu.getBeansUnit();
0615:
0616:                FacesPageUnit facesPageUnit;
0617:                if (bu instanceof  FacesPageUnit) {
0618:                    facesPageUnit = (FacesPageUnit) bu;
0619:                } else {
0620:                    return false;
0621:                }
0622:
0623:                facesPageUnit
0624:                        .setPreRendered(markupDesignBean, documentFragment);
0625:                return true;
0626:            }
0627:
0628:            //    public org.openide.nodes.Node getRootBeanNode() {
0629:            ////        FacesModel facesModel = getFacesModel();
0630:            ////        DesignBean rootBean = facesModel.getRootBean();
0631:            ////        if (rootBean == null) {
0632:            ////            // XXX If the model is busted then it is supposed to be OK, there is an error, see e.g. #6478860.
0633:            ////            if (!facesModel.isBusted()) {
0634:            ////                ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,
0635:            ////                        new IllegalStateException("Invalid FacesModel, it is not busted and its root design bean is null, facesModel=" + facesModel)); // NOI18N
0636:            ////            }
0637:            ////            return null;
0638:            ////        } else {
0639:            ////            return DesigntimeIdeBridgeProvider.getDefault().getNodeRepresentation(rootBean);
0640:            ////        }
0641:            //        return jsfForm.getRootBeanNode();
0642:            //    }
0643:
0644:            //    public void deleteBean(DesignBean designBean) {
0645:
0646:            //    public void deleteBean(DesignBean designBean) {
0647:
0648:            //    public void deleteBean(DesignBean designBean) {
0649:
0650:            //    public void deleteBean(DesignBean designBean) {
0651:            //    public void deleteComponent(Element componentRootElement) {
0652:            //        DesignBean designBean = MarkupUnit.getMarkupDesignBeanForElement(componentRootElement);
0653:            //        if (designBean == null) {
0654:            //            return;
0655:            //        }
0656:            //        getFacesModel().getLiveUnit().deleteBean(designBean);
0657:            //    }
0658:
0659:            //    // XXX TODO Get rid of this.
0660:
0661:            //    // XXX TODO Get rid of this.
0662:
0663:            //    // XXX TODO Get rid of this.
0664:
0665:            //    // XXX TODO Get rid of this.
0666:            //    public DesignBean getDefaultParentBean() {
0667:            //        LiveUnit liveUnit = getFacesModel().getLiveUnit();
0668:            //        if (liveUnit != null) {
0669:            //            MarkupBean bean = getFacesModel().getFacesUnit().getDefaultParent();
0670:            //
0671:            //            if (bean != null) {
0672:            //                return liveUnit.getDesignBean(bean);
0673:            //            }
0674:            //        }
0675:            //
0676:            //        return null;
0677:            //    }
0678:            //    // XXX Replacing the above
0679:            //    public Element getDefaultParentComponent() {
0680:            //////        LiveUnit liveUnit = getFacesModel().getLiveUnit();
0681:            ////        LiveUnit liveUnit = jsfForm.getLiveUnit();
0682:            ////        if (liveUnit != null) {
0683:            //////            MarkupBean bean = getFacesModel().getFacesUnit().getDefaultParent();
0684:            ////            MarkupBean bean = jsfForm.getFacesPageUnit().getDefaultParent();
0685:            ////
0686:            ////            if (bean != null) {
0687:            ////                DesignBean designBean = liveUnit.getDesignBean(bean);
0688:            ////                return designBean instanceof MarkupDesignBean ? getComponentRootElementForMarkupDesignBean((MarkupDesignBean)designBean) : null;
0689:            ////            }
0690:            ////        }
0691:            ////
0692:            ////        return null;
0693:            //        return jsfForm.getDefaultParentComponent();
0694:            //    }
0695:
0696:            //    private /*public*/ Exception getRenderFailure() {
0697:            //        FacesPageUnit facesPageUnit = getFacesModel().getFacesUnit();
0698:            //        if (facesPageUnit == null) {
0699:            //            return null;
0700:            //        }
0701:            //        return facesPageUnit.getRenderFailure();
0702:            //    }
0703:            //
0704:            //    private /*public*/ MarkupDesignBean getRenderFailureMarkupDesignBean() {
0705:            //        FacesPageUnit facesPageUnit = getFacesModel().getFacesUnit();
0706:            //        if (facesPageUnit == null) {
0707:            //            return null;
0708:            //        }
0709:            //        DesignBean designBean = facesPageUnit.getRenderFailureComponent();
0710:            //        if (designBean instanceof MarkupDesignBean) {
0711:            //            return (MarkupDesignBean)designBean;
0712:            //        } else {
0713:            //            return null;
0714:            //        }
0715:            //    }
0716:
0717:            //    public void setRenderFailedValues(MarkupDesignBean renderFailureComponent, Exception renderFailureException) {
0718:
0719:            //    public void setRenderFailedValues(MarkupDesignBean renderFailureComponent, Exception renderFailureException) {
0720:
0721:            //    public void setRenderFailedValues(MarkupDesignBean renderFailureComponent, Exception renderFailureException) {
0722:
0723:            //    public void setRenderFailedValues(MarkupDesignBean renderFailureComponent, Exception renderFailureException) {
0724:            //        jsfForm.setRenderFailureValues(renderFailureComponent, renderFailureException);
0725:            //    }
0726:
0727:            //    public void setRenderFailureValues() {
0728:            //        Exception failure = getRenderFailure();
0729:            //        MarkupDesignBean renderFailureComponent = getRenderFailureMarkupDesignBean();
0730:            //        jsfForm.setRenderFailureValues(renderFailureComponent, failure);
0731:            //    }
0732:
0733:            //    public boolean hasRenderFailure() {
0734:            //        return jsfForm.getRenderFailureException() != null;
0735:            //    }
0736:
0737:            // >>> XXX RenderFailureProvider >>>
0738:
0739:            // >>> XXX RenderFailureProvider >>>
0740:
0741:            // >>> XXX RenderFailureProvider >>>
0742:
0743:            // >>> XXX RenderFailureProvider >>>
0744:            //    public Exception getRenderFailureException() {
0745:            //        return jsfForm.getRenderFailureException();
0746:            //    }
0747:
0748:            //    public MarkupDesignBean getRenderFailureComponent() {
0749:            //        return jsfForm.getRenderFailureComponent();
0750:            //    }
0751:            // >>> XXX RenderFailureProvider <<<
0752:            // >>> XXX RenderFailureProvider <<<
0753:            // >>> XXX RenderFailureProvider <<<
0754:            // >>> XXX RenderFailureProvider <<<
0755:
0756:            //    public boolean hasRenderingErrors() {
0757:            //        return jsfForm.getRenderFailureComponent() != null;
0758:            //    }
0759:
0760:            //    public void syncModel() {
0761:            //        getFacesModel().sync();
0762:            //    }
0763:
0764:            //    public DomProvider.ErrorPanel getErrorPanel(DomProvider.ErrorPanelCallback errorPanelCallback) {
0765:            //        FacesModel facesModel = getFacesModel();
0766:            //        if (facesModel.isBusted()) {
0767:            //            return new ErrorPanelImpl(facesModel, facesModel.getErrors(), errorPanelCallback);
0768:            //        } else {
0769:            //            return new RenderErrorPanelImpl(facesModel, errorPanelCallback, this);
0770:            //        }
0771:            //    }
0772:
0773:            //    public boolean isSourceDirty() {
0774:            //        MarkupUnit markupUnit = getFacesModel().getMarkupUnit();
0775:            //        if (markupUnit != null) {
0776:            //            return markupUnit.getState() == Unit.State.SOURCEDIRTY;
0777:            //        } else {
0778:            //            // XXX #6478973 Model could be corrupted, until #6480764 is fixed.
0779:            //            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,
0780:            //                    new IllegalStateException("The FacesModel is corrupted, its markup unit is null, facesModel=" + getFacesModel())); // NOI18N
0781:            //        }
0782:            //        return false;
0783:            //    }
0784:
0785:            //    public Transferable copyBeans(DesignBean[] beans) {
0786:
0787:            //    public Transferable copyBeans(DesignBean[] beans) {
0788:
0789:            //    public Transferable copyBeans(DesignBean[] beans) {
0790:
0791:            //    public Transferable copyBeans(DesignBean[] beans) {
0792:            //    public Transferable copyComponents(Element[] componentRootElements) {
0793:            //        List<DesignBean> beans = new ArrayList<DesignBean>();
0794:            //        for (Element componentRootElement : componentRootElements) {
0795:            //            DesignBean bean = MarkupUnit.getMarkupDesignBeanForElement(componentRootElement);
0796:            //            if (bean != null) {
0797:            //                beans.add(bean);
0798:            //            }
0799:            //        }
0800:            //        LiveUnit liveUnit = getFacesModel().getLiveUnit();
0801:            //        return liveUnit.copyBeans(beans.toArray(new DesignBean[beans.size()]));
0802:            //    }
0803:
0804:            //    public DomProvider.WriteLock writeLock(String message) {
0805:            //        UndoEvent undoEvent = getFacesModel().writeLock(message);
0806:            //        return new WriteLockImpl(undoEvent);
0807:            //    }
0808:            //
0809:            //    public void writeUnlock(DomProvider.WriteLock writeLock) {
0810:            //        if (writeLock instanceof WriteLockImpl) {
0811:            //            WriteLockImpl wl = (WriteLockImpl)writeLock;
0812:            //            getFacesModel().writeUnlock(wl.getUndoEvent());
0813:            //        } else {
0814:            //            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,
0815:            //                    new IllegalStateException("WriteLock is not of expected impl type, writeLock=" + writeLock)); // NOI18N
0816:            //        }
0817:            //    }
0818:            //
0819:            //    public boolean isWriteLocked() {
0820:            ////        return getFacesModel().isWriteLocked();
0821:            //        return jsfForm.isWriteLocked();
0822:            //    }
0823:
0824:            //    public void readLock() {
0825:            ////        MarkupUnit markupUnit = getFacesModel().getMarkupUnit();
0826:            //        MarkupUnit markupUnit = jsfForm.getMarkupUnit();
0827:            //        if (markupUnit != null) {
0828:            //            markupUnit.readLock();
0829:            //        }
0830:            //    }
0831:            //
0832:            //    public void readUnlock() {
0833:            ////        MarkupUnit markupUnit = getFacesModel().getMarkupUnit();
0834:            //        MarkupUnit markupUnit = jsfForm.getMarkupUnit();
0835:            //        if (markupUnit != null) {
0836:            //            markupUnit.readUnlock();
0837:            //        }
0838:            //    }
0839:
0840:            //    public boolean isModelValid() {
0841:            ////        MarkupUnit markupUnit = getFacesModel().getMarkupUnit();
0842:            ////        if (markupUnit == null) {
0843:            ////            return false;
0844:            ////        }
0845:            ////        return getFacesModel().isValid();
0846:            //        return jsfForm.isModelValid();
0847:            //    }
0848:
0849:            //    public boolean isModelBusted() {
0850:            ////        return getFacesModel().isBusted();
0851:            //        return jsfForm.isModelBusted();
0852:            //    }
0853:
0854:            //    public void setModelActivated(boolean activated) {
0855:            //        getFacesModel().setActivated(activated);
0856:            //    }
0857:
0858:            //    public UndoRedo getUndoManager() {
0859:            //        return getFacesModel().getUndoManager();
0860:            //    }
0861:
0862:            //    public DesignBean[] getBeansOfType(Class clazz) {
0863:
0864:            //    public DesignBean[] getBeansOfType(Class clazz) {
0865:
0866:            //    public DesignBean[] getBeansOfType(Class clazz) {
0867:
0868:            //    public DesignBean[] getBeansOfType(Class clazz) {
0869:            //        LiveUnit liveUnit = getFacesModel().getLiveUnit();
0870:            //        return liveUnit.getBeansOfType(clazz);
0871:            //    }
0872:
0873:            //    public Project getProject() {
0874:            //        return getFacesModel().getProject();
0875:            //    }
0876:
0877:            //    public boolean isPage() {
0878:            ////        return getFacesModel().getFacesUnit().isPage();
0879:            //        return jsfForm.getFacesPageUnit().isPage();
0880:            //    }
0881:
0882:            //    public boolean isAlive() {
0883:            ////        return getFacesModel().getLiveUnit() != null;
0884:            //        return jsfForm.getLiveUnit() != null;
0885:            //    }
0886:
0887:            public boolean isFormComponent(Element componentRootElement) {
0888:                //        MarkupDesignBean bean = MarkupUnit.getMarkupDesignBeanForElement(componentRootElement);
0889:                //        if (bean == null) {
0890:                //            return false;
0891:                //        }
0892:                ////        return Util.isFormBean(getFacesModel(), bean);
0893:                //        return jsfForm.isFormDesignBean(bean);
0894:                return jsfForm.isFormComponent(componentRootElement);
0895:            }
0896:
0897:            public int getDropType(
0898:                    /*DesignBean origDroppee,*/Element origDropeeComponentRootElement,
0899:                    Element droppeeElement, Transferable t, boolean linkOnly) {
0900:                MarkupDesignBean origDroppee;
0901:                if (origDropeeComponentRootElement == null
0902:                        && jsfForm.isGridMode()) {
0903:                    origDroppee = jsfForm.getDefaultParentBean();
0904:                } else {
0905:                    origDroppee = MarkupUnit
0906:                            .getMarkupDesignBeanForElement(origDropeeComponentRootElement);
0907:                }
0908:                return getDndSupport().getDropType(origDroppee, droppeeElement,
0909:                        t, linkOnly);
0910:            }
0911:
0912:            //    public int getDropTypeForClassNames(DesignBean origDroppee, Element droppeeElement, String[] classNames, DesignBean[] beans, boolean linkOnly) {
0913:
0914:            //    public int getDropTypeForClassNames(DesignBean origDroppee, Element droppeeElement, String[] classNames, DesignBean[] beans, boolean linkOnly) {
0915:
0916:            //    public int getDropTypeForClassNames(DesignBean origDroppee, Element droppeeElement, String[] classNames, DesignBean[] beans, boolean linkOnly) {
0917:
0918:            //    public int getDropTypeForClassNames(DesignBean origDroppee, Element droppeeElement, String[] classNames, DesignBean[] beans, boolean linkOnly) {
0919:            public int getDropTypeForComponent(
0920:                    /*DesignBean origDroppee,*/Element origDropeeComponentRootElement,
0921:                    Element droppeeElement, Element componentRootElement,
0922:                    boolean linkOnly) {
0923:                MarkupDesignBean origDroppee;
0924:                if (origDropeeComponentRootElement == null
0925:                        && jsfForm.isGridMode()) {
0926:                    origDroppee = jsfForm.getDefaultParentBean();
0927:                } else {
0928:                    origDroppee = MarkupUnit
0929:                            .getMarkupDesignBeanForElement(origDropeeComponentRootElement);
0930:                }
0931:                MarkupDesignBean markupDesignBean = MarkupUnit
0932:                        .getMarkupDesignBeanForElement(componentRootElement);
0933:                // XXX Like the original old code.
0934:                String[] classNames;
0935:                DesignBean[] beans;
0936:                if (markupDesignBean == null) {
0937:                    classNames = new String[0];
0938:                    beans = new DesignBean[0];
0939:                } else {
0940:                    classNames = new String[] { markupDesignBean.getInstance()
0941:                            .getClass().getName() };
0942:                    beans = new DesignBean[] { markupDesignBean };
0943:                }
0944:                return getDndSupport().getDropTypeForClassNames(origDroppee,
0945:                        droppeeElement, classNames, beans, linkOnly);
0946:            }
0947:
0948:            public Element getComponentRootElementEquivalentTo(
0949:                    Element oldComponentRootElement) {
0950:                MarkupDesignBean oldMarkupDesignBean = MarkupUnit
0951:                        .getMarkupDesignBeanForElement(oldComponentRootElement);
0952:                if (oldMarkupDesignBean == null) {
0953:                    return null;
0954:                }
0955:                MarkupDesignBean newMarkupDesignBean = getMarkupDesignBeanEquivalentTo(oldMarkupDesignBean);
0956:                //        if (oldMarkupDesignBean == newMarkupDesignBean) {
0957:                //            return oldComponentRootElement;
0958:                //        }
0959:                return getComponentRootElementForMarkupDesignBean(newMarkupDesignBean);
0960:            }
0961:
0962:            private/*public*/MarkupDesignBean getMarkupDesignBeanEquivalentTo(
0963:                    MarkupDesignBean oldBean) {
0964:                //        LiveUnit liveUnit = getFacesModel().getLiveUnit();
0965:                LiveUnit liveUnit = jsfForm.getLiveUnit();
0966:                if (liveUnit == null) {
0967:                    return null;
0968:                }
0969:                DesignBean newBean = liveUnit.getBeanEquivalentTo(oldBean);
0970:                return newBean instanceof  MarkupDesignBean ? (MarkupDesignBean) newBean
0971:                        : null;
0972:            }
0973:
0974:            static Element getComponentRootElementForMarkupDesignBean(
0975:                    MarkupDesignBean markupDesignBean) {
0976:                if (markupDesignBean == null) {
0977:                    return null;
0978:                }
0979:                Element sourceElement = markupDesignBean.getElement();
0980:                return MarkupService
0981:                        .getRenderedElementForElement(sourceElement);
0982:            }
0983:
0984:            public boolean moveComponent(Element componentRootElement,
0985:                    Node parentNode, Node before) {
0986:                //        MarkupDesignBean bean = MarkupUnit.getMarkupDesignBeanForElement(componentRootElement);
0987:                //        if (bean == null) {
0988:                //            return false;
0989:                //        }
0990:                //        
0991:                ////        LiveUnit lu = getFacesModel().getLiveUnit();
0992:                //        LiveUnit lu = jsfForm.getLiveUnit();
0993:                //        MarkupPosition markupPos = new MarkupPosition(parentNode, before);
0994:                //        DesignBean parentBean = null;
0995:                //        Node e = parentNode;
0996:                //
0997:                //        while (e != null) {
0998:                ////            if (e instanceof RaveElement) {
0999:                ////                parentBean = ((RaveElement)e).getDesignBean();
1000:                //            if (e instanceof Element) {
1001:                ////                parentBean = InSyncService.getProvider().getMarkupDesignBeanForElement((Element)e);
1002:                //                parentBean = MarkupUnit.getMarkupDesignBeanForElement((Element)e);
1003:                //                
1004:                //                if (parentBean != null) {
1005:                //                    break;
1006:                //                }
1007:                //            }
1008:                //
1009:                //            e = e.getParentNode();
1010:                //        }
1011:                //
1012:                //        if (bean == parentBean) {
1013:                //            return false;
1014:                //        }
1015:                //
1016:                //        return lu.moveBean(bean, parentBean, markupPos);
1017:                return jsfForm.moveComponent(componentRootElement, parentNode,
1018:                        before);
1019:            }
1020:
1021:            //    public void setUpdatesSuspended(Element componentRootElement, boolean suspend) {
1022:            //        MarkupDesignBean markupDesignBean = MarkupUnit.getMarkupDesignBeanForElement(componentRootElement);
1023:            //        jsfForm.setUpdatesSuspended(markupDesignBean, suspend);
1024:            //    }
1025:
1026:            //////////
1027:
1028:            //////////
1029:
1030:            //////////
1031:
1032:            //////////
1033:            // Helpers
1034:            // XXX Copied from DesignerActions.
1035:            //    /** Return true iff the given DesignBean is an XHTML markup "component" */
1036:            //    private static boolean isXhtmlComponent(DesignBean bean) {
1037:            ////        MarkupBean mb = FacesSupport.getMarkupBean(bean);
1038:            //        MarkupBean mb = Util.getMarkupBean(bean);
1039:            //
1040:            //        return (mb != null) && !(mb instanceof FacesBean);
1041:            //    }
1042:
1043:            // XXX Copied from MarkupUtilities.
1044:
1045:            // XXX Copied from MarkupUtilities.
1046:
1047:            // XXX Copied from MarkupUtilities.
1048:
1049:            // XXX Copied from MarkupUtilities.
1050:            //    // XXX Copied from DesignerActions.
1051:            //    private static void showLineAt(FileObject fo, int lineno, int column) {
1052:            //        DataObject dobj;
1053:            //        try {
1054:            //            dobj = DataObject.find(fo);
1055:            //        }
1056:            //        catch (DataObjectNotFoundException ex) {
1057:            //            ErrorManager.getDefault().notify(ex);
1058:            //            return;
1059:            //        }
1060:            //
1061:            //        // Try to open doc before showing the line. This SHOULD not be
1062:            //        // necessary, except without this the IDE hangs in its attempt
1063:            //        // to open the file when the file in question is a CSS file.
1064:            //        // Probably a bug in the xml/css module's editorsupport code.
1065:            //        // This has the negative effect of first flashing the top
1066:            //        // of the file before showing the destination line, so
1067:            //        // this operation is made conditional so only clients who
1068:            //        // actually need it need to use it.
1069:            //        EditorCookie ec = (EditorCookie)dobj.getCookie(EditorCookie.class);
1070:            //        if (ec != null) {
1071:            //            try {
1072:            //                ec.openDocument(); // ensure that it has been opened - REDUNDANT?
1073:            //                //ec.open();
1074:            //            }
1075:            //            catch (IOException ex) {
1076:            //                ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
1077:            //            }
1078:            //        }
1079:            //
1080:            //        LineCookie lc = (LineCookie)dobj.getCookie(LineCookie.class);
1081:            //        if (lc != null) {
1082:            //            Line.Set ls = lc.getLineSet();
1083:            //            if (ls != null) {
1084:            //                // -1: convert line numbers to be zero-based
1085:            //                Line line = ls.getCurrent(lineno-1);
1086:            //                // TODO - pass in a column too?
1087:            //                line.show(Line.SHOW_GOTO, column);
1088:            //            }
1089:            //        }
1090:            //    }
1091:
1092:            // XXX Moved from FacesSupport.
1093:            //    /** Locate the closest mouse region to the given element */
1094:            //    private static MarkupMouseRegion findRegion(Element element) {
1095:            //        while (element != null) {
1096:            ////            if (element.getMarkupMouseRegion() != null) {
1097:            ////                return element.getMarkupMouseRegion();
1098:            ////            }
1099:            ////            MarkupMouseRegion region = InSyncService.getProvider().getMarkupMouseRegionForElement(element);
1100:            //            MarkupMouseRegion region = FacesPageUnit.getMarkupMouseRegionForElement(element);
1101:            //            if (region != null) {
1102:            //                return region;
1103:            //            }
1104:            //
1105:            //            if (element.getParentNode() instanceof Element) {
1106:            //                element = (Element)element.getParentNode();
1107:            //            } else {
1108:            //                break;
1109:            //            }
1110:            //        }
1111:            //
1112:            //        return null;
1113:            //    }
1114:
1115:            //    private static class WriteLockImpl implements DomProvider.WriteLock {
1116:            //        private final UndoEvent undoEvent;
1117:            //        
1118:            //        public WriteLockImpl(UndoEvent undoEvent) {
1119:            //            this.undoEvent = undoEvent;
1120:            //        }
1121:            //        
1122:            //        public UndoEvent getUndoEvent() {
1123:            //            return undoEvent;
1124:            //        }
1125:            //        
1126:            //    } // End of WriteLockImpl.
1127:
1128:            public DomProvider.InlineEditorSupport createInlineEditorSupport(
1129:                    Element componentRootElement, String propertyName,
1130:                    String xpath) {
1131:                MarkupDesignBean markupDesignBean = MarkupUnit
1132:                        .getMarkupDesignBeanForElement(componentRootElement);
1133:                if (markupDesignBean == null) {
1134:                    //            return InlineEditorSupportImpl.createDummyInlineEditorSupport();
1135:                    return null;
1136:                }
1137:                DesignProperty designProperty = markupDesignBean
1138:                        .getProperty(propertyName);
1139:                if (designProperty == null) {
1140:                    //            return InlineEditorSupportImpl.createDummyInlineEditorSupport();
1141:                    return null;
1142:                }
1143:
1144:                return new InlineEditorSupportImpl(jsfForm, this ,
1145:                        markupDesignBean, designProperty, xpath);
1146:            }
1147:
1148:            //    public void dumpHtmlMarkupForNode(org.openide.nodes.Node node) {
1149:            //        DesignBean designBean = (DesignBean)node.getLookup().lookup(DesignBean.class);
1150:            //        if (designBean instanceof MarkupDesignBean) {
1151:            //            MarkupDesignBean markupDesignBean = (MarkupDesignBean)designBean;
1152:            //            Element sourceElement = markupDesignBean.getElement();
1153:            //            Element renderedElement = MarkupService.getRenderedElementForElement(sourceElement);
1154:            //            if (renderedElement == null || sourceElement == renderedElement) {
1155:            //                System.err.println("\nMarkup design bean not renderable, markup design bean=" + markupDesignBean); // NOI18N
1156:            //                dumpHtmlMarkupDesignBeanHtml();
1157:            //                return;
1158:            //            }
1159:            //            System.err.println("\nRendered markup design bean=" + markupDesignBean); // NOI18N
1160:            //            System.err.println(Util.getHtmlStream(renderedElement));
1161:            //        } else {
1162:            //            System.err.println("\nDesign bean not renderable, design bean=" + designBean); // NOI18N
1163:            //            dumpHtmlMarkupDesignBeanHtml();
1164:            //        }
1165:            //    }
1166:            //    
1167:            //    private void dumpHtmlMarkupDesignBeanHtml() {
1168:            //        DocumentFragment df = getHtmlDocumentFragment();
1169:            //        Element html = Util.findDescendant(HtmlTag.HTML.name, df);
1170:            //        if (html == null) {
1171:            //            return;
1172:            //        }
1173:            //        System.err.println("\nRendered html element markup design bean=" + MarkupUnit.getMarkupDesignBeanForElement(html)); // NOI18N
1174:            //        System.err.println(Util.getHtmlStream(html)); // NOI18N
1175:            //    }
1176:
1177:            //    private static final DataFlavor FLAVOR_DISPLAY_ITEM = new DataFlavor(
1178:            //            DataFlavor.javaJVMLocalObjectMimeType + "; class=" + DisplayItem.class.getName(), // NOI18N
1179:            //            "RAVE_PALETTE_ITEM"); // TODO get rid of such name.
1180:
1181:            //    public boolean canPasteTransferable(Transferable trans) {
1182:            ////        if (trans != null) {
1183:            ////            DataFlavor[] df = trans.getTransferDataFlavors();
1184:            ////            int n = 0;
1185:            ////
1186:            ////            if (df != null) {
1187:            ////                n = df.length;
1188:            ////            }
1189:            ////
1190:            ////            for (int i = 0; i < n; i++) {
1191:            ////                DataFlavor flavor = df[i];
1192:            ////
1193:            ////		// XXX TODO Get rid of this dep, you can specify your own data flavor
1194:            ////		// which can match, there will be created new data flavors avoiding
1195:            ////		// usage of .
1196:            ////                if (FLAVOR_DISPLAY_ITEM.equals(flavor)
1197:            ////		|| (flavor.getRepresentationClass() == String.class)
1198:            ////		|| flavor.getMimeType().startsWith("application/x-creator-")) { // NOI18N
1199:            ////                    // Yes!
1200:            ////                    return true;
1201:            ////                }
1202:            ////            }
1203:            ////        }
1204:            ////        return false;
1205:            //        return jsfForm.canPasteTransferable(trans);
1206:            //    }
1207:
1208:            public void importString(Designer designer, String string,
1209:                    Point canvasPos, Node documentPosNode,
1210:                    int documentPosOffset, Dimension dimension, boolean isGrid,
1211:                    Element droppeeElement, Element dropeeComponentRootElement/*, Element defaultParentComponentRootElement, DomProvider.CoordinateTranslator coordinateTranslator*/) {
1212:                DesignBean droppeeBean;
1213:                if (dropeeComponentRootElement == null && jsfForm.isGridMode()) {
1214:                    droppeeBean = jsfForm.getDefaultParentBean();
1215:                } else {
1216:                    droppeeBean = MarkupUnit
1217:                            .getMarkupDesignBeanForElement(dropeeComponentRootElement);
1218:                }
1219:                //        DesignBean defaultParent = MarkupUnit.getMarkupDesignBeanForElement(defaultParentComponentRootElement);
1220:                DesignBean defaultParent = jsfForm.getDefaultParentBean();
1221:                getDndSupport()
1222:                        .importString(designer, string, canvasPos,
1223:                                documentPosNode, documentPosOffset, dimension,
1224:                                isGrid, droppeeElement, droppeeBean,
1225:                                defaultParent/*, coordinateTranslator*/);
1226:            }
1227:
1228:            public boolean importData(
1229:                    Designer designer,
1230:                    JComponent comp,
1231:                    Transferable t, /*Object transferData,*/
1232:                    Point canvasPos,
1233:                    Node documentPosNode,
1234:                    int documentPosOffset,
1235:                    Dimension dimension,
1236:                    boolean isGrid,
1237:                    Element droppeeElement,
1238:                    Element dropeeComponentRootElement/*, Element defaultParentComponentRootElement, DomProvider.CoordinateTranslator coordinateTranslator*/,
1239:                    int dropAction) {
1240:                DesignBean droppeeBean;
1241:                if (dropeeComponentRootElement == null && jsfForm.isGridMode()) {
1242:                    droppeeBean = jsfForm.getDefaultParentBean();
1243:                } else {
1244:                    droppeeBean = MarkupUnit
1245:                            .getMarkupDesignBeanForElement(dropeeComponentRootElement);
1246:                }
1247:                //        DesignBean defaultParent = MarkupUnit.getMarkupDesignBeanForElement(defaultParentComponentRootElement);
1248:                DesignBean defaultParent = jsfForm.getDefaultParentBean();
1249:                return getDndSupport().importData(designer, comp, t, /*transferData,*/
1250:                        canvasPos, documentPosNode, documentPosOffset,
1251:                        dimension, isGrid, droppeeElement, droppeeBean,
1252:                        defaultParent, /*coordinateTranslator,*/dropAction);
1253:            }
1254:
1255:            public DomProvider.DomDocument getDomDocument() {
1256:                return jsfForm.getDomDocumentImpl();
1257:            }
1258:
1259:            public int compareBoundaryPoints(Node endPointA, int offsetA,
1260:                    Node endPointB, int offsetB) {
1261:                return jsfForm.getDomDocumentImpl().compareBoudaryPoints(
1262:                        endPointA, offsetA, endPointB, offsetB);
1263:            }
1264:
1265:            public DomProvider.DomPosition createDomPosition(Node node,
1266:                    int offset, DomPosition.Bias bias) {
1267:                return jsfForm.getDomDocumentImpl().createDomPosition(node,
1268:                        offset, bias);
1269:            }
1270:
1271:            public DomProvider.DomPosition createDomPosition(Node node,
1272:                    boolean after) {
1273:                return jsfForm.getDomDocumentImpl().createNextDomPosition(node,
1274:                        after);
1275:            }
1276:
1277:            public DomProvider.DomRange createDomRange(Node dotNode,
1278:                    int dotOffset, Node markNode, int markOffset) {
1279:                return jsfForm.getDomDocumentImpl().createRange(dotNode,
1280:                        dotOffset, markNode, markOffset);
1281:            }
1282:
1283:            public DomProvider.DomPosition first(
1284:                    DomProvider.DomPosition dot,
1285:                    org.netbeans.modules.visualweb.api.designer.DomProvider.DomPosition mark) {
1286:                return jsfForm.getDomDocumentImpl().first(dot, mark);
1287:            }
1288:
1289:            public DomProvider.DomPosition last(
1290:                    DomProvider.DomPosition dot,
1291:                    org.netbeans.modules.visualweb.api.designer.DomProvider.DomPosition mark) {
1292:                return jsfForm.getDomDocumentImpl().last(dot, mark);
1293:            }
1294:
1295:            public Designer[] getExternalDesigners(URL url) {
1296:                return jsfForm.getExternalDesigners(url);
1297:            }
1298:
1299:            public boolean hasCachedExternalFrames() {
1300:                return jsfForm.hasCachedExternalFrames();
1301:            }
1302:
1303:            //    public void reuseCssStyle(DomProvider domProvider) {
1304:            //        // XXX
1305:            //        CssProvider.getEngineService().reuseCssEngineForDocument(jsfForm.getJspDom(),((DomProviderImpl)domProvider).getJsfForm().getJspDom());
1306:            //    }
1307:
1308:            public boolean isGridMode() {
1309:                return jsfForm.isGridMode();
1310:            }
1311:
1312:            //    public void tcUpdateErrors(Designer designer) {
1313:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1314:            //        if (jsfMultiViewElement == null) {
1315:            //            return;
1316:            //        }
1317:            //        jsfMultiViewElement.getJsfTopComponent().updateErrors();
1318:            //    }
1319:
1320:            //    public void tcDesignContextGenerationChanged(Designer designer) {
1321:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1322:            //        if (jsfMultiViewElement == null) {
1323:            //            return;
1324:            //        }
1325:            //        jsfMultiViewElement.getJsfTopComponent().designContextGenerationChanged();
1326:            //    }
1327:
1328:            //    public void tcRequestActive(Designer designer) {
1329:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1330:            //        if (jsfMultiViewElement == null) {
1331:            //            return;
1332:            //        }
1333:            //        jsfMultiViewElement.getJsfTopComponent().requestActive();
1334:            //    }
1335:
1336:            //    public void tcEnableCutCopyDelete(Designer designer) {
1337:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1338:            //        if (jsfMultiViewElement == null) {
1339:            //            return;
1340:            //        }
1341:            //        jsfMultiViewElement.getJsfTopComponent().enableCutCopyDelete();
1342:            //    }
1343:
1344:            //    public void tcDisableCutCopyDelete(Designer designer) {
1345:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1346:            //        if (jsfMultiViewElement == null) {
1347:            //            return;
1348:            //        }
1349:            //        jsfMultiViewElement.getJsfTopComponent().disableCutCopyDelete();
1350:            //    }
1351:
1352:            //    public void tcSetActivatedNodes(Designer designer, org.openide.nodes.Node[] nodes) {
1353:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1354:            //        if (jsfMultiViewElement == null) {
1355:            //            return;
1356:            //        }
1357:            //        setActivatedNodes(jsfMultiViewElement.getJsfTopComponent(), nodes);
1358:            //    }
1359:
1360:            //    public org.openide.nodes.Node[] tcGetActivatedNodes(Designer designer) {
1361:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1362:            //        if (jsfMultiViewElement == null) {
1363:            //            return new org.openide.nodes.Node[0];
1364:            //        }
1365:            //        return jsfMultiViewElement.getJsfTopComponent().getActivatedNodes();
1366:            //    }
1367:
1368:            //    public void tcShowPopupMenu(Designer designer, int x, int y) {
1369:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1370:            //        if (jsfMultiViewElement == null) {
1371:            //            return;
1372:            //        }
1373:            //        jsfMultiViewElement.getJsfTopComponent().showPopupMenu(x, y);
1374:            //    }
1375:            //
1376:            //    public void tcShowPopupMenu(Designer designer, JPopupMenu popup, int x, int y) {
1377:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1378:            //        if (jsfMultiViewElement == null) {
1379:            //            return;
1380:            //        }
1381:            //        popup.show(jsfMultiViewElement.getJsfTopComponent(), x, y);
1382:            //    }
1383:            //
1384:            //    public void tcShowPopupMenuForEvent(Designer designer, MouseEvent evt) {
1385:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1386:            //        if (jsfMultiViewElement == null) {
1387:            //            return;
1388:            //        }
1389:            //        // #6442386
1390:            //        JsfTopComponent jsfTopComponent = jsfMultiViewElement.getJsfTopComponent();
1391:            //        Point p = SwingUtilities.convertPoint(evt.getComponent(), evt.getX(), evt.getY(), jsfTopComponent);
1392:            //        jsfTopComponent.showPopupMenu(p.x, p.y);
1393:            //    }
1394:
1395:            // XXX Moved to FacesDnDSupport.
1396:            //    public boolean tcImportComponentData(Designer designer, JComponent comp, Transferable t) {
1397:            ////        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1398:            ////        if (jsfMultiViewElement == null) {
1399:            ////            return false;
1400:            ////        }
1401:            //        
1402:            //        JsfTopComponent jsfTopComponent;
1403:            //
1404:            //        if (comp instanceof JsfTopComponent) {
1405:            //            jsfTopComponent = (JsfTopComponent)comp;
1406:            //        } else {
1407:            //            jsfTopComponent = (JsfTopComponent)SwingUtilities.getAncestorOfClass(JsfTopComponent.class, comp);
1408:            //        }
1409:            //
1410:            //        if (jsfTopComponent == null) {
1411:            //            // XXX
1412:            //            return false;
1413:            //        }
1414:            //
1415:            ////                DesignBean parent = selectionTopComp.getPasteParent();
1416:            //        Element parentComponentRootElement = jsfTopComponent.getPasteParentComponent();
1417:            ////                MarkupPosition pos = selectionTopComp.getPasteMarkupPosition();
1418:            ////        Point location = jsfTopComponent.getPastePosition();
1419:            //        Point location = designer.getPastePoint();
1420:            ////                DesignBean[] beans = selectionTopComp.pasteBeans(webform, t, parent, pos, location);
1421:            ////                Element[] componentRootElements = SelectionTopComp.pasteComponents(webform, t, parentComponentRootElement, location);
1422:            //
1423:            //        if (location != null) {
1424:            ////            GridHandler gridHandler = webform.getGridHandler();
1425:            ////            location.x = gridHandler.snapX(location.x);
1426:            ////            location.y = gridHandler.snapY(location.y);
1427:            //            location.x = designer.snapX(location.x, null);
1428:            //            location.y = designer.snapY(location.y, null);
1429:            //        }
1430:            ////        Element[] componentRootElements = webform.pasteComponents(t, parentComponentRootElement, location);
1431:            //        Element[] componentRootElements = pasteComponents(t, parentComponentRootElement, location);
1432:            //
1433:            ////                if ((beans != null) && (beans.length > 0)) {
1434:            ////                    selectionTopComp.selectBeans(beans);
1435:            ////                }
1436:            //        if (componentRootElements.length > 0) {
1437:            ////            selectionTopComp.selectComponents(componentRootElements);
1438:            //            jsfTopComponent.selectComponents(componentRootElements);
1439:            //        }
1440:            //        return true;
1441:            //        
1442:            //    }
1443:
1444:            //    public Point tcGetPastePosition(Designer designer) {
1445:            ////        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1446:            ////        if (jsfMultiViewElement == null) {
1447:            ////            return new Point(0, 0);
1448:            ////        }
1449:            ////        return jsfMultiViewElement.getJsfTopComponent().getPastePosition();
1450:            //        return designer.getPastePoint();
1451:            //    }
1452:
1453:            //    public void tcRepaint(Designer designer) {
1454:            ////        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1455:            ////        if (jsfMultiViewElement == null) {
1456:            ////            return;
1457:            ////        }
1458:            ////        jsfMultiViewElement.getJsfTopComponent().repaint();
1459:            //        JsfSupportUtilities.tcRepaint(designer);
1460:            //    }
1461:
1462:            //    public boolean tcSeenEscape(Designer designer, ActionEvent evt) {
1463:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1464:            //        if (jsfMultiViewElement == null) {
1465:            //            return false;
1466:            //        }
1467:            //        return jsfMultiViewElement.getJsfTopComponent().seenEscape(evt.getWhen());
1468:            //    }
1469:
1470:            //    public void tcDeleteSelection(Designer designer) {
1471:            //        JsfMultiViewElement jsfMultiViewElement = JsfForm.findJsfMultiViewElementForDesigner(designer);
1472:            //        if (jsfMultiViewElement == null) {
1473:            //            return;
1474:            //        }
1475:            //        jsfMultiViewElement.getJsfTopComponent().deleteSelection();
1476:            //    }
1477:
1478:            // XXX Copy also in designer/../DesignerUtils.
1479:            /** Thread-safe method to set the activated nodes of a TopComponent;
1480:             * this can only be done from the event dispatch thread. If called
1481:             * from another thread it will post a runnable on the event dispatch
1482:             * thread instead.
1483:             */
1484:            private static void setActivatedNodes(final TopComponent tc,
1485:                    final org.openide.nodes.Node[] nodes) {
1486:                //        if(DEBUG) {
1487:                //            debugLog(DesignerUtils.class.getName() + ".setActivatedNodes(TopComponent, Node[])");
1488:                //        }
1489:                if (nodes == null) {
1490:                    throw (new IllegalArgumentException("Null node array."));// NOI18N
1491:                }
1492:                if (tc == null) {
1493:                    throw (new IllegalArgumentException("Null TopComponent."));// NOI18N
1494:                }
1495:                if (SwingUtilities.isEventDispatchThread()) {
1496:                    tc.setActivatedNodes(nodes);
1497:                } else {
1498:                    SwingUtilities.invokeLater(new Runnable() {
1499:                        public void run() {
1500:                            tc.setActivatedNodes(nodes);
1501:                        }
1502:                    });
1503:                }
1504:            }
1505:
1506:            public boolean isRenderedNode(Node node) {
1507:                return jsfForm.isRenderedNode(node);
1508:            }
1509:
1510:            // XXX
1511:            public void paintDesignerDecorations(Graphics2D g2d,
1512:                    Designer designer) {
1513:                boolean showVirtualForms = jsfForm
1514:                        .isVirtualFormsSupportEnabled();
1515:                boolean showAjaxTransactions = jsfForm
1516:                        .isAjaxTransactionsSupportEnabled();
1517:
1518:                if (showVirtualForms || showAjaxTransactions) {
1519:                    //        DesignContext designContext = renderContext.getDesignContext();
1520:                    //        if (!(designContext instanceof LiveUnit)) {
1521:                    //            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,
1522:                    //                    new IllegalStateException("DesignContext is not of LiveUnit type, designContext=" + designContext)); // NOI18N
1523:                    //        }
1524:                    //        LiveUnit liveUnit = (LiveUnit)designContext;
1525:                    //        Project project = liveUnit.getModel().getProject();
1526:                    //            Project project = getFacesModel().getProject();
1527:                    //            LiveUnit liveUnit = getFacesModel().getLiveUnit();
1528:                    Project project = jsfForm.getProject();
1529:                    LiveUnit liveUnit = jsfForm.getLiveUnit();
1530:                    if (liveUnit == null) {
1531:                        // XXX Log problem?
1532:                        return;
1533:                    }
1534:
1535:                    ComponentGroupSupport.paint(liveUnit, designer
1536:                            .createRenderContext(), g2d, showVirtualForms,
1537:                            showAjaxTransactions);
1538:                }
1539:            }
1540:
1541:            public Decoration getDecoration(Element element) {
1542:                return DecorationManager.getDefault().getDecoration(element);
1543:            }
1544:
1545:            //    public boolean isShowDecorations() {
1546:            //        return JsfDesignerPreferences.getInstance().isShowDecorations();
1547:            //    }
1548:            //
1549:            //    public int getDefaultFontSize() {
1550:            //        return JsfDesignerPreferences.getInstance().getDefaultFontSize();
1551:            //    }
1552:            //
1553:            //    public int getPageSizeWidth() {
1554:            //        return JsfDesignerPreferences.getInstance().getPageSizeWidth();
1555:            //    }
1556:            //
1557:            //    public int getPageSizeHeight() {
1558:            //        return JsfDesignerPreferences.getInstance().getPageSizeHeight();
1559:            //    }
1560:            //
1561:            //    public boolean isGridShow() {
1562:            //        return GridHandler.getDefault().isGrid();
1563:            //    }
1564:            //
1565:            //    public boolean isGridSnap() {
1566:            //        return GridHandler.getDefault().isSnap();
1567:            //    }
1568:            //
1569:            //    public int getGridWidth() {
1570:            //        return GridHandler.getDefault().getGridWidth();
1571:            //    }
1572:            //
1573:            //    public int getGridHeight() {
1574:            //        return GridHandler.getDefault().getGridHeight();
1575:            //    }
1576:
1577:            //    public int getGridTraceWidth() {
1578:            //        return GridHandler.getDefault().getGridTraceWidth();
1579:            //    }
1580:            //
1581:            //    public int getGridTraceHeight() {
1582:            //        return GridHandler.getDefault().getGridTraceHeight();
1583:            //    }
1584:            //
1585:            //    public int getGridOffset() {
1586:            //        return GridHandler.getDefault().getGridOffset();
1587:            //    }
1588:
1589:            @Override
1590:            public String toString() {
1591:                return super .toString() + "[jsfForm=" + jsfForm + "]"; // NOI18N
1592:            }
1593:
1594:            public DomProviderService getDomProviderService() {
1595:                return domProviderService;
1596:            }
1597:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.