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
23 * questions.
24 */
25
26 package com.sun.javafx.webkit.theme;
27
28 import javafx.beans.InvalidationListener;
29 import javafx.beans.Observable;
30 import javafx.collections.FXCollections;
31 import javafx.geometry.Orientation;
32 import javafx.scene.control.Button;
33 import javafx.scene.control.CheckBox;
34 import javafx.scene.control.ChoiceBox;
35 import javafx.scene.control.Control;
36 import javafx.scene.control.ProgressBar;
37 import javafx.scene.control.RadioButton;
38 import javafx.scene.control.Slider;
39 import javafx.scene.control.TextField;
40 import javafx.scene.layout.BorderPane;
41 import javafx.scene.layout.Region;
42 import java.lang.ref.WeakReference;
43 import java.nio.ByteBuffer;
44 import java.nio.ByteOrder;
45 import java.util.ArrayList;
46 import java.util.Collections;
47 import java.util.HashMap;
48 import java.util.List;
49 import java.util.Map;
50 import java.util.logging.Level;
51 import java.util.logging.Logger;
52 import java.util.LinkedHashMap;
53 import com.sun.javafx.scene.control.behavior.BehaviorBase;
54 import com.sun.javafx.scene.control.skin.BehaviorSkinBase;
55 import com.sun.javafx.webkit.Accessor;
56 import com.sun.webkit.LoadListenerClient;
57 import com.sun.webkit.graphics.Ref;
58 import com.sun.webkit.graphics.RenderTheme;
59 import com.sun.webkit.graphics.WCGraphicsContext;
60 import com.sun.webkit.graphics.WCSize;
61 import javafx.application.Application;
62
63 public final class RenderThemeImpl extends RenderTheme {
64 private final static Logger log = Logger.getLogger(RenderThemeImpl.class.getName());
65
66 enum WidgetType {
67 TEXTFIELD (0),
68 BUTTON (1),
69 CHECKBOX (2),
70 RADIOBUTTON (3),
71 MENULIST (4),
72 MENULISTBUTTON (5),
73 SLIDER (6),
74 PROGRESSBAR (7),
558 private FormMenuListButton() {
559 setSkin(new Skin());
560 setFocusTraversable(false);
561 getStyleClass().add("form-select-button");
562 }
563
564 /**
565 * @param height is the height of the FormMenuList widget
566 * @param width is passed equal to height
567 */
568 @Override public void resize(double width, double height) {
569 width = height > MAX_WIDTH ? MAX_WIDTH : height < MIN_WIDTH ? MIN_WIDTH : height;
570
571 super.resize(width, height);
572
573 // [x] is originally aligned with the right edge of
574 // the menulist control, and here we adjust it
575 setTranslateX(-width);
576 }
577
578 private final class Skin extends BehaviorSkinBase {
579 Skin() {
580 super(FormMenuListButton.this,
581 new BehaviorBase<>(FormMenuListButton.this, Collections.EMPTY_LIST));
582
583 Region arrow = new Region();
584 arrow.getStyleClass().add("arrow");
585 arrow.setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE);
586 BorderPane pane = new BorderPane();
587 pane.setCenter(arrow);
588 getChildren().add(pane);
589 }
590 }
591
592 @Override public WidgetType getType() { return WidgetType.MENULISTBUTTON; };
593 }
594 }
|
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
23 * questions.
24 */
25
26 package com.sun.javafx.webkit.theme;
27
28 import javafx.beans.InvalidationListener;
29 import javafx.beans.Observable;
30 import javafx.collections.FXCollections;
31 import javafx.geometry.Orientation;
32 import javafx.scene.control.Button;
33 import javafx.scene.control.CheckBox;
34 import javafx.scene.control.ChoiceBox;
35 import javafx.scene.control.Control;
36 import javafx.scene.control.ProgressBar;
37 import javafx.scene.control.RadioButton;
38 import javafx.scene.control.SkinBase;
39 import javafx.scene.control.Slider;
40 import javafx.scene.control.TextField;
41 import javafx.scene.layout.BorderPane;
42 import javafx.scene.layout.Region;
43 import java.lang.ref.WeakReference;
44 import java.nio.ByteBuffer;
45 import java.nio.ByteOrder;
46 import java.util.ArrayList;
47 import java.util.Collections;
48 import java.util.HashMap;
49 import java.util.List;
50 import java.util.Map;
51 import java.util.logging.Level;
52 import java.util.logging.Logger;
53 import java.util.LinkedHashMap;
54 import com.sun.javafx.webkit.Accessor;
55 import com.sun.webkit.LoadListenerClient;
56 import com.sun.webkit.graphics.Ref;
57 import com.sun.webkit.graphics.RenderTheme;
58 import com.sun.webkit.graphics.WCGraphicsContext;
59 import com.sun.webkit.graphics.WCSize;
60 import javafx.application.Application;
61
62 public final class RenderThemeImpl extends RenderTheme {
63 private final static Logger log = Logger.getLogger(RenderThemeImpl.class.getName());
64
65 enum WidgetType {
66 TEXTFIELD (0),
67 BUTTON (1),
68 CHECKBOX (2),
69 RADIOBUTTON (3),
70 MENULIST (4),
71 MENULISTBUTTON (5),
72 SLIDER (6),
73 PROGRESSBAR (7),
557 private FormMenuListButton() {
558 setSkin(new Skin());
559 setFocusTraversable(false);
560 getStyleClass().add("form-select-button");
561 }
562
563 /**
564 * @param height is the height of the FormMenuList widget
565 * @param width is passed equal to height
566 */
567 @Override public void resize(double width, double height) {
568 width = height > MAX_WIDTH ? MAX_WIDTH : height < MIN_WIDTH ? MIN_WIDTH : height;
569
570 super.resize(width, height);
571
572 // [x] is originally aligned with the right edge of
573 // the menulist control, and here we adjust it
574 setTranslateX(-width);
575 }
576
577 private final class Skin extends SkinBase {
578 Skin() {
579 super(FormMenuListButton.this);
580
581 Region arrow = new Region();
582 arrow.getStyleClass().add("arrow");
583 arrow.setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE);
584 BorderPane pane = new BorderPane();
585 pane.setCenter(arrow);
586 getChildren().add(pane);
587 }
588 }
589
590 @Override public WidgetType getType() { return WidgetType.MENULISTBUTTON; };
591 }
592 }
|