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
8320359: ImageView: add styleable fitWidth, fitHeight, preserveRatio, smooth properties #1293
Closed
andy-goryachev-oracle
wants to merge
15
commits into
openjdk:master
from
andy-goryachev-oracle:8320359.image.view.css
Closed
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
91025ab
added styleable properties
andy-goryachev-oracle b9db283
whitespace
andy-goryachev-oracle 434568d
node
andy-goryachev-oracle 7ffe869
name
andy-goryachev-oracle 9b3d492
styleable
andy-goryachev-oracle 3119050
no nulls
andy-goryachev-oracle d43ca42
Merge remote-tracking branch 'origin/master' into 8320359.image.view.css
andy-goryachev-oracle 983bb25
Merge remote-tracking branch 'origin/master' into 8320359.image.view.css
andy-goryachev-oracle 7e01f0f
css util
andy-goryachev-oracle eb4485b
cleanup
andy-goryachev-oracle 49e5bc6
cleanup
andy-goryachev-oracle a6b772c
review comments
andy-goryachev-oracle f735b8b
save 8 bytes
andy-goryachev-oracle f720ddb
class = default
andy-goryachev-oracle 69761b4
list of
andy-goryachev-oracle File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
modules/javafx.graphics/src/main/java/com/sun/javafx/css/CssUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package com.sun.javafx.css; | ||
|
||
import java.util.List; | ||
import javafx.css.CssMetaData; | ||
import javafx.css.Styleable; | ||
import javafx.scene.Node; | ||
import com.sun.javafx.UnmodifiableArrayList; | ||
|
||
/** | ||
* Utility methods for dealing with CSS. | ||
*/ | ||
public final class CssUtil { | ||
|
||
private CssUtil() { | ||
} | ||
|
||
/** | ||
* Utility method which combines {@code CssMetaData} items in one immutable list. | ||
* <p> | ||
* The intended usage is to combine the parent and the child {@code CssMetaData} for | ||
* the purposes of {@code getClassCssMetaData()} method, see for example {@link Node#getClassCssMetaData()}. | ||
* <p> | ||
* Example: | ||
* <pre>{@code | ||
* private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES = CssMetaData.combine( | ||
* <Parent>.getClassCssMetaData(), | ||
* STYLEABLE1, | ||
* STYLEABLE2 | ||
* ); | ||
* }</pre> | ||
* This method returns an instance of a {@code List} that implements | ||
* {@link java.util.RandomAccess} interface. | ||
* | ||
* @param inheritedFromParent the {@code CssMetaData} items inherited from parent, must not be null | ||
* @param items the additional items | ||
* @return the immutable list containing all of the items | ||
*/ | ||
// NOTE: this should be a public utility, see https://bugs.openjdk.org/browse/JDK-8320796 | ||
public static List<CssMetaData<? extends Styleable, ?>> combine( | ||
List<CssMetaData<? extends Styleable, ?>> inheritedFromParent, | ||
CssMetaData<? extends Styleable, ?>... items) | ||
{ | ||
CssMetaData[] combined = new CssMetaData[inheritedFromParent.size() + items.length]; | ||
inheritedFromParent.toArray(combined); | ||
System.arraycopy(items, 0, combined, inheritedFromParent.size(), items.length); | ||
return new UnmodifiableArrayList<>(combined, combined.length); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you don't specify a style class for the newly added properties, they will all be left justified. The existing
null
value for-fx-image
specifiesclass="default"
which centers it. I recommend either adding theclass="default"
to all of the newly added properties, or removing it from the default value of the existingfx-image
property.I'll reapprove if you want to make the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you! I am going to add class="default" as it allows for styling of the default column.
Two notes:
class="default"
is omitted (HBox for instance). We may want to fix it in a separate PR..default
class as part of the enhancement.