38 import com.oracle.javafx.scenebuilder.kit.editor.i18n.I18N;
39 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssContentMaker.BeanPropertyState;
40 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssContentMaker.CssPropertyState;
41 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssContentMaker.CssPropertyState.CssStyle;
42 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssContentMaker.PropertyState;
43 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssValuePresenterFactory.CssValuePresenter;
44 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.NodeCssState.CssProperty;
45 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.SelectionPath.Item;
46 import com.oracle.javafx.scenebuilder.kit.editor.panel.util.AbstractFxmlPanelController;
47 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument;
48 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject;
49 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.SelectionPath.Path;
50 import com.oracle.javafx.scenebuilder.kit.editor.selection.ObjectSelectionGroup;
51 import com.oracle.javafx.scenebuilder.kit.editor.selection.Selection;
52 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMInstance;
53 import com.oracle.javafx.scenebuilder.kit.metadata.Metadata;
54 import com.oracle.javafx.scenebuilder.kit.metadata.property.ValuePropertyMetadata;
55 import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName;
56 import com.oracle.javafx.scenebuilder.kit.util.CssInternal;
57 import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
58 import com.sun.javafx.css.ParsedValueImpl;
59 import com.sun.javafx.css.Rule;
60
61 import java.io.File;
62 import java.io.IOException;
63 import java.lang.reflect.Array;
64 import java.net.MalformedURLException;
65 import java.net.URISyntaxException;
66 import java.net.URL;
67 import java.text.MessageFormat;
68 import java.util.*;
69
70 import javafx.animation.FadeTransition;
71 import javafx.beans.property.ObjectProperty;
72 import javafx.beans.property.SimpleObjectProperty;
73 import javafx.beans.value.ChangeListener;
74 import javafx.beans.value.ObservableValue;
75 import javafx.collections.FXCollections;
76 import javafx.collections.ObservableList;
77 import javafx.css.ParsedValue;
78 import javafx.css.PseudoClass;
79 import javafx.css.StyleOrigin;
1964 private static Node createValueUI(CssProperty item, PropertyState ps, Object value, CssStyle style, ParsedValue<?, ?>[] parsedValues) {
1965 Node ret = null;
1966 if (value instanceof ParsedValue) {
1967 ParsedValue<?, ?> pv = (ParsedValue<?, ?>) value;
1968 value = CssValueConverter.convert(pv);
1969 }
1970 if (value != null) {
1971 if (value.getClass().isArray()) {
1972 HBox hbox = new HBox(5);
1973 int size = Array.getLength(value);
1974 int lookupIndex = 0;
1975 for (int i = 0; i < size; i++) {
1976 Object v = Array.get(value, i);
1977 Node n = getLeaf(v);
1978 if (n == null) {
1979 break;
1980 }
1981 boolean lookup = false;
1982 if (parsedValues != null) {
1983 ParsedValue<?, ?> pv = parsedValues[i];
1984 lookup = ((ParsedValueImpl<?, ?>) pv).isContainsLookups();
1985 }
1986 if (lookup) {
1987 assert style != null;
1988 CssStyle lookupRoot = null;
1989 if (style.getLookupChain().size() - 1 < lookupIndex) {
1990 // We are in NOT APPLIED case, no lookup in matching Styles.
1991 // This is an RT bug logged.
1992 // XXX jfdenise, we can reconstruct the lookup chain based on the ParsedValue
1993 // We need to access private field ParsedValue.resolved
1994 // That is a null if this is the leaf of the Lookup
1995 // That is a ParsedValue with a getvalue that is a ParsedValue
1996 // to introspect.
1997 // ParsedValue<?, ?> pv = parsedValues[i];
1998 // if(pv.getValue() instanceof String){
1999 // // OK, this is a lookup name.
2000 // Object obj = pv.convert(null);
2001 // } else {
2002 //
2003 // }
2004 } else {
2017 }
2018 if (!hbox.getChildren().isEmpty()) {
2019 ret = hbox;
2020 }
2021 } else {
2022 if (value instanceof Collection) {
2023 HBox hbox = new HBox(5);
2024 int lookupIndex = 0;
2025 Collection<?> collection = (Collection<?>) value;
2026 Iterator<?> it = collection.iterator();
2027 int index = 0;
2028 while (it.hasNext()) {
2029 Object v = it.next();
2030 Node n = getLeaf(v);
2031 if (n == null) {
2032 break;
2033 }
2034 boolean lookup = false;
2035 if (parsedValues != null) {
2036 ParsedValue<?, ?> pv = parsedValues[index];
2037 lookup = ((ParsedValueImpl<?, ?>) pv).isContainsLookups();
2038 }
2039 if (lookup) {
2040 CssStyle lookupRoot = null;
2041 assert style != null;
2042 if (style.getLookupChain().size() - 1 < lookupIndex) {
2043 // We are in NOT APPLIED case, no lookup in matching Styles.
2044 // This is an RT bug logged.
2045 // XXX jfdenise, we can reconstruct the lookup chain based on the ParsedValue
2046 // We need to access private field ParsedValue.resolved
2047 // That is a null if this is the leaf of the Lookup
2048 // That is a ParsedValue with a getvalue that is a ParsedValue
2049 // to introspect.
2050 // ParsedValue<?, ?> pv = parsedValues[i];
2051 // if(pv.getValue() instanceof String){
2052 // // OK, this is a lookup name.
2053 // Object obj = pv.convert(null);
2054 // } else {
2055 //
2056 // }
2057 } else {
|
38 import com.oracle.javafx.scenebuilder.kit.editor.i18n.I18N;
39 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssContentMaker.BeanPropertyState;
40 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssContentMaker.CssPropertyState;
41 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssContentMaker.CssPropertyState.CssStyle;
42 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssContentMaker.PropertyState;
43 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.CssValuePresenterFactory.CssValuePresenter;
44 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.NodeCssState.CssProperty;
45 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.SelectionPath.Item;
46 import com.oracle.javafx.scenebuilder.kit.editor.panel.util.AbstractFxmlPanelController;
47 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument;
48 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject;
49 import com.oracle.javafx.scenebuilder.kit.editor.panel.css.SelectionPath.Path;
50 import com.oracle.javafx.scenebuilder.kit.editor.selection.ObjectSelectionGroup;
51 import com.oracle.javafx.scenebuilder.kit.editor.selection.Selection;
52 import com.oracle.javafx.scenebuilder.kit.fxom.FXOMInstance;
53 import com.oracle.javafx.scenebuilder.kit.metadata.Metadata;
54 import com.oracle.javafx.scenebuilder.kit.metadata.property.ValuePropertyMetadata;
55 import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName;
56 import com.oracle.javafx.scenebuilder.kit.util.CssInternal;
57 import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
58
59 import javafx.css.Rule;
60
61 import java.io.File;
62 import java.io.IOException;
63 import java.lang.reflect.Array;
64 import java.net.MalformedURLException;
65 import java.net.URISyntaxException;
66 import java.net.URL;
67 import java.text.MessageFormat;
68 import java.util.*;
69
70 import javafx.animation.FadeTransition;
71 import javafx.beans.property.ObjectProperty;
72 import javafx.beans.property.SimpleObjectProperty;
73 import javafx.beans.value.ChangeListener;
74 import javafx.beans.value.ObservableValue;
75 import javafx.collections.FXCollections;
76 import javafx.collections.ObservableList;
77 import javafx.css.ParsedValue;
78 import javafx.css.PseudoClass;
79 import javafx.css.StyleOrigin;
1964 private static Node createValueUI(CssProperty item, PropertyState ps, Object value, CssStyle style, ParsedValue<?, ?>[] parsedValues) {
1965 Node ret = null;
1966 if (value instanceof ParsedValue) {
1967 ParsedValue<?, ?> pv = (ParsedValue<?, ?>) value;
1968 value = CssValueConverter.convert(pv);
1969 }
1970 if (value != null) {
1971 if (value.getClass().isArray()) {
1972 HBox hbox = new HBox(5);
1973 int size = Array.getLength(value);
1974 int lookupIndex = 0;
1975 for (int i = 0; i < size; i++) {
1976 Object v = Array.get(value, i);
1977 Node n = getLeaf(v);
1978 if (n == null) {
1979 break;
1980 }
1981 boolean lookup = false;
1982 if (parsedValues != null) {
1983 ParsedValue<?, ?> pv = parsedValues[i];
1984 lookup = pv.isContainsLookups();
1985 }
1986 if (lookup) {
1987 assert style != null;
1988 CssStyle lookupRoot = null;
1989 if (style.getLookupChain().size() - 1 < lookupIndex) {
1990 // We are in NOT APPLIED case, no lookup in matching Styles.
1991 // This is an RT bug logged.
1992 // XXX jfdenise, we can reconstruct the lookup chain based on the ParsedValue
1993 // We need to access private field ParsedValue.resolved
1994 // That is a null if this is the leaf of the Lookup
1995 // That is a ParsedValue with a getvalue that is a ParsedValue
1996 // to introspect.
1997 // ParsedValue<?, ?> pv = parsedValues[i];
1998 // if(pv.getValue() instanceof String){
1999 // // OK, this is a lookup name.
2000 // Object obj = pv.convert(null);
2001 // } else {
2002 //
2003 // }
2004 } else {
2017 }
2018 if (!hbox.getChildren().isEmpty()) {
2019 ret = hbox;
2020 }
2021 } else {
2022 if (value instanceof Collection) {
2023 HBox hbox = new HBox(5);
2024 int lookupIndex = 0;
2025 Collection<?> collection = (Collection<?>) value;
2026 Iterator<?> it = collection.iterator();
2027 int index = 0;
2028 while (it.hasNext()) {
2029 Object v = it.next();
2030 Node n = getLeaf(v);
2031 if (n == null) {
2032 break;
2033 }
2034 boolean lookup = false;
2035 if (parsedValues != null) {
2036 ParsedValue<?, ?> pv = parsedValues[index];
2037 lookup = pv.isContainsLookups();
2038 }
2039 if (lookup) {
2040 CssStyle lookupRoot = null;
2041 assert style != null;
2042 if (style.getLookupChain().size() - 1 < lookupIndex) {
2043 // We are in NOT APPLIED case, no lookup in matching Styles.
2044 // This is an RT bug logged.
2045 // XXX jfdenise, we can reconstruct the lookup chain based on the ParsedValue
2046 // We need to access private field ParsedValue.resolved
2047 // That is a null if this is the leaf of the Lookup
2048 // That is a ParsedValue with a getvalue that is a ParsedValue
2049 // to introspect.
2050 // ParsedValue<?, ?> pv = parsedValues[i];
2051 // if(pv.getValue() instanceof String){
2052 // // OK, this is a lookup name.
2053 // Object obj = pv.convert(null);
2054 // } else {
2055 //
2056 // }
2057 } else {
|