Skip to content

Commit f081484

Browse files
committed
Merge pull request #305 from JordanMartinez/removeAreaFactory
Removed AreaFactory.
2 parents ffd2a0d + ba08949 commit f081484

4 files changed

Lines changed: 18 additions & 217 deletions

File tree

richtextfx-demos/src/main/java/org/fxmisc/richtext/demo/CloneDemo.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import javafx.scene.layout.GridPane;
99
import javafx.scene.layout.VBox;
1010
import javafx.stage.Stage;
11-
import org.fxmisc.richtext.AreaFactory;
1211
import org.fxmisc.richtext.InlineCssTextArea;
1312

1413
public class CloneDemo extends Application {
@@ -22,8 +21,8 @@ public void start(Stage primaryStage) {
2221
String selectedText = "selection";
2322
String text = "Edit the top area (original)\nand watch the (clone) bottom area's displayed text change and its " +
2423
"selected text [" + selectedText + "] update itself accordingly.";
25-
InlineCssTextArea area = AreaFactory.inlineCssTextArea(text);
26-
InlineCssTextArea clone = AreaFactory.cloneInlineCssTextArea(area);
24+
InlineCssTextArea area = new InlineCssTextArea(text);
25+
InlineCssTextArea clone = new InlineCssTextArea(area.getContent());
2726

2827
VBox vbox = new VBox(area, clone);
2928
vbox.setSpacing(10);

richtextfx-demos/src/main/java/org/fxmisc/richtext/demo/richtext/RichText.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import javafx.stage.Stage;
3535

3636
import org.fxmisc.flowless.VirtualizedScrollPane;
37-
import org.fxmisc.richtext.AreaFactory;
3837
import org.fxmisc.richtext.Paragraph;
3938
import org.fxmisc.richtext.StyleSpans;
4039
import org.fxmisc.richtext.StyledTextArea;
@@ -46,10 +45,8 @@ public static void main(String[] args) {
4645
launch(args);
4746
}
4847

49-
private final StyledTextArea<ParStyle, TextStyle> area =
50-
AreaFactory.<ParStyle, TextStyle>styledTextArea(
51-
ParStyle.EMPTY,
52-
( paragraph, style) -> paragraph.setStyle(style.toCss()),
48+
private final StyledTextArea<ParStyle, TextStyle> area = new StyledTextArea<>(
49+
ParStyle.EMPTY, ( paragraph, style) -> paragraph.setStyle(style.toCss()),
5350
TextStyle.EMPTY.updateFontSize(12).updateFontFamily("Serif").updateTextColor(Color.BLACK),
5451
( text, style) -> text.setStyle(style.toCss()));
5552
{

richtextfx/src/main/java/org/fxmisc/richtext/AreaFactory.java

Lines changed: 0 additions & 206 deletions
This file was deleted.

richtextfx/src/main/java/org/fxmisc/richtext/StyledTextArea.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,20 @@
7373
* style or style classes.</p>
7474
*
7575
* <p>Note: Scroll bars no longer appear when the content spans outside
76-
* of the viewport. To add scroll bars, the area needs to be embedded in
77-
* a {@link VirtualizedScrollPane}. {@link AreaFactory} is provided to make
78-
* this more convenient.</p>
76+
* of the viewport. To add scroll bars, the area needs to be wrapped in
77+
* a {@link VirtualizedScrollPane}. For example, </p>
78+
* <pre>
79+
* {@code
80+
* // shows area without scroll bars
81+
* InlineCssTextArea area = new InlineCssTextArea();
82+
*
83+
* // add scroll bars that will display as needed
84+
* VirtualizedScrollPane<InlineCssTextArea> vsPane = new VirtualizedScrollPane(area);
85+
*
86+
* Parent parent = //;
87+
* parent.getChildren().add(vsPane)
88+
* }
89+
* </pre>
7990
*
8091
* <h3>Overriding keyboard shortcuts</h3>
8192
*

0 commit comments

Comments
 (0)