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

New WebMultiSplitPane component #477

Closed
mgarin opened this issue Dec 19, 2017 · 4 comments
Closed

New WebMultiSplitPane component #477

mgarin opened this issue Dec 19, 2017 · 4 comments

Comments

@mgarin
Copy link
Owner

mgarin commented Dec 19, 2017

Common Swing JSplitPane component is quite bad and lacks quite a few features that are necessary for many cases. Unfortunately some of those features just won't work with the default JSplitPane implementation and some will be quite hard to implement.

This is why I made a big update for JSplitPane making it fully-styleable and fixing a few issues [ 85ff9b1 ] but didn't include any new functionality in it.

All new and shiny features will be exclusive to new component - WebMultiSplitPane.
Here is a short list of features that are planned for the initial release:

  • Support for more than two components
    This will allow you to store any amounts of components within single WebMultiSplitPane unlike JSplitPane which can only store two components at a time.

  • Proper percent-based sides sizing
    Basic JSplitPane has a quite poor support for percent-based divider placement and has quite a few issues with its repositioning on resize and on other changes. Those will be addressed in WebMultiSplitPane from the beginning.

  • Better and easier initial split positioning
    As you might know - it is quite problematic to initially position JSplitPane as you might want to instead of just giving obscure location. WebMultiSplitPane will feature a few options which will allow you to configure the way dividers are positioned at startup.

  • Additional interactions
    For now I have an idea of a few additional interactions with the divider that can be implemented. For example allow maximizing two of the areas to the whole size of the split when double-clicking on the divider between them or adding hotkeys to maximize one singular area to the whole size of the split and shrinking it back (close to how one-touch buttons work, but not completely).

  • Customizable divider
    Along with WebMultiSplitPane a custom divider component will be added. It will feature quite a few settings you will be able to configure like placement of additional components on it or various one-touch button and gripper settings or adding a default option to have orientation change button on the divider.

  • Convenient API to use component features
    Set of features mentioned above will surely require a much better API than JSplitPane currently has to manage all of the settings and there will be one.

These are all of the ideas I have for the new component for now, but I will surely update the list later. If you want to comment on any of them or have some other feature suggestions - don't hesitate to drop them below!

@mgarin mgarin added this to the v1.3.0 milestone Dec 19, 2017
@mgarin mgarin self-assigned this Dec 19, 2017
@mgarin
Copy link
Owner Author

mgarin commented Mar 13, 2018

I didn't plan to push this component early, but it seems that it will make its way in v1.2.9 update as its basic iteration was implemented in one of our internal projects. I will push the component soon with some other important changes coming soon.

@mgarin mgarin modified the milestones: v1.3.0, v1.2.9 Mar 13, 2018
mgarin added a commit that referenced this issue Mar 23, 2018
1. I've made a full pass on every existing renderer in the library in attempt to streamline them and provide more customization options without necessity to completely rewrite their code. All existing renderers now have three generics in their class - value type (for tables and lists it can be anything, for trees it is now any TreeNode instead of previous DefaultMutableTreeNode), component type (for instance it can be `JList` or `WebFileTable` depending on the use case) and `RenderingParameters` type (this is a completely new thing, parameters instance is created on each separate cell rendering call and contains cell-specific settings which vary based on renderer).

2. `WebMultiSplitPane` basic implementation is now available [ #477 ]. It still doesn't have some of the advanced options I was planning to add to it but it is fully functional and provides a clean and convenient API to configure initial split position and resize ratios, adjust components on the fly and allows saving and restoring position data with just one line of code.

3. `WebDirectoryChooser` light and dark styling have been adjusted to stay in line with other existing components and especially with `JFileChooser` styling. Also `Desktop` quick access button have been added into both `WebDirectoryChooser` and `JFileChooser` implementations on systems where it can be easily found, for the rest it will remain hidden.

4. Some outdated interfaces like `TextProvider` have been removed in favor of using ones similar to later JDK releases like `Function` or `Supplier`. This is not the final pass and I still have my eyes on a few more interfaces I would like to get rid of within this update.

You can also check more detailed changes to each of the files in this commit below.

Renderers
- IconBridge.java, TextBridge.java, ForegroundBridge.java - New bridge interfaces between various renderers and rendered values
- IconSupport.java, TitleSupport.java - Replaced by bridge `RenderingBridge` interface implementations
- RenderingParameters.java - New base interface for various runtime rendering parameters
- EmptyRenderingParameters.java - Singleton `RenderingParameters` implementation that doesn't have any actual parameters
- Added value, component and parameters generics support across all existing renderers
- StrokeSupport.java, ColorSupport.java - Removed as too obscure and redundant
- Skin.java, SkinExtension.java, SkinInfo.java - Removed redundant interface implementations
- FeatureState.java - Removed redundant interface implementation
- Easing.java - Removed redundant interface implementation

Content
- LocaleTextContent.java - Renamed from `LanguageItemLocale` and now uses `JComponent`'s `Locale` instead of a client property

Decoration
- WebDecoration.java - Temporary changed grouping borders painting code to be based on `LineBorder` exclusively
- This change shouldn't affect any of existing styles and will in future be replaced with a proper grouping painting implementation

MultiSplitPane [ #477 ]
- WebMultiSplitPane.java - New component that can be used instead of base Swing `JSplitPane` to provide multiple split views
- MultiSplitPaneModel.java - `WebMultiSplitPane` model interface that has all required methods in it
- MultiSplitPaneSettingsProcessor.java - SettingsProcessor implementation that is able to save `WebMultiSplitPane` state
- WebMultiSplitPaneDivider.java - New component that is used as `WebMultiSplitPane` divider
- multisplitpane.xml - New default light and dark styles for `WebMultiSplitPane` component
- multisplitpanedivider.xml - New default light and dark styles for `WebMultiSplitPaneDivider` component

Trees
- Changed all `DefaultMutableTreeNode` usages to `TreeNode` and `MutableTreeNode` interfaces
- TreeCellParameters.java - `RenderingParameters` implementation for tree renderers
- WebTreeCellRenderer.java - Changed node type generic to use `TreeNode` as base
- Custom `TreeNode` and `MutableTreeNode` implementations should now properly work with trees, models and renderers
- WebTreeNode.java - `DefaultMutableTreeNode` replacement with generified methods and minor improvements
- WebTreeFilterField.java - Removed redundant `WeakReference` to the tree for which filter is used

List [ #153 ]
- ListCellParameters.java - `RenderingParameters` implementation for list renderers
- WebListModel.java - Added extra methods to add/set/remove data
- WebListModel.java - Removed some of the redundant methods
- WebListModel.java - Updated JavaDoc for existing methods
- CheckBoxListModel.java - Added data generic, removed redundant methods

ComboBox
- ComboBoxCellParameters.java - `RenderingParameters` implementation for combobox renderers
- WebComboBoxModel.java - Got simplified and is now also based on `WebListModel` implementation
- WebComboBoxModel.java - Doesn't reuse any of the passed arrays or collections
- WebComboBox.java - Replaced default model usages with `WebComboBoxModel`

Table
- TableCellParameters.java - `RenderingParameters` implementation for table renderers
- WebFileTableCellRenderer.java - Refactored to make use of new APIs
- WebFileTableCellRenderer.java - Added `UIResource` implementation for future usage
- FileTableCellParameters.java - `RenderingParameters` implementation for file table renderers
- table.xml - Moved default renderer alignment into renderer implementations for convenience

Link
- WebLink.java - Doesn't use `IconSupport` or `TitleSupport` anymore and instead relies on `LinkAction` methods
- LinkAction.java - Can now provide customized `WebLink` icon and text if necessary
- AbstractLinkAction.java - Abstract `LinkAction` implementation containing predefined icon and text
- Simplified various `LinkAction` implementations, some of them are now based on `AbstractLinkAction`

Popup
- WebPopup.java - Replaced drag behavior with smarter resize behavior usage
- WebPopup.java - Removed unnecessary lock object and added EDT checks
- WebPopup.java - Separated `ResizeDirections` class for convenience
- WebPopup.java - Adjusted fields for class to be serializable

Layout
- GroupPaneLayout.java - Simplified descriptors calculation code
- GroupPaneLayout.java - Minor code and JavaDoc refactoring
- GridSize.java - Added missing JavaDoc
- AbstractLayoutManager.java - Made Swing methods final to avoid incorrect methods override
- MultiLayout.java - Adjusted according to `AbstractLayoutManager` changes
- AbstractLineLayout.java - Added methods to retrieve and change spacing and parts spacing
- ToolbarLayout.java - Added more constructors to allow providing basic settings directly
- TableLayout.java, SingleFiledLayout.java - Cleaned up and refactored code
- Streamlined variable names across all existing layouts

FileChooser
- WebFileChooserPanel.java - Added quick button to move to desktop folder on systems where it can be located
- WebFileChooserPanel.java - Fixed excessively large spacing between elements in top and bottom bars

DirectoryChooser
- WebDirectoryChooserPanel.java - Added quick button to move to desktop folder on systems where it can be located
- WebDirectoryChooserPanel.java - Added missing styles for path field, tree and its scroll
- WebDirectoryChooserPanel.java - Replaced old drive icon with a new one
- WebDirectoryChooserPanel.java, directorychooser.xml - Improved default chooser styles
- directorychooser.xml - Added Dark skin chooser style

InterfaceInspector
- ComponentHighlighter.java - Tooltip position now adapts to inspected component position on the window for best preview

File
- Replaced all `File.getParentFile()` methods with `File.getParent()` usages instead to avoid issues

EventDispatchThread
- SettingsProcessor.java, SettingsManager.java - Added EDT checks in all methods that should be run on EDT
- PainterSupport.java - Removed unnecessary tree lock usage and added EDT check instead

Notifications
- NotificationManager.java - Replaced `WebLabel` with `WebStyledLabel` as default notification content component

API
- Objects.java - Temporary replacement for `java.util.Objects` which is not available in JDK6

Behaviors
- ComponentResizeBehavior.java - Now allows component drag just like `ComponentMoveBehavior` whenever direction is `CompassDirection.center`
- ComponentResizeBehavior.java - Fixed cursor reset upon finishing resize/drag operation
- ComponentResizeBehavior.java - Removed static methods and replaced them with instance-related ones
- ComponentMoveBehavior.java, ComponentResizeBehavior.java - Added `MouseEvent` consume upon drag/resize operations
- ComponentMoveBehavior.java, ComponentResizeBehavior.java - Updated JavaDoc

Utilities
- SwingUtils.java - Doesn't extend `CoreSwingUtils` anymore for usage transparency
- SwingUtils.java, WSplitPaneListener.java - Removed proprietary API usage
- TextUtils.java - Fixed return results for word boundary detection methods
- WebTimer.java - Made `Serializable` for convenience of usage within Swing components
- TopologicalSorter.java - Appropriate replacement for static `SortUtils`
- Node.java, Edge.java - Moved into `TopologicalSorter` as private static inner classes
- CollectionUtils.java - Added `distinct(List)` utility method
- SortUtils.java - Removed as redundant
- TextProvider.java - Removed as redundant, `Function<String,T>` is now used instead
- IntegerComparator.java - `Comparator` implementation for `Integer` values
- EmptyEnumeration.java - Singleton `Enumeration` implementation that has no elements

Tests
- FileUtilsTest.java - New test for some `FileUtils` methods, specifically for `FileComparator` that uses complex sorting algorithm
- file-name-sorting.txt - Simple resource containing a big list of file names to sort
- TextUtilsTest.java - New test for some `TextUtils` methods, specifically for word detection and word boundary detection ones

Demo
- WebDirectoryChooserExample.java, directorychooser.png - Added example for `WebDirectoryChooser` component
- JFileChooserExample.java - Minor fixes and improvements for example notifications
- Minor code refactoring and updates related to other changes from this commit

Project
- Removed multiple unnecessary `@SuppressWarnings` statements across the code
- intellij-idea-code-style.xml - Updated code style settings for IntelliJ Idea IDE
- intellij-idea-inspections.xml - Updated code inspection settings for IntelliJ Idea IDE
@mgarin
Copy link
Owner Author

mgarin commented Mar 23, 2018

First version of WebMultiSplitPane is out with the latest commit.

@mgarin mgarin modified the milestones: v1.2.9, v1.3.0 Apr 2, 2018
@mgarin
Copy link
Owner Author

mgarin commented Apr 2, 2018

I might add some fixes in v1.2.9 but further functionality improvements will be made in v1.3.0 or later.

@mgarin mgarin modified the milestones: v1.3.0, v1.2.9 Aug 5, 2019
@mgarin
Copy link
Owner Author

mgarin commented Aug 5, 2019

WebMultiSplitPane was implemented in v1.2.9 update:
https://github.com/mgarin/weblaf/releases/tag/v1.2.9

@mgarin mgarin closed this as completed Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant