Package com.alee.utils.xml

Examples of com.alee.utils.xml.ResourceFile


            else if ( nodeName.equals ( INCLUDE_NODE ) )
            {
                // Reading included file information
                final String nearClass = reader.getAttribute ( NEAR_CLASS_ATTRIBUTE );
                final String file = reader.getValue ();
                includes.add ( new ResourceFile ( ResourceLocation.nearClass, file, nearClass ) );
            }
            reader.moveUp ();
        }

        // Reading all additional included files
        // This operation performed in the end when all required information is read from XML
        for ( int i = 0; i < includes.size (); i++ )
        {
            final ResourceFile resourceFile = includes.get ( i );

            // Replacing null relative class with skin class
            if ( resourceFile.getClassName () == null )
            {
                final String skinClass = skinInfo.getSkinClass ();
                if ( skinClass == null )
                {
                    throw new StyleException (
                            "Included skin file \"" + resourceFile.getSource () + "\" specified but skin \"class\" property is not set!" );
                }
                resourceFile.setClassName ( skinClass );
            }

            // Reading skin part from included file
            final SkinInfo include = loadSkinInfo ( resourceFile );
            if ( include == null )
            {
                throw new StyleException ( "Included skin file \"" + resourceFile.getSource () + "\" cannot be read!" );
            }

            // Adding information from included file
            // Included styles order is preserved to preserve styles override order
            styles.addAll ( i, include.getStyles () );
View Full Code Here


    }

    private void loadFirstResource ( final List<ResourceFile> resources, final List<String> xmlContent, final List<String> xmlNames,
                                     final List<ResourceFile> xmlFiles ) throws IOException
    {
        final ResourceFile rf = resources.get ( 0 );
        final Source xmlSource = new Source ( ReflectUtils.getClassSafely ( rf.getClassName () ).getResource ( rf.getSource () ) );
        xmlSource.fullSequentialParse ();

        final Element baseClassTag = xmlSource.getFirstElement ( SkinInfoConverter.CLASS_NODE );
        final String baseClass = baseClassTag != null ? baseClassTag.getContent ().toString () : null;

        for ( final Element includeTag : xmlSource.getAllElements ( SkinInfoConverter.INCLUDE_NODE ) )
        {
            final String includeClass = includeTag.getAttributeValue ( SkinInfoConverter.NEAR_CLASS_ATTRIBUTE );
            final String finalClass = includeClass != null ? includeClass : baseClass;
            final String src = includeTag.getContent ().toString ();
            resources.add ( new ResourceFile ( ResourceLocation.nearClass, src, finalClass ) );
        }

        xmlContent.add ( xmlSource.toString () );
        xmlNames.add ( new File ( rf.getSource () ).getName () );
        xmlFiles.add ( rf );

        resources.remove ( 0 );
    }
View Full Code Here

        // Custom StyleEditor skin for WebLaF
        StyleManager.setDefaultSkin ( StyleEditorSkin.class.getCanonicalName () );
        WebLookAndFeel.install ();

        // Displaying StyleEditor
        final ResourceFile skin = new ResourceFile ( ResourceLocation.nearClass, "resources/StyleEditorSkin.xml", StyleEditorSkin.class );
        final StyleEditor styleEditor = new StyleEditor ( skin );
        styleEditor.setVisible ( true );
    }
View Full Code Here

TOP

Related Classes of com.alee.utils.xml.ResourceFile

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.