Package com.alee.managers.style

Examples of com.alee.managers.style.SupportedComponent


     * @param component component instance
     * @return component type
     */
    protected SupportedComponent getSupportedComponentTypeImpl ( final JComponent component )
    {
        final SupportedComponent type = SupportedComponent.getComponentTypeByUIClassID ( component.getUIClassID () );
        if ( type == null )
        {
            throw new StyleException ( "Unknown component UI class ID: " + component.getUIClassID () );
        }
        return type;
View Full Code Here


    public boolean applySkin ( final JComponent component, final Map<String, Map<String, Object>> customPainterProperties,
                               final Map<String, Painter> customPainters )
    {
        try
        {
            final SupportedComponent type = getSupportedComponentTypeImpl ( component );
            final ComponentStyle style = getComponentStyleImpl ( component, type );
            final ComponentUI ui = getComponentUIImpl ( component );

            // Installing painters
            for ( final PainterStyle painterStyle : style.getPainters () )
View Full Code Here

        // Reading style ID
        final String componentStyleId = reader.getAttribute ( STYLE_ID_ATTRIBUTE );
        componentStyle.setId ( componentStyleId != null ? componentStyleId : DEFAULT_STYLE_ID );

        // Reading style component type
        final SupportedComponent type = SupportedComponent.valueOf ( reader.getAttribute ( COMPONENT_TYPE_ATTRIBUTE ) );
        componentStyle.setType ( type );

        // Reading extended style ID
        componentStyle.setExtendsId ( reader.getAttribute ( EXTENDS_ID_ATTRIBUTE ) );

        // Reading component style properties and painters
        // Using LinkedHashMap to keep properties order intact
        final Map<String, Object> componentProperties = new LinkedHashMap<String, Object> ();
        final Map<String, Object> uiProperties = new LinkedHashMap<String, Object> ();
        final List<PainterStyle> painters = new ArrayList<PainterStyle> ();
        while ( reader.hasMoreChildren () )
        {
            // Read next node
            reader.moveDown ();
            final String nodeName = reader.getNodeName ();
            if ( nodeName.equals ( COMPONENT_NODE ) )
            {
                // Reading component property
                final Class componentClass = type.getComponentClass ();
                while ( reader.hasMoreChildren () )
                {
                    reader.moveDown ();
                    final String propName = reader.getNodeName ();
                    readProperty ( reader, context, componentStyleId, componentProperties, componentClass, propName );
                    reader.moveUp ();
                }
            }
            else if ( nodeName.equals ( UI_NODE ) )
            {
                // Reading UI property
                final Class uiClass = type.getUIClass ();
                while ( reader.hasMoreChildren () )
                {
                    reader.moveDown ();
                    final String propName = reader.getNodeName ();
                    readProperty ( reader, context, componentStyleId, uiProperties, uiClass, propName );
View Full Code Here

        // Also merging all styles with the same ID
        final Map<SupportedComponent, Map<String, ComponentStyle>> stylesCache =
                new LinkedHashMap<SupportedComponent, Map<String, ComponentStyle>> ( SupportedComponent.values ().length );
        for ( final ComponentStyle style : styles )
        {
            final SupportedComponent type = style.getType ();
            Map<String, ComponentStyle> componentStyles = stylesCache.get ( type );
            if ( componentStyles == null )
            {
                componentStyles = new LinkedHashMap<String, ComponentStyle> ( 1 );
                stylesCache.put ( type, componentStyles );
View Full Code Here

        addViewComponent ( "JPopupMenu under JButton", popupButton, popupMenu, true );
    }

    private void addViewComponent ( final String title, final JComponent displayedView, final JComponent view, final boolean center )
    {
        final SupportedComponent type = SupportedComponent.getComponentTypeByUIClassID ( view.getUIClassID () );

        final WebLabel titleLabel = new WebLabel ( title, type.getIcon () ).setMargin ( 0, 7, 3, 0 );

        final WebPanel boundsPanel = new WebPanel ( displayedView );
        boundsPanel.setStyleId ( "empty-border" );
        boundsPanels.add ( boundsPanel );
View Full Code Here

                    final String attributeName = attribute.getName ();
                    if ( attributeName.equals ( ComponentStyleConverter.COMPONENT_TYPE_ATTRIBUTE ) )
                    {
                        final Segment content = attribute.getValueSegment ();
                        final String type = element.getAttributeValue ( ComponentStyleConverter.COMPONENT_TYPE_ATTRIBUTE );
                        final SupportedComponent selectedType = SupportedComponent.valueOf ( type );

                        return new LinkGeneratorResult ()
                        {
                            @Override
                            public HyperlinkEvent execute ()
                            {
                                try
                                {
                                    final WebPopOver typeChooser = new WebPopOver ( parentComponent );
                                    typeChooser.setCloseOnFocusLoss ( true );
                                    typeChooser.setStyleId ( "editor-pop-over" );
                                    typeChooser.setMargin ( 5, 0, 5, 0 );

                                    final List<SupportedComponent> supportedComponents =
                                            SupportedComponent.getPainterSupportedComponents ();
                                    final WebList historyList = new WebList ( supportedComponents );
                                    historyList.setOpaque ( false );
                                    historyList.setVisibleRowCount ( Math.min ( 10, supportedComponents.size () ) );
                                    historyList.setRolloverSelectionEnabled ( true );
                                    historyList.setSelectedValue ( selectedType );
                                    historyList.setCellRenderer ( new WebComboBoxCellRenderer ()
                                    {
                                        @Override
                                        public Component getListCellRendererComponent ( final JList list, final Object value,
                                                                                        final int index, final boolean isSelected,
                                                                                        final boolean cellHasFocus )
                                        {
                                            final WebComboBoxElement renderer = ( WebComboBoxElement ) super
                                                    .getListCellRendererComponent ( list, value, index, isSelected, cellHasFocus );

                                            final SupportedComponent type = ( SupportedComponent ) value;
                                            if ( type != null )
                                            {
                                                renderer.setIcon ( type.getIcon () );
                                                renderer.setText ( type.toString () );
                                            }

                                            return renderer;
                                        }
                                    } );
View Full Code Here

TOP

Related Classes of com.alee.managers.style.SupportedComponent

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.