@Override public void start(Stage stage) { stage.setTitle("HTMLEditor Sample"); stage.setWidth(650); stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); root.setPadding(new Insets(8, 8, 8, 8)); root.setSpacing(5); root.setAlignment(Pos.BOTTOM_LEFT); final HTMLEditor htmlEditor = new HTMLEditor(); htmlEditor.setPrefHeight(245); htmlEditor.setHtmlText(INITIAL_TEXT); final WebView browser = new WebView(); final WebEngine webEngine = browser.getEngine(); ScrollPane scrollPane = new ScrollPane(); scrollPane.getStyleClass().add("noborder-scroll-pane"); scrollPane.setStyle("-fx-background-color: white"); scrollPane.setContent(browser); scrollPane.setFitToWidth(true); scrollPane.setPrefHeight(180); Button showHTMLButton = new Button("Load Content in Browser"); root.setAlignment(Pos.CENTER); showHTMLButton.setOnAction((ActionEvent arg0) -> { webEngine.loadContent(htmlEditor.getHtmlText()); }); root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane); scene.setRoot(root); stage.setScene(scene); stage.show(); }
@Test public void select() { HTMLEditor htmlEditorNode = (HTMLEditor) getPrimaryStage().getScene().getRoot().lookup(".html-editor"); Platform.runLater(() -> { htmlEditor.marathon_select("This html editor test"); }); try { new Wait("Waiting for html text to be set.") { @Override public boolean until() { String htmlText = htmlEditorNode.getHtmlText(); return htmlText.equals( "<html dir=\"ltr\"><head></head><body contenteditable=\"true\">This html editor test</body></html>"); } }; } catch (Throwable t) { } AssertJUnit.assertEquals( "<html dir=\"ltr\"><head></head><body contenteditable=\"true\">This html editor test</body></html>", htmlEditor.getText()); AssertJUnit.assertEquals( "<html dir=\"ltr\"><head></head><body contenteditable=\"true\">This html editor test</body></html>", htmlEditorNode.getHtmlText()); }
@Test public void getText() { HTMLEditor editor = (HTMLEditor) getPrimaryStage().getScene().getRoot().lookup(".html-editor"); LoggingRecorder lr = new LoggingRecorder(); String text = "This is a test text"; final String htmlText = "<html><font color=\"RED\"><h1><This is also content>" + text + "</h1></html>"; List<String> attributeText = new ArrayList<>(); Platform.runLater(() -> { RFXHTMLEditor rfxhtmlEditor = new RFXHTMLEditor(editor, null, null, lr); editor.setHtmlText(htmlText); rfxhtmlEditor.focusLost(null); attributeText.add(rfxhtmlEditor.getAttribute("text")); }); new Wait("Waiting for html editor text.") { @Override public boolean until() { return attributeText.size() > 0; } }; AssertJUnit.assertEquals(htmlText, attributeText.get(0)); }
private WysiwygDlg(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); setDefaultCloseOperation(HIDE_ON_CLOSE); try { setIconImage(ImageIO .read(FAdmin.class .getResource("/ru/apertum/qsystem/client/forms/resources/admin.png"))); } catch (IOException ex) { System.err.println(ex); } panel.removeAll(); javafxPanel = new JFXPanel(); Platform.runLater(() -> { htmlEditor = new HTMLEditor(); Scene scene = new Scene(htmlEditor, 750, 500, Color.web("#666970")); javafxPanel.setScene(scene); }); final GridLayout gl = new GridLayout(1, 1); panel.setLayout(gl); panel.add(javafxPanel); }
private Scene createScene(String url) { view = new WebView(); htmlEditor = new HTMLEditor(); view.getEngine().load(url); final VBox box = new VBox(); view.setMaxHeight(300); view.setMinHeight(300); htmlEditor.setMaxHeight(300); htmlEditor.setMinHeight(300); box.getChildren().addAll(view, htmlEditor); final Scene scene = new Scene(box); scene.setFill(Color.GRAY); return scene; }
@Override public Node createVisualisation(SimpleObjectProperty<String> attributeValue, boolean readonly) { HTMLEditor htmlEditor = new HTMLEditor(); changeListener = (observable, oldValue, newValue) -> htmlEditor.setHtmlText(newValue); attributeValue.addListener(new WeakChangeListener<>(changeListener)); htmlEditor.setDisable(readonly); BorderPane borderPane = new BorderPane(); borderPane.setCenter(htmlEditor); Button save = new Button("save");//strangely workaround HTMLEditor have no bind or change events save.setOnAction(event -> attributeValue.set(htmlEditor.getHtmlText())); htmlEditor.setHtmlText(attributeValue.get()); BorderPane.setMargin(save,new Insets(3,0,3,0)); borderPane.setTop(save); return borderPane; }
public OwnNoteHTMLEditor(final HTMLEditor htmlEditor, final OwnNoteEditor editor) { super(); myHTMLEditor = htmlEditor; myEditor = editor; mWebView = (WebView) myHTMLEditor.lookup(WEB_VIEW); mWebEngine = mWebView.getEngine(); mWebPage = Accessor.getPageFor(mWebEngine); rawViewer = new RawViewer(); // delay setup of editor - things are not available at startup... Platform.runLater(() -> { initHTMLEditor(); }); }
public static void showArticle(String content) { AlertDialog alertDialog = new AlertDialog.Builder() .view("dialog_article_detail") .title("��������") .build(); HTMLEditor htmlEditor = alertDialog.findView("#et_html", HTMLEditor.class); htmlEditor.setDisable(true); htmlEditor.setHtmlText(content); alertDialog.show(); }
private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setScene(new Scene(root)); VBox vRoot = new VBox(); vRoot.setPadding(new Insets(8, 8, 8, 8)); vRoot.setSpacing(5); htmlEditor = new HTMLEditor(); htmlEditor.setPrefSize(500, 245); htmlEditor.setHtmlText(INITIAL_TEXT); vRoot.getChildren().add(htmlEditor); final Label htmlLabel = new Label(); htmlLabel.setMaxWidth(500); htmlLabel.setWrapText(true); ScrollPane scrollPane = new ScrollPane(); scrollPane.getStyleClass().add("noborder-scroll-pane"); scrollPane.setContent(htmlLabel); scrollPane.setFitToWidth(true); scrollPane.setPrefHeight(180); Button showHTMLButton = new Button("Show the HTML below"); vRoot.setAlignment(Pos.CENTER); showHTMLButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { htmlLabel.setText(htmlEditor.getHtmlText()); } }); vRoot.getChildren().addAll(showHTMLButton, scrollPane); root.getChildren().addAll(vRoot); }
public static void reset() { add(Node.class, JavaFXElement.class); add(TextInputControl.class, JavaFXTextInputControlElement.class); add(HTMLEditor.class, JavaFXHTMLEditor.class); add(CheckBox.class, JavaFXCheckBoxElement.class); add(ToggleButton.class, JavaFXToggleButtonElement.class); add(Slider.class, JavaFXSliderElement.class); add(Spinner.class, JavaFXSpinnerElement.class); add(SplitPane.class, JavaFXSplitPaneElement.class); add(ProgressBar.class, JavaFXProgressBarElement.class); add(ChoiceBox.class, JavaFXChoiceBoxElement.class); add(ColorPicker.class, JavaFXColorPickerElement.class); add(ComboBox.class, JavaFXComboBoxElement.class); add(DatePicker.class, JavaFXDatePickerElement.class); add(TabPane.class, JavaFXTabPaneElement.class); add(ListView.class, JavaFXListViewElement.class); add(TreeView.class, JavaFXTreeViewElement.class); add(TableView.class, JavaFXTableViewElement.class); add(TreeTableView.class, JavaFXTreeTableViewElement.class); add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class); add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class); add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class); add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class); add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class); add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class); add(TableCell.class, JavaFXTableViewCellElement.class); add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class); add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class); add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class); add(TreeTableCell.class, JavaFXTreeTableCellElement.class); add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class); add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class); add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class); }
@Test public void select() { HTMLEditor editor = (HTMLEditor) getPrimaryStage().getScene().getRoot().lookup(".html-editor"); LoggingRecorder lr = new LoggingRecorder(); String text = "This is a test text"; final String htmlText = "<html><font color=\"RED\"><h1><This is also content>" + text + "</h1></html>"; Platform.runLater(() -> { RFXHTMLEditor rfxhtmlEditor = new RFXHTMLEditor(editor, null, null, lr); editor.setHtmlText(htmlText); rfxhtmlEditor.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals(htmlText, recording.getParameters()[0]); }
private void createScene(final String toDisplay) { Platform.runLater(new Runnable() { @Override public void run() { htmlEditor = new HTMLEditor(); htmlEditor.setPrefHeight(245 * ProjectGoldStarsX.multiplier); htmlEditor.setHtmlText(toDisplay); jfxPanel.setScene(new Scene(htmlEditor)); } }); }
private void createScene() { Platform.runLater(new Runnable() { @Override public void run() { htmlEditor = new HTMLEditor(); htmlEditor.setPrefHeight(245 * ProjectGoldStarsX.multiplier); jfxPanel.setScene(new Scene(htmlEditor)); } }); }
Node getTestNod() { /* [시작] 분석하고자하는 UI구조 */ BorderPane borderPane = new BorderPane(); ScrollPane scrollPane2 = new ScrollPane(); scrollPane2.setContent(new TextArea()); borderPane.setTop(new HBox(new Button(), new Button(), new HTMLEditor())); borderPane.setCenter(new BorderPane(scrollPane2)); /* [끝] 분석하고자하는 UI구조 */ return borderPane; }
void reset() { resetBtn.mouse().click(); webView = parent.lookup(WebView.class).wrap(); webView.mouse().click(); htmlEditor = parent.lookup(HTMLEditor.class).wrap(); htmlEditorAsParent = htmlEditor.as(Parent.class, Node.class); cut = parent.lookup(Button.class).wrap(0); copy = parent.lookup(Button.class).wrap(1); paste = parent.lookup(Button.class).wrap(2); // undo = parent.lookup(Button.class).wrap(3); // redo = parent.lookup(Button.class).wrap(4); left = parent.lookup(ToggleButton.class).wrap(0); center = parent.lookup(ToggleButton.class).wrap(1); right = parent.lookup(ToggleButton.class).wrap(2); adjust = parent.lookup(ToggleButton.class).wrap(3); bullets = parent.lookup(ToggleButton.class).wrap(4); numbers = parent.lookup(ToggleButton.class).wrap(5); indent = parent.lookup(Button.class).wrap(3); removeIndent = parent.lookup(Button.class).wrap(4); separator = parent.lookup(Button.class).wrap(5); paragraph = parent.lookup(ComboBox.class).wrap(0); fontStyle = parent.lookup(ComboBox.class).wrap(1); fontSize = parent.lookup(ComboBox.class).wrap(2); bold = parent.lookup(ToggleButton.class).wrap(6); italic = parent.lookup(ToggleButton.class).wrap(7); underline = parent.lookup(ToggleButton.class).wrap(8); crossed = parent.lookup(ToggleButton.class).wrap(9); foreground = parent.lookup(ColorPicker.class).wrap(0); background = parent.lookup(ColorPicker.class).wrap(1); setDefaultFont(); }
@Override public void start(Stage primaryStage) { DockStation station = AnchorageSystem.createStation(); Scene scene = new Scene(station, 1024, 768); DockNode node1 = AnchorageSystem.createDock("Not floatable", new HTMLEditor()); node1.dock(station, DockNode.DockPosition.LEFT); node1.floatableProperty().set(false); DockNode node2 = AnchorageSystem.createDock("Not resizable", new HTMLEditor()); node2.dock(station, DockNode.DockPosition.RIGHT); node2.resizableProperty().set(false); // DockNode node1 = AnchorageSystem.createDock("Tree", generateRandomTree()); // node1.dock(station, DockNode.DockPosition.CENTER); // // DockNode node2 = AnchorageSystem.createDock("Editor", new HTMLEditor()); // node2.dock(station, DockNode.DockPosition.RIGHT); // // DockNode node3 = AnchorageSystem.createDock("Below the editor", generateRandomTree()); // node3.dock(node2, DockNode.DockPosition.BOTTOM,0.8); AnchorageSystem.installDefaultStyle(); primaryStage.setTitle("AnchorFX"); primaryStage.setScene(scene); primaryStage.show(); // DockNode node4 = AnchorageSystem.createDock("Floating", new TableView()); // node4.dockAsFloating(primaryStage, station, 0, 0, 400, 200); AnchorageSystem.installDefaultStyle(); }
@Test public void testGetHTMLEditorAdjuster() { Adjuster adjuster = Adjuster.getAdjuster(HTMLEditor.class); assertThat(adjuster, is(instanceOf(ControlAdjuster.class))); assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class))); }
@Before @SuppressWarnings("unchecked") public void getNodes() { //System.out.println("running getNodes()"); ownCloudPath = (Label) find(".ownCloudPath"); notesTableFXML = (TableView<Map<String, String>>) find(".notesTable"); groupsPaneFXML = (TabPane) find(".groupsPane"); noteEditorFXML = (HTMLEditor) find(".noteEditor"); // tabs are not nodes!!! So we have to find them the hard way final ObservableList<Tab> tabsList = groupsPaneFXML.getTabs(); allTab = (OwnNoteTab) tabsList.stream().filter(x -> { return ((Label) x.getGraphic()).getText().startsWith(GroupData.ALL_GROUPS); }).findFirst().orElse(null); test1Tab = (OwnNoteTab) tabsList.stream().filter(x -> { return ((Label) x.getGraphic()).getText().startsWith("Test1"); }).findFirst().orElse(null); test2Tab = (OwnNoteTab) tabsList.stream().filter(x -> { return ((Label) x.getGraphic()).getText().startsWith("Test2"); }).findFirst().orElse(null); test3Tab = (OwnNoteTab) tabsList.stream().filter(x -> { return ((Label) x.getGraphic()).getText().startsWith("Test3"); }).findFirst().orElse(null); testPLUSTab = (OwnNoteTab) tabsList.stream().filter(x -> { return "+".equals(((Label) x.getGraphic()).getText()); }).findFirst().orElse(null); }
private DescriptionController() { super(); this.editor = new HTMLEditor(); AnchorPane.setBottomAnchor(editor, 0.0); AnchorPane.setLeftAnchor(editor, 0.0); AnchorPane.setTopAnchor(editor, 0.0); AnchorPane.setRightAnchor(editor, 0.0); setPrefSize(520, 430); getChildren().add(editor); }
public EventHandler<ActionEvent> setOnAction(final HTMLEditor editor, final double width){ return new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent paramT) { editor.setPrefWidth(width); } }; }
public HTMLEditorSample() { VBox vRoot = new VBox(); vRoot.setPadding(new Insets(8, 8, 8, 8)); vRoot.setSpacing(5); htmlEditor = new HTMLEditor(); htmlEditor.setPrefSize(500, 245); htmlEditor.setHtmlText(INITIAL_TEXT); vRoot.getChildren().add(htmlEditor); final Label htmlLabel = new Label(); htmlLabel.setMaxWidth(500); htmlLabel.setWrapText(true); ScrollPane scrollPane = new ScrollPane(); scrollPane.getStyleClass().add("noborder-scroll-pane"); scrollPane.setContent(htmlLabel); scrollPane.setFitToWidth(true); scrollPane.setPrefHeight(180); Button showHTMLButton = new Button("Show the HTML below"); vRoot.setAlignment(Pos.CENTER); showHTMLButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { htmlLabel.setText(htmlEditor.getHtmlText()); } }); vRoot.getChildren().addAll(showHTMLButton, scrollPane); getChildren().addAll(vRoot); // REMOVE ME // Workaround for RT-16781 - HTML editor in full screen has wrong border javafx.scene.layout.GridPane grid = (javafx.scene.layout.GridPane)htmlEditor.lookup(".html-editor"); for(javafx.scene.Node child: grid.getChildren()) { javafx.scene.layout.GridPane.setHgrow(child, javafx.scene.layout.Priority.ALWAYS); } // END REMOVE ME }
protected String getHTMLEditorText(HTMLEditor htmlEditor) { return htmlEditor.getHtmlText(); }
@Override public boolean marathon_select(String value) { HTMLEditor htmlEditor = (HTMLEditor) getComponent(); htmlEditor.setHtmlText(value); return true; }
@Override public String _getText() { return getHTMLEditorText((HTMLEditor) getComponent()); }
public HTMLEditorSample() { final VBox root = new VBox(); root.setPadding(new Insets(8, 8, 8, 8)); root.setSpacing(5); root.setAlignment(Pos.BOTTOM_LEFT); final GridPane grid = new GridPane(); grid.setVgap(5); grid.setHgap(10); final ChoiceBox sendTo = new ChoiceBox(FXCollections.observableArrayList("To:", "Cc:", "Bcc:")); sendTo.setPrefWidth(100); GridPane.setConstraints(sendTo, 0, 0); grid.getChildren().add(sendTo); final TextField tbTo = new TextField(); tbTo.setPrefWidth(400); GridPane.setConstraints(tbTo, 1, 0); grid.getChildren().add(tbTo); final Label subjectLabel = new Label("Subject:"); GridPane.setConstraints(subjectLabel, 0, 1); grid.getChildren().add(subjectLabel); final TextField tbSubject = new TextField(); tbTo.setPrefWidth(400); GridPane.setConstraints(tbSubject, 1, 1); grid.getChildren().add(tbSubject); root.getChildren().add(grid); Platform.runLater(() -> { final HTMLEditor htmlEditor = new HTMLEditor(); htmlEditor.setPrefHeight(370); root.getChildren().addAll(htmlEditor, new Button("Send")); }); final Label htmlLabel = new Label(); htmlLabel.setWrapText(true); getChildren().add(root); }
@Override public void focusGained(RFXComponent prev) { prevText = getHTMLEditorText((HTMLEditor) node); }
@Override public void focusLost(RFXComponent next) { String currentText = getHTMLEditorText((HTMLEditor) node); if (currentText != null && !currentText.equals(prevText)) { recorder.recordSelect(this, currentText); } }
@Override public String _getText() { return getHTMLEditorText((HTMLEditor) node); }
@Override public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(); loader.setLocation(SystemLayoutViewController.class.getResource("VoEditorView.fxml")); try { Node node = loader.load(); // { // // ObservableList<Node> recursive = recursive(node); // print(recursive); // // } // { // Group group = new Group(); // // // Text는 Shape클래스의 하위클래스 // group.getChildren().add(new Text()); // group.getChildren().add(new Button()); // group.getChildren().add(new Button()); // group.getChildren().add(new Label()); // ObservableList<Node> recursive = recursive(group); // print(recursive); // // } // { // ScrollPane scrollPane = new ScrollPane(); // ScrollPane scrollPane2 = new ScrollPane(); // scrollPane2.setContent(new TextArea()); // scrollPane.setContent(new BorderPane(scrollPane2)); // ObservableList<Node> recursive = recursive(scrollPane); // print(recursive); // } { BorderPane borderPane = new BorderPane(); ScrollPane scrollPane2 = new ScrollPane(); scrollPane2.setContent(new TextArea()); borderPane.setTop(new HBox(new Button(), new Button(), new HTMLEditor())); borderPane.setCenter(new BorderPane(scrollPane2)); FxControlTreeView tv = new FxControlTreeView(borderPane); tv.setOnMouseClicked(event -> { System.out.println(tv.getSelectionModel().getSelectedItem()); }); Scene scene = new Scene(tv); primaryStage.setScene(scene); primaryStage.show(); // List<Node> recursive = recursive(borderPane); // print(recursive); } // // Scene scene = new Scene((Parent) node); // primaryStage.setScene(scene); // primaryStage.show(); } catch (IOException e) { e.printStackTrace(); } }
@Override public void start(Stage stage) { stage.setTitle("HTMLEditor Sample"); stage.setWidth(500); stage.setHeight(500); Scene scene = new Scene(new Group()); VBox root = new VBox(); root.setPadding(new Insets(8, 8, 8, 8)); root.setSpacing(5); root.setAlignment(Pos.BOTTOM_LEFT); final HTMLEditor htmlEditor = new HTMLEditor(); htmlEditor.setPrefHeight(245); htmlEditor.setHtmlText(INITIAL_TEXT); final WebView browser = new WebView(); final WebEngine webEngine = browser.getEngine(); ScrollPane scrollPane = new ScrollPane(); scrollPane.getStyleClass().add("noborder-scroll-pane"); scrollPane.setStyle("-fx-background-color: white"); scrollPane.setContent(browser); scrollPane.setFitToWidth(true); scrollPane.setPrefHeight(180); Button showHTMLButton = new Button("Load Content in Browser"); root.setAlignment(Pos.CENTER); showHTMLButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { webEngine.loadContent(htmlEditor.getHtmlText()); } }); root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane); scene.setRoot(root); stage.setScene(scene); stage.show(); }
private void reset() { content.getChildren().clear(); editor = new HTMLEditor(); content.getChildren().add(editor); }
@Override public void start(Stage primaryStage) { final BooleanProperty flag = new SimpleBooleanProperty(true); primaryStage.setTitle("Hello World"); BorderPane root = new BorderPane(); Scene scene = new Scene(root, 800, 600); final HTMLEditor editor = new HTMLEditor(); editor.setPrefHeight(300); root.setCenter(editor); final Text tf = new Text(); tf.setText(editor.getHtmlText()); root.setBottom(tf); primaryStage.setScene(scene); primaryStage.show(); }