com.alee.laf.WebLookAndFeel Java Examples

The following examples show how to use com.alee.laf.WebLookAndFeel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainWindow.java    From mars-sim with GNU General Public License v3.0 7 votes vote down vote up
public void initializeWeblaf() {

		try {
			// use the weblaf skin
//			UIManager.setLookAndFeel(new WebLookAndFeel());
//				WebLookAndFeel.setForceSingleEventsThread ( true );
			WebLookAndFeel.install();
			UIManagers.initialize();
			
			// Installing our extension for default skin
//	        StyleManager.addExtensions ( new XmlSkinExtension ( MainWindow.class, "SimpleExtension.xml" ) );

            // They contain all custom styles demo application uses
//            StyleManager.addExtensions ( new AdaptiveExtension (), new LightSkinExtension (), new DarkSkinExtension () );

		} catch (Exception e) {
			logger.log(Level.WARNING, Msg.getString("MainWindow.log.lookAndFeelError"), e); //$NON-NLS-1$
		}

	}
 
Example #2
Source File: DemoApplication.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Constructs new {@link DemoApplication}.
 */
private DemoApplication ()
{
    super ();
    version = new Version ( DemoApplication.class );

    setIconImages ( WebLookAndFeel.getImages () );
    updateTitle ();

    initializeDocks ();
    initializeToolBar ();
    initializeStatus ();
    setDefaultCloseOperation ( WindowConstants.EXIT_ON_CLOSE );
    registerSettings ( new Configuration<WindowState> ( "application", new SerializableSupplier<WindowState> ()
    {
        @Override
        public WindowState get ()
        {
            return new WindowState ( new Dimension ( 1200, 820 ) );
        }
    } ) );
}
 
Example #3
Source File: LookUtils.java    From JByteMod-Beta with GNU General Public License v2.0 6 votes vote down vote up
public static void setLAF() {
  try {
    JByteMod.LOGGER.log("Setting default Look and Feel");
    if (JByteMod.ops.get("use_weblaf").getBoolean()) {
      WebLookAndFeel.install();
    } else {
      if (!changeLAF("javax.swing.plaf.nimbus.NimbusLookAndFeel")) {
        JByteMod.LOGGER.err("Failed to set Nimbus Look and Feel, trying to use WebLaF");
        WebLookAndFeel.install();
      }
    }
  } catch (Throwable t) {
    t.printStackTrace();
    JByteMod.LOGGER.err("Failed to set Look and Feel");
  }
}
 
Example #4
Source File: ExTreeModel.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns root node provided by {@link ExTreeDataProvider}.
 *
 * @return root node provided by {@link ExTreeDataProvider}
 */
@NotNull
protected N loadRootNode ()
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Ensure model is installed
    checkInstalled ();

    // Retrieving root node
    final N rootNode = getDataProvider ().getRoot ();

    // Caching root node
    cacheNodeById ( rootNode );
    cacheParentId ( rootNode, null );

    return rootNode;
}
 
Example #5
Source File: TexturedText.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {
	    JFrame f = new JFrame();
	    WebLookAndFeel.install();
	    JPanel panel = new JPanel(new GridLayout(1, 17));
	    f.getContentPane().add(panel);
//	for (int i=0; i<17; i++) {
//		WebStyledLabel icon = new WebStyledLabel (WebLookAndFeel.getIcon(i));
//		panel.add(icon);
//	}
   

//    f.getContentPane().add(new TexturedText());
	
    f.setSize(800, 200);
    f.show();

  }
 
Example #6
Source File: StyleEditor.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * {@link StyleEditor} main launch method.
 *
 * @param args editor arguments
 */
public static void main ( final String[] args )
{
    CoreSwingUtils.enableEventQueueLogging ();
    CoreSwingUtils.invokeLater ( new Runnable ()
    {
        @Override
        public void run ()
        {
            final Class<? extends Skin> skinClass = WebLightSkin.class;

            // Custom StyleEditor skin for WebLaF
            WebLookAndFeel.setForceSingleEventsThread ( true );
            WebLookAndFeel.install ( skinClass );

            // Edited skin file
            final ClassResource skin = new ClassResource ( skinClass, "resources/web-light-skin.xml" );

            // Displaying StyleEditor
            final StyleEditor styleEditor = new StyleEditor ( skin );
            styleEditor.setVisible ( true );
        }
    } );
}
 
Example #7
Source File: AsyncTreeModel.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
public N getChild ( @NotNull final Object parent, final int index )
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Ensure model is installed
    checkInstalled ();

    final N child;
    final N node = ( N ) parent;
    if ( areChildrenLoaded ( node ) )
    {
        child = ( N ) super.getChild ( parent, index );
    }
    else
    {
        throw new RuntimeException ( "There are no loaded children at node: " + node );
    }
    return child;
}
 
Example #8
Source File: ComponentInstantiationTest.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Initializes {@link WebLookAndFeel}.
 */
@BeforeClass
public static void initialize ()
{
    if ( !SystemUtils.isHeadlessEnvironment () )
    {
        CoreSwingUtils.invokeAndWait ( new Runnable ()
        {
            @Override
            public void run ()
            {
                WebLookAndFeel.setForceSingleEventsThread ( true );
                WebLookAndFeel.install ();
                LanguageManager.addDictionary ( new Dictionary (
                        new ClassResource ( ComponentInstantiationTest.class, "resources/language.xml" )
                ) );
            }
        } );
    }
}
 
Example #9
Source File: NinePatchEditor.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
public NinePatchEditor ()
{
    super ();

    ninePatchImage = null;
    ninePatchIcon = null;

    WebLookAndFeel.setOrientation ( this );
    setOpaque ( false );
    setFocusable ( true );
    setLayout ( new TableLayout ( new double[][]{ { RULER_LENGTH, TableLayout.PREFERRED, TableLayout.FILL },
            { RULER_LENGTH, TableLayout.PREFERRED, TableLayout.FILL } } ) );

    setFont ( new JLabel ().getFont ().deriveFont ( 10f ) );

    view = new WebScrollPane ( StyleId.scrollpaneTransparentHovering, this );

    final NinePatchEditorMouseAdapter mouseAdapter = new NinePatchEditorMouseAdapter ();
    addMouseListener ( mouseAdapter );
    addMouseMotionListener ( mouseAdapter );
    addMouseWheelListener ( mouseAdapter );
}
 
Example #10
Source File: StyleData.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Removes skin currently applied to the specified component.
 * This will uninstall component skin without installing any other on top of previous one and will leave component empty.
 *
 * @return previously applied skin
 */
@Nullable
protected Skin removeSkin ()
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Checking previous skin existence
    final Skin oldSkin = this.skin;
    if ( this.skin != null )
    {
        // Retrieving component and checking its existence
        final JComponent component = getComponent ();

        // Removing skin
        this.skin.removeSkin ( component );
        this.skin = null;
    }
    return oldSkin;
}
 
Example #11
Source File: WebNotificationExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" );
    button.addActionListener ( new ActionListener ()
    {
        @Override
        public void actionPerformed ( final ActionEvent e )
        {
            final WebLabel title = new WebLabel ( getPreviewLanguagePrefix () + "text", WebLabel.CENTER );
            final WebImage logo = new WebImage ( WebLookAndFeel.getIcon ( 256 ) );
            final GroupPanel content = new GroupPanel ( 15, false, title, logo );
            NotificationManager.showNotification ( button, content, ( Icon ) null );
        }
    } );
    return CollectionUtils.asList ( button );
}
 
Example #12
Source File: JDialogExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" );
    button.addActionListener ( new ActionListener ()
    {
        @Override
        public void actionPerformed ( final ActionEvent e )
        {
            final Window parent = CoreSwingUtils.getNonNullWindowAncestor ( button );
            final String title = getExampleLanguagePrefix () + "content";
            final JDialog dialog = new JDialog ( parent );
            UILanguageManager.registerComponent ( dialog.getRootPane (), title );
            dialog.getRootPane ().putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
            dialog.setIconImages ( WebLookAndFeel.getImages () );
            dialog.add ( new WebLabel ( title, WebLabel.CENTER ) );
            dialog.setSize ( 500, 400 );
            dialog.setLocationRelativeTo ( DemoApplication.getInstance () );
            dialog.setDefaultCloseOperation ( WindowConstants.DISPOSE_ON_CLOSE );
            dialog.setVisible ( true );
        }
    } );
    return CollectionUtils.asList ( button );
}
 
Example #13
Source File: WebSplitButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebSplitButton button = new WebSplitButton ( getStyleId (), "Select one..." );
    button.setPopupMenu ( createSamplePopupMenu ( button, false, true ) );

    final WebSplitButton first = new WebSplitButton ( getStyleId (), "Select one..." );
    first.setMenuIcon ( DemoIcons.menu16 );
    first.setPopupMenu ( createSamplePopupMenu ( first, false, true ) );

    final WebSplitButton second = new WebSplitButton ( getStyleId (), "Select one...", WebLookAndFeel.getIcon ( 16 ) );
    second.setPopupMenu ( createSamplePopupMenu ( second, true, true ) );

    final WebSplitButton icon = new WebSplitButton ( getStyleId (), "Select one...", WebLookAndFeel.getIcon ( 16 ) );
    icon.setMenuIcon ( DemoIcons.menu16 );
    icon.setPopupMenu ( createSamplePopupMenu ( icon, true, true ) );

    return CollectionUtils.asList ( button, new GroupPane ( first, second ), icon );
}
 
Example #14
Source File: JButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JButton basic = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JButton group1 = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JButton group2 = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JButton group3 = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ) );
}
 
Example #15
Source File: AsyncTreeModel.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Uninstalls this {@link AsyncTreeModel} from the specified {@link WebAsyncTree}.
 *
 * @param tree {@link WebAsyncTree}
 */
public void uninstall ( @NotNull final WebAsyncTree<N> tree )
{
    WebLookAndFeel.checkEventDispatchThread ();
    removeAsyncTreeModelListener ( tree );
    for ( final Map.Entry<String, N> entry : nodeById.entrySet () )
    {
        final N node = entry.getValue ();
        node.detachLoadIconObserver ( tree );
    }
    this.rootNode = null;
    this.tree = null;
    this.nodeById = null;
    this.rawNodeChildrenCache = null;
    this.nodeCached = null;
}
 
Example #16
Source File: MagnifierGlass.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Disposes {@link MagnifierGlass}.
 */
public void dispose ()
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Changing visibility flag
    setEnabled ( false );

    // Updating buffer image
    updatePreview ();

    // Hiding magnifier
    disposeFromGlassPane ();

    // Stopping force updater
    restartForceUpdater ();

    // Removing global AWT event listeners
    Toolkit.getDefaultToolkit ().removeAWTEventListener ( listener );

    // Cleaning up
    zoomProvider = null;
    defaultCursor = null;
}
 
Example #17
Source File: UISettingsManager.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Saves settings for the specified {@link JComponent} if it is registered.
 *
 * @param component {@link JComponent} to save settings for
 */
public static void saveSettings ( final JComponent component )
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Saving settings
    if ( settingsProcessors.contains ( component ) )
    {
        settingsProcessors.get ( component ).save ( false );
    }
    else
    {
        final String msg = "Processor is not registered for component: %s";
        throw new SettingsException ( String.format ( msg, component ) );
    }
}
 
Example #18
Source File: JLabelExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JLabel leading = new JLabel ( "Leading text", JLabel.LEADING );
    leading.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final ImageIcon icon = WebLookAndFeel.getIcon ( 16 );
    final JLabel center = new JLabel ( "Centered text with icon", icon, JLabel.CENTER );
    center.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JLabel trailing = new JLabel ( "Trailing text", JLabel.TRAILING );
    trailing.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    return CollectionUtils.asList ( leading, center, trailing );
}
 
Example #19
Source File: InterfaceInspector.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns separate {@link WebDialog} with inspector for the specified {@link Component}.
 * That {@link WebDialog} will be displayed straight away on the screen.
 *
 * @param parent    parent {@link Component} for {@link WebDialog}
 * @param inspected {@link Component} to inspect
 * @return separate {@link WebDialog} with inspector for the specified {@link Component}
 */
@NotNull
public static WebDialog showDialog ( @Nullable final Component parent, @Nullable final Component inspected )
{
    final WebDialog dialog = new WebDialog ( parent );
    dialog.setIconImages ( WebLookAndFeel.getImages () );
    dialog.add ( new InterfaceInspector ( inspected ) );
    ProprietaryUtils.setUtilityWindowType ( dialog );
    dialog.setModalExclusionType ( Dialog.ModalExclusionType.APPLICATION_EXCLUDE );
    dialog.setModal ( false );
    dialog.pack ();
    dialog.setLocationRelativeTo ( inspected );
    // dialog.setAttachedTo ( ? );
    dialog.setVisible ( true );
    return dialog;
}
 
Example #20
Source File: SettingsProcessor.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Constructs new {@link SettingsProcessor} for the specified {@link JComponent} and {@link Configuration}.
 *
 * @param component     {@link JComponent} which settings are being managed
 * @param configuration {@link Configuration}
 */
public SettingsProcessor ( @NotNull final C component, @NotNull final K configuration )
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Component and configuration
    this.component = component;
    this.configuration = configuration;

    // Performing initial settings load
    loadInitialSettings ();

    // Initializing processor settings
    initialize ();
}
 
Example #21
Source File: JToggleButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JToggleButton basic = new JToggleButton ( "", true );
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( basic, getExampleLanguageKey ( "styled.text.basic" ) );

    final JToggleButton group1 = new JToggleButton ( "", true );
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group1, getExampleLanguageKey ( "styled.text.group1" ) );

    final JToggleButton group2 = new JToggleButton ();
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group2, getExampleLanguageKey ( "styled.text.group2" ) );

    final JToggleButton group3 = new JToggleButton ();
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group3, getExampleLanguageKey ( "styled.text.group3" ) );

    final JToggleButton icon = new JToggleButton ( WebLookAndFeel.getIcon ( 16 ) );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( icon, getExampleLanguageKey ( "styled.text.icon" ) );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ), icon );
}
 
Example #22
Source File: StyleData.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Removes related style child.
 *
 * @param child related style child
 */
protected void removeChild ( @NotNull final JComponent child )
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Removing child
    if ( children != null )
    {
        final Iterator<WeakReference<JComponent>> iterator = children.iterator ();
        while ( iterator.hasNext () )
        {
            final WeakReference<JComponent> next = iterator.next ();
            if ( next.get () == child )
            {
                iterator.remove ();
            }
        }
    }
}
 
Example #23
Source File: JToggleButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JToggleButton basic = new JToggleButton ( "", true );
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( basic, getExampleLanguageKey ( "plain.text.basic" ) );

    final JToggleButton group1 = new JToggleButton ( "", true );
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group1, getExampleLanguageKey ( "plain.text.group1" ) );

    final JToggleButton group2 = new JToggleButton ();
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group2, getExampleLanguageKey ( "plain.text.group2" ) );

    final JToggleButton group3 = new JToggleButton ();
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group3, getExampleLanguageKey ( "plain.text.group3" ) );

    final JToggleButton icon = new JToggleButton ( WebLookAndFeel.getIcon ( 16 ) );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( icon, getExampleLanguageKey ( "plain.text.icon" ) );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ), icon );
}
 
Example #24
Source File: JButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JButton basic = new JButton ();
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( basic, getExampleLanguageKey ( "styled.text.basic" ) );

    final JButton group1 = new JButton ();
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group1, getExampleLanguageKey ( "styled.text.group1" ) );

    final JButton group2 = new JButton ();
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group2, getExampleLanguageKey ( "styled.text.group2" ) );

    final JButton group3 = new JButton ();
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group3, getExampleLanguageKey ( "styled.text.group3" ) );

    final JButton icon = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( icon, getExampleLanguageKey ( "styled.text.icon" ) );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ), icon );
}
 
Example #25
Source File: JButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JButton basic = new JButton ();
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( basic, getExampleLanguageKey ( "plain.text.basic" ) );

    final JButton group1 = new JButton ();
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group1, getExampleLanguageKey ( "plain.text.group1" ) );

    final JButton group2 = new JButton ();
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group2, getExampleLanguageKey ( "plain.text.group2" ) );

    final JButton group3 = new JButton ();
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group3, getExampleLanguageKey ( "plain.text.group3" ) );

    final JButton icon = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( icon, getExampleLanguageKey ( "plain.text.icon" ) );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ), icon );
}
 
Example #26
Source File: WebTableCellRenderer.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Checks whether or not specified property change should actually be fired.
 * All property fire methods are overridden and made final for performance reasons.
 *
 * @param propertyName changed property name
 * @param oldValue     old property value
 * @param newValue     new property value
 */
protected void checkPropertyChange ( final String propertyName, final Object oldValue, final Object newValue )
{
    if ( Objects.equals ( propertyName, StyleId.STYLE_PROPERTY, StyleId.PARENT_STYLE_PROPERTY,
            AbstractDecorationPainter.DECORATION_STATES_PROPERTY, WebStyledLabel.STYLE_RANGES_PROPERTY,
            WebLookAndFeel.TEXT_PROPERTY, WebLookAndFeel.BORDER_PROPERTY, WebLookAndFeel.MODEL_PROPERTY ) )
    {
        allowPropertyChange ( propertyName, oldValue, newValue );
    }
    else if ( Objects.equals ( propertyName, WebLookAndFeel.FONT_PROPERTY, WebLookAndFeel.FOREGROUND_PROPERTY ) &&
            oldValue != newValue && getClientProperty ( BasicHTML.propertyKey ) != null )
    {
        allowPropertyChange ( propertyName, oldValue, newValue );
    }
}
 
Example #27
Source File: AsyncTreeModel.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds child nodes for the specified node.
 * This method might be used to manually change tree node children without causing any structure corruptions.
 *
 * @param parent   node to process
 * @param children new node children
 */
public void addChildNodes ( @NotNull final N parent, @NotNull final List<N> children )
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Ensure model is installed
    checkInstalled ();

    // Ensure node children are loaded
    if ( parent.isLoaded () )
    {
        // Adding new raw children
        List<N> cachedChildren = rawNodeChildrenCache.get ( parent.getId () );
        if ( cachedChildren == null )
        {
            cachedChildren = new ArrayList<N> ( children.size () );
            rawNodeChildrenCache.put ( parent.getId (), cachedChildren );
        }
        cachedChildren.addAll ( children );
        cacheNodesById ( children );

        // Clearing nodes cache
        // That might be required in case nodes were moved inside of the tree
        clearNodeChildrenCache ( children, false );

        // Inserting nodes
        insertNodesIntoImpl ( children, parent, parent.getChildCount () );

        // Updating parent node sorting and filtering
        filterAndSort ( parent, false );
    }
}
 
Example #28
Source File: SettingsProcessor.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Loads saved settings for the {@link JComponent}.
 * Must always be performed on Swing Event Dispatch Thread.
 */
public final void load ()
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Ignore load if its save or load already running
    if ( !loading && !saving )
    {
        // Load settings
        try
        {
            loading = true;
            loadSettings ( component () );
        }
        catch ( final Exception e )
        {
            final String msg = "Unable to load component settings for group '%s' and key '%s' due to unexpected exception";
            final String fmsg = String.format ( msg, configuration.group (), configuration.key () );
            LoggerFactory.getLogger ( SettingsProcessor.class ).error ( fmsg, e );
        }
        finally
        {
            loading = false;
        }
    }
}
 
Example #29
Source File: StyleData.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Updates current skin in the skinnable component.
 * This method is used to properly update skin on various changes.
 *
 * @param children whether or not should apply the same skin to style children
 */
protected void updateSkin ( final boolean children )
{
    // Event Dispatch Thread check
    WebLookAndFeel.checkEventDispatchThread ();

    // Retrieving component and checking its existence
    final JComponent component = getComponent ();

    // Updating component skin
    getSkin ().updateSkin ( component );

    // Updating children skins
    if ( children && CollectionUtils.notEmpty ( this.children ) )
    {
        for ( final WeakReference<JComponent> reference : this.children )
        {
            final JComponent child = reference.get ();
            if ( child != null )
            {
                StyleManager.updateSkin ( child );
            }
        }
    }

    // Informing about skin visual update
    fireSkinUpdated ( component, getStyleId () );
}
 
Example #30
Source File: WInternalFrameUI.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method is called when the user wants to deiconify the frame.
 * The {@code playRestoreUpSound} Action is fired.
 * This action is delegated to the desktopManager.
 */
public void deiconifyFrame ()
{
    // Internal Frame Auditory Cue Activation
    if ( !internalFrame.isMaximum () )
    {
        // This method seems to regularly get called after an
        // internal frame is maximized. Don't play this sound then.
        WebLookAndFeel.playSound ( internalFrame, "InternalFrame.restoreUpSound" );
    }

    // Delegate to desktop manager
    getDesktopManager ().deiconifyFrame ( internalFrame );
}