Package org.itsnat.core

Examples of org.itsnat.core.ItsNatDocument


        }
    }

    public void updateCircle()
    {
        ItsNatDocument itsNatDoc = getItsNatDocument();

        int newRadio = -1;
        String valueStr = inputRadio.getAttribute("value");
        try
        {
            newRadio = Integer.parseInt(valueStr);
        }
        catch(NumberFormatException ex)
        {
            itsNatDoc.addCodeToSend("alert('Not an integer number');");
            return;
        }

        Document childDoc;
        try
        {
            if (container instanceof HTMLObjectElement)
                childDoc = ((HTMLObjectElement)container).getContentDocument();
            else
                childDoc = ((ItsNatHTMLEmbedElement)container).getContentDocument();
        }
        catch(NoSuchMethodError ex)
        {
            // Cause: Xerces compatibility package of Tomcat 5.5
            // misses this standard DOM method in HTMLIFrameElement
            // and HTMLObjectElement interfaces
            // Don't worry, our required method is there.
            try
            {
                Method method = container.getClass().getMethod("getContentDocument",(Class<?>[])null);
                childDoc = (Document)method.invoke(container,(Object[])null);
            }
            catch(Exception ex2) { throw new RuntimeException(ex2); }
        }

        if (childDoc == null)
        {
            itsNatDoc.addCodeToSend("alert('Not loaded yet');");
            return;
        }
        ItsNatDocument childItsNatDoc = ((ItsNatNode)childDoc).getItsNatDocument(); // This method is multithread

        synchronized(childItsNatDoc) // NEEDED!!!
        {
            ChildSVGSsrcAutoBindingDocument childUserDoc =
                 (ChildSVGSsrcAutoBindingDocument)childItsNatDoc.getUserValue("user_object");
            Element circle = childUserDoc.getSelectedCircle();
            if (circle == null)
            {
                itsNatDoc.addCodeToSend("alert('No selected circle');");
                return;
View Full Code Here


        log(toString(obj1) + " " + toString(obj2));
    }

    public void log(String text)
    {
        ItsNatDocument itsNatDoc = getItsNatDocument();
        Document doc = itsNatDoc.getDocument();
        if (logElem == null)
        {
            this.logElem = doc.getElementById("logId");
            if (logElem == null) return; // Log element not defined
        }
View Full Code Here

        return featShowDoc.getFeatureBoxElement();
    }

    public void startCodePanel()
    {
        ItsNatDocument itsNatDoc = getItsNatDocument();

        Element parent = getFeatureBoxElement();
        NodeList textAreas = parent.getElementsByTagName("textarea");
        for(int i = 0; i < textAreas.getLength(); i++)
        {
View Full Code Here

    public void selectFeature()
    {
        String featTitle = getTitle();
        ItsNatDOMUtil.setTextContent(featShowDoc.getFeatureTitleElement(),featTitle);
        String docTitle = featTitle + ". ItsNat: Feature Set & Examples";
        ItsNatDocument itsNatDoc = getItsNatDocument();
        if (itsNatDoc.isLoading() && itsNatDoc.getItsNatDocumentTemplate().isFastLoadMode())
            ItsNatDOMUtil.setTextContent(featShowDoc.getTitleElement(),docTitle);
        else
            itsNatDoc.addCodeToSend("document.title =\"" + docTitle + "\";");

        initTab(featShowDoc.getExampleTabElement(),hasExample());
        initTab(featShowDoc.getCodeTabElement(),hasSourceCode());
        initTab(featShowDoc.getDocTabElement(),hasExplanation());
View Full Code Here

public class SPITutGlobalLoadRequestListener implements ItsNatServletRequestListener
{
    public void processRequest(ItsNatServletRequest request, ItsNatServletResponse response)
    {
        ItsNatDocument itsNatDoc = request.getItsNatDocument();
        if (itsNatDoc == null)
        {
            // Requested with a custom URL, not ItsNat standard format,
            // for instance servlet without params or Google AJAX crawling.
            // Internal redirection specifying the target template page:
View Full Code Here

    public static void methodEventUsingBrowser(final TreePath path,final FeatureTreeNode feature,final int panel)
    {
        FeatureShowcaseDocument featShowDoc = feature.getFeatureShowcaseDocument();
        final ItsNatFreeTree tree = featShowDoc.getItsNatFreeTree();
        final ItsNatDocument itsNatDoc = feature.getItsNatDocument();
        final ItsNatHTMLInputCheckBox joystickCB = featShowDoc.getJoystickModeCheckBox();

        Runnable dispCode = new Runnable()
        {
            public void run()
            {
                // Joystick mode temporally disabled, because on load time and fast load,
                // event listeners in the component are not added until the load event is fired.

                boolean useJoystick = joystickCB.isSelected();
                if (useJoystick) joystickCB.setSelected(false);

                Element featureElem;
                MouseEvent event1;
                synchronized(itsNatDoc)
                {
                    featureElem = tree.getItsNatTreeUI().getParentElementFromTreePath(path);
                    event1 = createMouseEvent(itsNatDoc);
                }
                ((EventTarget)featureElem).dispatchEvent(event1); // Select feature

                if (panel == feature.getFirstPanel())
                    return;

                for( ; ; )
                {
                    synchronized(itsNatDoc)
                    {
                        if (tree.getTreeSelectionModel().isPathSelected(path))
                            break;
                    }
                    try{ Thread.sleep(200); }catch(InterruptedException ex) { throw new RuntimeException(ex); }
                }

                Element tabElem;
                MouseEvent event2;
                synchronized(itsNatDoc)
                {
                    tabElem = feature.getTabElement(panel);
                    event2 = createMouseEvent(itsNatDoc);
                }

                ((EventTarget)tabElem).dispatchEvent(event2); // Select tab

                if (useJoystick) joystickCB.setSelected(true);
            }
        };
        ClientDocument client = itsNatDoc.getClientDocumentOwner();
        client.startEventDispatcherThread(dispCode);
    }
View Full Code Here

        // Note: this technique may be problematic in fastLoadMode = true if the target
        // panel is not the "example" panel because the example panel is loaded and discarded.

        FeatureShowcaseDocument featShowDoc = feature.getFeatureShowcaseDocument();
        ItsNatFreeTree tree = featShowDoc.getItsNatFreeTree();
        ItsNatDocument itsNatDoc = feature.getItsNatDocument();
        ItsNatHTMLInputCheckBox joystickCB = featShowDoc.getJoystickModeCheckBox();

        // Joystick mode temporally disabled, because on load time and fast load,
        // event listeners in the component are not added until the load event is fired.
        boolean useJoystick = joystickCB.isSelected();
View Full Code Here

    }

    @Override
    public void load(ItsNatServletRequest request, ItsNatServletResponse response)
    {
        ItsNatDocument itsNatDoc = request.getItsNatDocument();
        Document doc = itsNatDoc.getDocument();

        Element discsElem = doc.getDocumentElement();

        Element cdListElem = ItsNatTreeWalker.getLastChildElement(discsElem);

        ItsNatServlet servlet = request.getItsNatServlet();
        ItsNatDocFragmentTemplate fragTemplate = servlet.getItsNatDocFragmentTemplate("manual.core.xmlFragExample");
        DocumentFragment docFrag = fragTemplate.loadDocumentFragment(itsNatDoc);
        discsElem.insertBefore(docFrag,cdListElem); // docFrag is empty now

        ElementGroupManager factory = itsNatDoc.getElementGroupManager();
        ElementList discList = factory.createElementList(cdListElem,true);

        addCD("Help","The Beatles",new String[] {"A Hard Day's Night","Let It Be"},discList);
        addCD("Making Movies","Dire Straits",new String[] {"Tunnel Of Love","Romeo & Juliet"},discList);
    }
View Full Code Here

        ItsNatDOMUtil.setTextContent(titleElem,title);
        Element artistElem = ItsNatTreeWalker.getNextSiblingElement(titleElem);
        ItsNatDOMUtil.setTextContent(artistElem,artist);
        Element songsElem = ItsNatTreeWalker.getNextSiblingElement(artistElem);

        ItsNatDocument itsNatDoc = discList.getItsNatDocument();
        ElementGroupManager factory = itsNatDoc.getElementGroupManager();
        ElementList songList = factory.createElementList(songsElem,true);
        for(int i = 0; i < songs.length; i++)
            songList.addElement(songs[i]);
    }
View Full Code Here

    {
    }

    public void processRequest(ItsNatServletRequest request, ItsNatServletResponse response)
    {
        ItsNatDocument itsNatDoc = request.getItsNatDocument();

        if (itsNatDoc != null)
        {
            //String docName = itsNatDoc.getItsNatDocumentTemplate().getName();
            //System.out.println("Loading " + docName);
View Full Code Here

TOP

Related Classes of org.itsnat.core.ItsNatDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.