Java Code Examples for com.alee.laf.WebLookAndFeel#isInstalled()
The following examples show how to use
com.alee.laf.WebLookAndFeel#isInstalled() .
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: StyleManager.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Registers new {@link ComponentDescriptor}. * It will replace any other {@link ComponentDescriptor} registered for the same {@link JComponent} type. * Manager initialization is not required to register {@link ComponentDescriptor}. * * @param descriptor {@link ComponentDescriptor} to register */ public static void registerComponentDescriptor ( @NotNull final ComponentDescriptor descriptor ) { // Event Dispatch Thread check WebLookAndFeel.checkEventDispatchThread (); // Synchronized by descriptors synchronized ( descriptors ) { final Class componentClass = descriptor.getComponentClass (); // Removing existing descriptor with same class final ComponentDescriptor toRemove = descriptorsByClass.get ( componentClass ); if ( toRemove != null ) { unregisterComponentDescriptor ( toRemove ); } // Saving new descriptor descriptors.add ( descriptor ); // Caching descriptor descriptorsByIdentifier.put ( descriptor.getId (), descriptor ); descriptorsByClass.put ( componentClass, descriptor ); // Updating UIDefaults if ( WebLookAndFeel.isInstalled () ) { descriptor.updateDefaults ( UIManager.getLookAndFeelDefaults () ); } // todo Listeners for these changes? } }
Example 2
Source File: WebTreeUI.java From weblaf with GNU General Public License v3.0 | 4 votes |
@Override public void installUI ( @NotNull final JComponent c ) { // Installing UI super.installUI ( c ); // todo Probably completely remove this? // Overwrite indent in case WebLookAndFeel is not installed as LaF if ( !WebLookAndFeel.isInstalled () ) { setRightChildIndent ( 12 ); setLeftChildIndent ( 12 ); } // Allow each cell to choose its own preferred height tree.setRowHeight ( -1 ); // Modifying default drop mode // USE_SELECTION mode is not preferred since WebLaF provides a better visual drop representation tree.setDropMode ( DropMode.ON ); // Use a moderate amount of visible rows by default // BasicTreeUI uses 20 rows by default which is too much for most of cases tree.setVisibleRowCount ( 10 ); // Forces tree to save changes when another tree node is selected instead of cancelling them tree.setInvokesStopCellEditing ( true ); // Hover behavior hoverNodeTracker = new TreePathHoverBehavior<JTree> ( tree, true ) { @Override public void hoverChanged ( @Nullable final TreePath previous, @Nullable final TreePath current ) { // Updating hover row final int previousRow = hoverRow; hoverRow = current != null ? tree.getRowForPath ( current ) : -1; // Repainting nodes according to hover changes // This occurs only if hover highlight is enabled final Painter painter = PainterSupport.getPainter ( tree ); if ( painter instanceof ITreePainter && ( ( ITreePainter ) painter ).isRowHoverDecorationSupported () ) { repaintRow ( previousRow ); repaintRow ( hoverRow ); } // Updating custom WebLaF tooltip display state final TreeToolTipProvider provider = getToolTipProvider (); if ( provider != null ) { provider.hoverAreaChanged ( tree, previousRow != -1 ? new TreeCellArea ( previousRow ) : null, hoverRow != -1 ? new TreeCellArea ( hoverRow ) : null ); } // Informing {@link com.alee.laf.tree.WebTree} about hover node change // This is performed here to avoid excessive listeners usage for the same purpose if ( tree instanceof WebTree ) { final MutableTreeNode p = previous != null ? ( MutableTreeNode ) previous.getLastPathComponent () : null; final MutableTreeNode c = current != null ? ( MutableTreeNode ) current.getLastPathComponent () : null; ( ( WebTree ) tree ).fireHoverChanged ( p, c ); } } /** * Repaints specified row if it exists and it is visible. * * @param row row to repaint */ private void repaintRow ( final int row ) { if ( 0 <= row && row < tree.getRowCount () ) { tree.repaint ( getRowBounds ( row, true ) ); } } }; hoverNodeTracker.install (); // Applying skin StyleManager.installSkin ( tree ); }