1 /*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
772 public Object getUserData() {
773 return getProperties().get(USER_DATA_KEY);
774 }
775
776 /**
777 * A list of String identifiers which can be used to logically group
778 * Nodes, specifically for an external style engine. This variable is
779 * analogous to the "class" attribute on an HTML element and, as such,
780 * each element of the list is a style class to which this Node belongs.
781 *
782 * @see <a href="http://www.w3.org/TR/css3-selectors/#class-html">CSS3 class selectors</a>
783 */
784 @Override
785 public ObservableList<String> getStyleClass() {
786 return styleClass;
787 }
788
789 private final EventHandlerManager eventHandlerManager =
790 new EventHandlerManager(this);
791
792 /**
793 * @treatAsPrivate implementation detail
794 * @deprecated This is an internal API that is not intended for use and will be removed in the next version
795 */
796 @Override
797 public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail) {
798 return tail.prepend(eventHandlerManager);
799 }
800
801 /**
802 * @treatAsPrivate implementation detail
803 * @deprecated This is an internal API that is not intended for use and will be removed in the next version
804 */
805 protected <E extends Event> void setEventHandler(EventType<E> eventType, EventHandler<E> eventHandler) {
806 eventHandlerManager.setEventHandler(eventType, eventHandler);
807 }
808
809 /*
810 * See Node#lookup(String)
811 */
812 Node lookup(String selector) {
813 if (selector == null) return null;
814 Node n = null;
815 if (getContent() != null) {
816 n = getContent().lookup(selector);
817 }
818 if (n == null && getGraphic() != null) {
819 n = getGraphic().lookup(selector);
820 }
821 return n;
822 }
823
824 /*
825 * See Node#lookupAll(String)
|
1 /*
2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
772 public Object getUserData() {
773 return getProperties().get(USER_DATA_KEY);
774 }
775
776 /**
777 * A list of String identifiers which can be used to logically group
778 * Nodes, specifically for an external style engine. This variable is
779 * analogous to the "class" attribute on an HTML element and, as such,
780 * each element of the list is a style class to which this Node belongs.
781 *
782 * @see <a href="http://www.w3.org/TR/css3-selectors/#class-html">CSS3 class selectors</a>
783 */
784 @Override
785 public ObservableList<String> getStyleClass() {
786 return styleClass;
787 }
788
789 private final EventHandlerManager eventHandlerManager =
790 new EventHandlerManager(this);
791
792 /** {@inheritDoc} */
793 @Override
794 public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail) {
795 return tail.prepend(eventHandlerManager);
796 }
797
798 <E extends Event> void setEventHandler(EventType<E> eventType, EventHandler<E> eventHandler) {
799 eventHandlerManager.setEventHandler(eventType, eventHandler);
800 }
801
802 /*
803 * See Node#lookup(String)
804 */
805 Node lookup(String selector) {
806 if (selector == null) return null;
807 Node n = null;
808 if (getContent() != null) {
809 n = getContent().lookup(selector);
810 }
811 if (n == null && getGraphic() != null) {
812 n = getGraphic().lookup(selector);
813 }
814 return n;
815 }
816
817 /*
818 * See Node#lookupAll(String)
|