Comments (17)
Work in progress (code upload coming up shortly)
from substance.
In general I'd like to keep as much of the implementation details private as possible. Going forward into Java 9 land (couple of years down the road?) I'll be using the new module system to make things tighter.
In this particular area, I don't think I want to expose that class as part of the API. So one possible thought here is to expose the more generic mechanism of decorating certain parts of certain areas (adding controls, removing controls, laying out controls) in the same way Substance allows you to tweak the visual appearance of UI without extending its internal classes - with painters.
Here I can see a certain similarity between this bug and #41 - what would be the right level of granularity for allowing apps to go deeper into how core controls are presented on the screen.
from substance.
Whatever way you choose to do it, I would hope to retain some possibility of customizing the title bar. My bosses required a wide logo on the left edge plus some centered text.
In certain special windows we also replace the "close" icon with a different icon representing something like "re-dock". (We allow tabs in a tabbed pane to be un-docked to separate windows and then re-docked into the tabbed pane.)
Comments in the existing code hint that you are already aware the class could be improved to better support right-to-left text, for example.
from substance.
I'll handle #61 and this one as part of the same extensibility API
from substance.
Reference for how UWP / AppKit handle this:
https://docs.microsoft.com/en-us/windows/uwp/design/shell/title-bar
https://developer.apple.com/documentation/appkit/nsfullsizecontentviewwindowmask
https://developer.apple.com/documentation/appkit/nswindow/1419167-titlebarappearstransparent
The tentative plan is:
- API to mark a root pane to extend into the title bar
- API to return a new instance of a title button so that it looks consistent with other control buttons (close, minimize, maximize)
- API to return title area left / right insets to prevent extended root pane content from overlapping with control buttons
The intent is to enable apps to create layouts like the attached
from substance.
As for the original request, I still do not plan to expose SubstanceTitlePane / SubstanceInternalFrameTitlePane to apps.
Instead, if you want to tweak the contents of the title pane it will be like this:
- Use the new API to extend your content into the title pane - with proof of concept being the Flamingo plugin for ribbon and a couple of demo apps.
- Use the new APIs for left / right title pane insets + title pane height.
- Use the new API to get one or more additional title pane control buttons.
From this point, you will be fully in charge of:
- Drawing the background of the title pane - with SubstanceDecorationPainter.paintDecorationArea + SubstanceOverlayPainter.paintOverlay
- Positioning and drawing the title text itself - get the font with FontSet.getWindowTitleFont, apply drop shadow if necessary, etc
- Positioning of additional content - app logo, etc
All of these need to be validated in at least a couple of demo apps
from substance.
The code behind this app is in https://github.com/kirill-grouchnikov/substance-demo/tree/master/src/org/pushingpixels/demo/substance/main/visor at the present moment. It might move to substance-samples at some point in the future.
For now it's showing the usage of the new APIs to extend the content into the title pane, create a title pane button that looks consistent with existing control buttons (the small refresh in the left pane), and tweak the title pane height to accommodate taller content (like in the screenshot above for the search field) to create consistent vertical alignment across the top section.
from substance.
Second pass for the mail demo app
from substance.
All the planned APIs are in place.
The new SubstanceCortex.WindowScope APIs for extending content into the title pane, querying the insets, creating a button and increasing the height. Plus the existing skin / painter APIs to draw the background of your custom title pane.
SubstanceTitlePane remains an internal implementation detail. At some point in the future with Java 9 modules it will not be accessible at all to apps.
from substance.
See the last section of https://github.com/kirill-grouchnikov/substance/blob/master/www/release-info/8.0/release-info.md for the API overview
from substance.
I have downloaded the demos and played with the VisorMail example (shown above).
I have noticed that when using extendContentIntoTitlePane(true)
, the "maximize" icon does not change into a "restore" icon when the window is maximized. I think that is a bug.
I think I can do what I need to do by using the API provided. When title pane height is increased using WindowScope.setPreferredTitlePaneHeight
, I would probably prefer that the window control icons (close, minimize, etc.) be aligned close to the upper edge of the window rather than vertical center of the title bar. Maybe do that by default, or implement a new SubstanceSlices.Gravity.TOP_EDGE_CENTERED constant, or something like that.
Am I understanding correctly that when using extendContentIntoTitlePane(true)
, the frame title and icon are simply not displayed at all regardless of any settings for GlobalScope.configureTitleContentGravity
?
from substance.
So perhaps setPreferredTitlePaneHeight should get another parameter - vertical gravity for aligning the control buttons.
And then getTitlePaneControlInsets would become getTitlePaneControlBounds that returns a rectangle that app-specific title pane layout should not "go into".
from substance.
Tracking the maximize/restore issue in #67
from substance.
And for the last question - calling extendContentIntoTitlePane only displays the control buttons. Nothing else - no background, no title, no icon. Those essentially become part of your content area and need to be positioned and drawn by the app side.
I'll add another small demo showing something like the title pane in HipChat
from substance.
The latest sources for the VisorMail demo now live at https://github.com/kirill-grouchnikov/substance-samples/tree/master/src/org/pushingpixels/samples/substance/mail
from substance.
Couple more Visor demos that will be in substance-samples shortly. The first one is a retouch of the Cookbook sample that was there all along, with the change that pushes some of the toolbar content into the title pane area:
The second one is much simpler, showing how to use WindowScope.getTitlePaneControlInsets to respect the insets required for the control buttons:
In both examples the title pane area is "marked" with ComponentScope.setDecorationAreaType(DecorationAreaType.PRIMARY_TITLE_PANE) on the relevant components that emulate the appearance of the title pane. No additional work is required to draw consistent visuals (with decoration and overlay painters) - although that is another option, of course.
from substance.
Source code for the two additional sample apps is at https://github.com/kirill-grouchnikov/substance-samples/tree/master/src/org/pushingpixels/samples/substance/cookbook and https://github.com/kirill-grouchnikov/substance-samples/tree/master/src/org/pushingpixels/samples/substance/chat
from substance.
Related Issues (20)
- Writing Japanese text fails when using Substance HOT 2
- Issue with the tree cell render which must be object of default cell render rather than the treecell. HOT 4
- SubstanceTableHeaderUI not being able to find draggedColumn HOT 9
- isFocusTraversable() has been deprecated
- Switching from Substance to another L&F causes IllegalArgumentException HOT 11
- Windows maximize when dragged to top HOT 1
- Maximize bug on secondary screen when screen resolutions differ HOT 4
- NullPointerException for Business L&F under Java 9 HOT 4
- Possible to change scroll bar style? HOT 1
- Move to Java 9 for compile / runtime HOT 1
- Support for "inverse flat" look of title pane control buttons HOT 1
- Slow performance HOT 4
- How to apply custom FontSets? HOT 2
- JTree rendering with Raven HOT 4
- Using the same border for JTextField and JTextArea/JScrollPane? HOT 2
- Not possible to change alpha value for color with color picker HOT 4
- JitPack deployment HOT 4
- NullPointerException in CheckBoxMenuItemIcon.getIconWidth() HOT 5
- Migration guide to v8 HOT 2
- Colorize SVG icons on skin change HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from substance.