Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component styling support and UI class revamp #476

Open
10 of 24 tasks
mgarin opened this issue Dec 7, 2017 · 10 comments
Open
10 of 24 tasks

Component styling support and UI class revamp #476

mgarin opened this issue Dec 7, 2017 · 10 comments

Comments

@mgarin
Copy link
Owner

mgarin commented Dec 7, 2017

Some of the existing components have to be "moved" to the new Component-UI-Painter structure with all classes (except base Swing components themselves like JLabel) having 100% WebLaF implementation. That is very important to avoid any unnecessary interference from Swing code, for instance from basic UI classes like BasicButtonUI and to allow multiple performance optimizations to be made (like removing unnecessary settings changes and/or listeners).

Currently there only a few components left that haven't gone through major revamp and are still solely backed by UI class implementation:

Some other components also still need major adjustments or even complete revamps:


There are also quite a few components that are still using basic Swing UI classes instead of fully-custom WebLaF implementations, but which were already switched to new styling system:

  • JRootPane
  • JSpinner
  • JMenu
  • JMenuItem
  • JCheckBoxMenuItem
  • JRadioButtonMenuItem
  • JPopupMenu
  • JList
  • JTable
  • JTree
  • JComboBox
  • JTextField
  • JPasswordField
  • JFormattedTextField
  • JTextArea
  • JEditorPane
  • JTextPane
  • JToolBar
  • JScrollPane
  • JOptionPane
  • JColorChooser

Just to emphasize - these are components that are already fully styleable and work 100% correctly in the new versions. The only downside is the UI implementation that partially uses basic Swing UI which is quite dirty and does some unnecessary operations upon installation that are later overwritten by WebLaF anyway. While I do want to eventually get rid of all Swing UI implementations completely - it is a lot of work and it is quite low on priority list, so I'll only do it once necessary for some particular feature or improvement.

Eventually I will move all components to new UI implementations but they are already reasonably stable at this point which is why that task is not critical and low on priority list.

@mgarin mgarin added this to the v1.2.9 milestone Dec 7, 2017
@mgarin mgarin self-assigned this Dec 7, 2017
@mgarin mgarin added this to In progress in v1.2.9 Dec 7, 2017
mgarin added a commit that referenced this issue Dec 19, 2017
Split pane internal code have gone through a complete rework, so split pane now fully supports styling for all of its parts. Due to multiple limitations of `BasicSplitPaneUI` WebLaF now features its own basic UI in form of `WSplitPaneUI`. Also Swing divider component implementation was based on AWT `Component` which did not allow attaching WebLaF styling to it, so `BasicSplitPaneDivider` was also replaced with new `WebSplitPaneDivider` component (based on `JComponent`) which is fully supported by new styling system.

SplitPane [ #476 ]
- WSplitPaneUI.java - Now fully replaces `BasicSplitPaneUI` and has a few optimizations and adjustments
- WSplitPaneUI.java - Added non-continuous divider placement adjustment according to decoration border insets
- WSplitPaneUI.java - Now features a separate listener that updates divider visibility depending on the split pane sides availability
- WSplitPaneListener.java - New class containing basic listeners from `BasicSplitPaneUI` for `WSplitPaneUI`
- SplitPaneLayout.java - New basic layout for `WSplitPaneUI`
- WebSplitPaneUI.java - Optimized for new basic `WSplitPaneUI` usage, removed some redundant code parts
- WebSplitPaneDivider.java - New divider component that replaces `BasicSplitPaneDivider` and utilizes styling system
- ComponentType.xsd - Added new divider component type constant
- SplitPanePainter.java, SplitPaneDividerPainter.java - Added `JSplitPane` orientation -based states for styling convenience
- splitpanedivider.xml, StyleId.java - New styling for `JSplitPane` divider component
- splitpane.xml - Added `non-opaque`, `transparent`, `decorated` and `focusable` styles

Button
- WButtonListener.java - Reworked to separate instances of `Action` class for each of supported actions
- WButtonListener.java - Replaced `LazyActionMap` with `UIActionMap` usage, it will slightly affect memory but improve code a lot
- WButtonUI.java - Simplified `WButtonListener` usage

ScrollPane
- scrollpane.xml - Added `undecorated-buttonless` style to cover some additional use cases
- scrollbar.xml - Adjusted margin setting for `buttonless` style

ColorChooser
- WebColorChooserUI.java, colorchooser.xml - Now uses a separate style identifier for `WebColorChooserPanel`
- WebColorChooserPanel.java - Added constructors to allow providing custom style identifiers
- colorchooserpanel.xml - Separate style file for `WebColorChooserPanel`
- colorchooser.xml - Added separate dark style [ #54 ]

Canvas
- WebCanvas.java - States list now always exists for override convenience
- WebCanvas.java - Returns a copy of states for method override convenience
- WebCanvas.java - Added methods to add/remove `Collection` of states
- WebCanvas.java - Updated JavaDoc

Trees
- TreePainter.java - Enhanced full-line nodes selection on mouse events
- WebFileTree.java - Now shows root handles by default

StyleManager
- StyleData.java - Added install and uninstall methods to allow appropriate listeners handling
- StyleData.java - Added some missing EDT checks
- StyleManager.java, - Added separate `StyleData` install and uninstall calls for skin installation and uninstallation

Painter
- AbstractPainter.java - Separated `install` and `uninstall` methods into smaller pieces for override convenience
- AbstractDecorationPainter.java - Fixed issue with border not being initialized properly when based on specific decoration state
- Updated all painters related to `AbstractPainter` to use newly added methods instead of overriding `install` and `uninstall`

Decoration
- DecorationState.java - Added `one-touch` state and missing JavaDocs
- CheckIcon.java, MixedIcon.java, RadioIcon.java - Updated identifiers to be unique and replaceable
- AlignLayout.java - New `IContentLayout` implementation that copies `AlignLayout` behavior for contents
- AlignLayout.xsd, IContent.xsd - New XSD for `AlignLayout` class
- AlignLayout.java, BorderLayout.java, WebCanvas.java, AdaptiveCanvasPainter.java - Minor JavaDoc updates
- AlphaLayerBackground.java - Added default values for settings for convenience

IconManager
- LazyIcon.java - Added better `toString` implementation

Utilities
- CollectionUtils.java - Fixed non-strict lists equality check for cases with duplicate entries in first list
- CollectionUtils.java - Added method to remove `Collection` of elements from another `Collection`
- CollectionUtils.java - Added method to sort `List` of elements using any `Comparator`
- CollectionUtils.java - Renamed multiple methods for usage convenience
- ColorUtils.java - Simplified method names for convenient, refactored code, updated JavaDoc
- ColorUtils.java - Added color caching for methods with predictable outcome to optimize memory usage
- ColorConverter.java - Slightly refactored code, removed unnecessary variables
- AbstractUnits.java, ModifierType.java - Added `Locale.ROOT` usage to `toLowerCase` methods
- ValuesTable.java, ValuesTableConverter.java - Removed `ValuesTable` as deprecated and redundant feature
- DoubleMap.java, MapUtils.java - Removed `DoubleMap` as deprecated and redundant feature
- IndexedSupplier.java, CollectionUtils.java - Replaced `IndexedSupplier` with simple `Function` usage
- SelectorUtils.java - Separated from `LafUtils`, will be revamped later on
- LoremIpsum.java - Made serializable for convenience
- LafUtils.java - Cleared from deprecated methods

LookAndFeel
- UIAction.java - New custom `Action` for usage within `ActionMap`s in UI classes, unlike `sun.swing.UIAction` it is not designed to be used globally
- UIActionMap.java - New custom `ActionMap` for usage in UI classes instead of `LazyActionMap`
- LazyActionMap.java - Slightly updated code, marked as deprecated, added information on why usage will be halted in later updates
- WebLookAndFeel.java - Added small default divider size value to ensure it can size properly based on its style size

NinePatchEditor
- NinePatchEditor.java, LafUtils.java - Replaced alpha background painting with `AlphaLayerBackground` usage
- ninepatcheditor.xml - Added dark style, removed unnecessary default settings [ #54 ]

DemoApplication
- JSplitPaneExample.java, demo-language.xml, jsplitpane.png - Added `JSplitPane` examples
- JScrollPaneExample.java - Added extra style example
- AbstractExample.java - Adjusted example scroll pane to look better
- JPanelExample.java - Minor code refactoring
@mgarin
Copy link
Owner Author

mgarin commented Dec 19, 2017

JSplitPane got a major update and is now fully supported by styling system.

@mgarin
Copy link
Owner Author

mgarin commented Jul 23, 2018

WebBreadcrumb got a major update and is now fully supported by styling system.

@mgarin
Copy link
Owner Author

mgarin commented Aug 5, 2019

WebCollapsiblePane and WebAccordion got revamped and are now fully supported by styling system. Also all changes are now available in v1.2.9 update:
https://github.com/mgarin/weblaf/releases/tag/v1.2.9

@mgarin mgarin removed this from In progress in v1.2.9 Aug 5, 2019
@mgarin mgarin modified the milestones: v1.2.9, v1.3.0 Aug 5, 2019
@mgarin mgarin added this to In progress in v1.9.0 Aug 5, 2019
@mgarin
Copy link
Owner Author

mgarin commented Aug 10, 2019

JTabbedPane revamp will become available in v1.2.10 [ #35 ]
JSlider revamp will become available in v1.2.11 [ #493 ]
WebCustomTooltip revamp will become available in v1.2.11 [ #520 ]

@mgarin
Copy link
Owner Author

mgarin commented Aug 10, 2019

Updated information in the main post. I plan to finish all stuff planned on this issue by the time I get to v1.3.0. Also some of the components might stay backed by Swing UI implementations until project is moved to newer JDK as rewriting the UI might be unnecessary for those components in the first place.

mgarin added a commit that referenced this issue Aug 27, 2019
- WInternalFrameUI.java, WInternalFrameInputListener.java - Added to replace `BasicInternalFrameUI` class and fix some of it's issues
- WInternalFrameInputListener.java - Added `MouseEvent` filter for double-click on title pane for left mouse button only
- InternalFrameInputListener.java - New interface for distinct internal frame UI input listeners
- WDesktopPaneUI.java, WDesktopPaneInputListener.java - Added to replace `BasicDesktopPaneUI` class
- DesktopPaneInputListener.java - New interface for distinct desktop pane UI input listener
- WDesktopIconUI.java, WDesktopIconInputListener.java - Added to replace `BasicDesktopIconUI` class
- DesktopIconInputListener.java - New interface for distinct desktop icon UI input listener
- Updated all related painters and descriptors

Button
- ButtonInputListener.java - New interface for distinct button UI input listeners
- AbstractButtonPainter.java - Fixed possible NPE

Tree
- TreePainter.java - Fixed possible NPE

SplitPane
- SplitPaneInputListener.java - New interface for distinct split pane UI input listeners

LanguageManager
- LanguageManager.java - Added methods for registering component-related listeners
- Dictionary.java - Replaced junky part of the code that detected supported locales
- Refactored some outdated classes and APIs, added missing JavaDoc and annotations

NinePatchEditor
- NinePatchEditorStyles.java - Moved editor-related styles here from `StyleId`
- NinePatchEditorPanel.java - Replaced `StyleId` references with `NinePatchEditorStyles` ones
- extension.xml - Removed unused style

General
- Added multiple `@NotNull` and `@Nullable` annotation across modified classes
- Fixed multiple possible NPEs that could have been caused by incorrect API usage
- Refactored multiple methods to have single exit point, including void methods

Utilities
- WeakComponentDataList.java - Removed unnecessary data list copy operations
- WeakComponentData.java, WeakComponentDataList.java - Fixed multiple possible NPEs
- PainterSupport.java - Passed `ComponentUI` as an additional parameter to avoid retrieving it through Reflection

Project
- CONTRIBUTING.md - Some guidelines for contributing to WebLaF project
- intellij-idea-inspections.xml - Updated inspection settings
- .gitignore - Added some ignores for local files
@mgarin
Copy link
Owner Author

mgarin commented Aug 27, 2019

JDesktopPane, JInternalFrame and JDesktopIcon revamps have been pushed into master branch and will be available in v1.2.10 update.

@mgarin
Copy link
Owner Author

mgarin commented Oct 17, 2019

Added WebComponentPane and WebOverlay to the list of components for revamp.

@mokun
Copy link

mokun commented Nov 12, 2019

Having WebSpinner and WebSlider with UI customization would be really great !

@mgarin
Copy link
Owner Author

mgarin commented Nov 12, 2019

@mokun WebSpinner is already fully customizable through style: spinner.xml
WebSlider is not yet though, will be coming in either v1.2.11 or v1.2.12 update.

@mgarin
Copy link
Owner Author

mgarin commented Nov 28, 2019

WebOverlay now has brand new API, is properly styleable and it's code if fully documented.

@mgarin mgarin pinned this issue Apr 22, 2020
@mgarin mgarin removed this from the v1.9.0 milestone Apr 23, 2020
@mgarin mgarin mentioned this issue Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v1.9.0
  
In progress
Development

No branches or pull requests

2 participants