Java 类javafx.scene.AccessibleRole 实例源码

项目:Gargoyle    文件:CPagenationSkin.java   
public IndicatorButton(int pageNumber) {
    this.pageNumber = pageNumber;
    setFocusTraversable(false);
    setIndicatorType();
    setTooltipVisible(isTooltipVisible());

    getSkinnable().getStyleClass().addListener(updateSkinIndicatorType);

    setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent arg0) {
            int selected = getCurrentPageIndex();
            // We do not need to update the selection if it has not changed.
            if (selected != IndicatorButton.this.pageNumber) {
                pagination.setCurrentPageIndex(IndicatorButton.this.pageNumber);
                requestLayout();
            }
        }
    });

    tooltipVisibleProperty().addListener(updateTooltipVisibility);

    prefHeightProperty().bind(minHeightProperty());
    setAccessibleRole(AccessibleRole.PAGE_ITEM);
}
项目:WebPLP    文件:CodeEditor.java   
public CodeEditor()
{
    webView = new WebView();
    aceEditor = new AceEditor();

    codeBodyProperty = aceEditor.getBodyProperty();
    acePageContentsProperty = aceEditor.getPage();

    initializeEngineEvents();

    webView.getEngine().loadContent(aceEditor.getPage().get());

    // Add interface to access Java model from Javascript
    JSObject jsObject = (JSObject) webView.getEngine().executeScript("window");
    jsObject.setMember("javaContentModel", this);

    acePageContentsProperty.addListener((observable, old, newValue) -> 
    {
        System.out.println("Loaded:\n" + newValue);
        webView.getEngine().loadContent(newValue);
    });

    codeBodyProperty.addListener(
            (observable, old, newValue) -> System.out.println("CodeProperty changed"));

    webView.setContextMenuEnabled(false);
    //TODO create custom context menu (right click menu)

    // TODO: move this to a js file
    aceEditor.addCustomJavascriptRoutine(() -> "editor.on(\"change\", function() {"
            + "javaContentModel.updateTextFromJavascript(editor.getValue());"
            + "});");

    setOnKeyReleased(event -> {
        System.out.println("key released");
        getBreakPoints();
    });

    setCenter(webView);
    this.accessibleRoleProperty().set(AccessibleRole.TEXT_AREA);
}
项目:myWMS    文件:BasicEntityEditor.java   
public BasicEntityEditorSkin(BasicEntityEditor<T> control) {
    super(control);
    this.control = control;
    this.control.showPopupProperty().addListener((v, o, n) -> {
        if (n) showPopup(); else hidePopup();
    });

    this.control.valueProperty().addListener(this::updateTextField);
    this.control.converterProperty().addListener(this::updateTextField);

    if (control.showPopupProperty().get()) showPopup(); else hidePopup();

    textField.textProperty().addListener(textInput);
    //textField.setManaged(false);
    textField.setEditable(true);

    valueField.setMouseTransparent(true);
    // As long as the screen-reader is concerned this node is not a list item.
    // This matters because the screen-reader counts the number of list item
    // within combo and speaks it to the user.
    valueField.setAccessibleRole(AccessibleRole.NODE);
    valueField.setAlignment(Pos.BASELINE_LEFT);
    valueField.setMaxWidth(Integer.MAX_VALUE);
    HBox.setHgrow(valueField, Priority.ALWAYS);
    valueField.textProperty().bind(Bindings.createObjectBinding(()-> {
        StringConverter<T> conv = control.converter.get();
        return conv.toString(control.getValue());
    }, control.converter, control.value));

    control.setOnKeyReleased(e -> {
        if (e.getCode() == KeyCode.DOWN) {
            showPopup();
        }
        else if (e.getCode() == KeyCode.F7) {
            if (e.isControlDown()) {
                hidePopup();
                control.editValue();
            }
            else {
                hidePopup();
                control.viewValue();
            }
        }
    });

    arrowButton.getStyleClass().addAll("arrow-button");

    valueField.visibleProperty().bind(control.showPopupProperty().not());
    textField.visibleProperty().bind(control.showPopupProperty());

    HBox hbox = new HBox();
    hbox.getStyleClass().remove("hbox");
    hbox.setOnMouseClicked(e -> onArrowClicked());
    hbox.setAlignment(Pos.BASELINE_LEFT);
    valueField.setStyle("-fx-padding: 0.5em 0.8ex");            
    StackPane sp = new StackPane(valueField, textField);

    //HBox.setHgrow(valueField, Priority.ALWAYS);
    //HBox.setHgrow(textField, Priority.ALWAYS);
    HBox.setHgrow(sp, Priority.ALWAYS);
    HBox.setHgrow(arrowButton, Priority.NEVER);
    HBox.setMargin(arrowButton, new Insets(5));
    hbox.getChildren().addAll(sp, arrowButton);
    getChildren().add(hbox);

}
项目:JFoenix    文件:JFXTimePicker.java   
private void initialize() {
    getStyleClass().add(DEFAULT_STYLE_CLASS);
    setAccessibleRole(AccessibleRole.DATE_PICKER);
    setEditable(true);
}