Skip to content

Commit

Permalink
Code cleanup and javadocs for rich text area.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemmermann committed Feb 25, 2020
1 parent 4ad94d8 commit 1d6be6f
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 115 deletions.

This file was deleted.

43 changes: 36 additions & 7 deletions gemsfx/src/main/java/com/dlsc/gemsfx/richtextarea/RTElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,62 @@
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

public class RTElement<SELF extends RTElement> {
public abstract class RTElement<SELF extends RTElement> {

protected RTElement() {
}

private final ListProperty<String> styleClass = new SimpleListProperty<>(this, "styleClass", FXCollections.observableArrayList());

public ObservableList<String> getStyleClass() {
public final ObservableList<String> getStyleClass() {
return styleClass.get();
}

public ListProperty<String> styleClassProperty() {
public final ListProperty<String> styleClassProperty() {
return styleClass;
}

public void withStyleClasses(String... styleClass) {
public final void withStyleClasses(String... styleClass) {
this.styleClass.setAll(styleClass);
}

private final StringProperty id = new SimpleStringProperty(this, "id");

public String getId() {
public final String getId() {
return id.get();
}

public StringProperty idProperty() {
public final StringProperty idProperty() {
return id;
}

public void setId(String id) {
public final void setId(String id) {
this.id.set(id);
}

public final SELF withId(String id) {
setId(id);
return (SELF) this;
}

// style

private final StringProperty style = new SimpleStringProperty(this, "style");

public final String getStyle() {
return style.get();
}

public final StringProperty styleProperty() {
return style;
}

public final void setStyle(String style) {
this.style.set(style);
}

public final SELF withStyle(String style) {
setStyle(style);
return (SELF) this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public abstract class RTElementContainer<SELF extends RTElementContainer> extend
protected RTElementContainer() {
}

public SELF withElements(RTElement... elements) {
public final SELF withElements(RTElement... elements) {
this.elements.setAll(elements);
return (SELF) this;
}

public ObservableList<RTElement> getElements() {
public final ObservableList<RTElement> getElements() {
return elements.getReadOnlyProperty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public static RTHeading create(String text) {
return new RTHeading().withText(text);
}

public RTHeading withLevel(int level) {
public final RTHeading withLevel(int level) {
this.level = level;
return this;
}

public int getLevel() {
public final int getLevel() {
return level;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ public static RTImage create() {
return new RTImage();
}

public Image getImage() {
public final Image getImage() {
return image;
}

public RTImage withImage(Image image) {
public final RTImage withImage(Image image) {
this.image = image;
return this;
}
Expand Down
8 changes: 4 additions & 4 deletions gemsfx/src/main/java/com/dlsc/gemsfx/richtextarea/RTLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ public static RTLink create(String text, String url) {
return create(text).withTarget(url);
}

public RTLink withTarget(String url) {
public final RTLink withTarget(String url) {
this.target.set(url);
return this;
}

private final StringProperty target = new SimpleStringProperty(this, "target");

public String getTarget() {
public final String getTarget() {
return target.get();
}

public StringProperty targetProperty() {
public final StringProperty targetProperty() {
return target;
}

public void setTarget(String target) {
public final void setTarget(String target) {
this.target.set(target);
}
}
12 changes: 6 additions & 6 deletions gemsfx/src/main/java/com/dlsc/gemsfx/richtextarea/RTList.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,30 @@ public static RTList create(RTListItem... items) {
return new RTList().withItems(items);
}

public RTList withItems(RTListItem... items) {
public final RTList withItems(RTListItem... items) {
this.items.setAll(items);
return this;
}

public RTList withStart(int start) {
public final RTList withStart(int start) {
this.start = start;
return this;
}

public RTList withType(Type type) {
public final RTList withType(Type type) {
this.type = type;
return this;
}

public int getStart() {
public final int getStart() {
return start;
}

public Type getType() {
public final Type getType() {
return type;
}

public ObservableList<RTListItem> getItems() {
public final ObservableList<RTListItem> getItems() {
return items.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ public static RTTable create() {
return new RTTable();
}

public RTTable withHead(RTTableHead head) {
public final RTTable withHead(RTTableHead head) {
this.head = head;
return this;
}

public RTTable withBody(RTTableBody body) {
public final RTTable withBody(RTTableBody body) {
this.body = body;
return this;
}

public RTTableHead getHead() {
public final RTTableHead getHead() {
return head;
}

public RTTableBody getBody() {
public final RTTableBody getBody() {
return body;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ public static RTTableCell create() {
return new RTTableCell();
}

public RTTableCell withRowSpan(int span) {
public final RTTableCell withRowSpan(int span) {
this.rowSpan = rowSpan;
return this;
}

public RTTableCell withColSpan(int span) {
public final RTTableCell withColSpan(int span) {
this.colSpan = colSpan;
return this;
}

public RTTableCell withAlignment(Pos alignment) {
public final RTTableCell withAlignment(Pos alignment) {
this.alignment = alignment;
return this;
}

public int getRowSpan() {
public final int getRowSpan() {
return rowSpan;
}

public int getColSpan() {
public final int getColSpan() {
return colSpan;
}

public Pos getAlignment() {
public final Pos getAlignment() {
return alignment;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ public abstract class RTTableContainer<SELF extends RTTableContainer> extends RT
private final ObservableList<RTTableRow> rows = FXCollections.observableArrayList();


public SELF withRows(RTTableRow... row) {
public final SELF withRows(RTTableRow... row) {
rows.setAll(row);
return (SELF) this;
}

public ObservableList<RTTableRow> getRows() {
public final ObservableList<RTTableRow> getRows() {
return rows;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public static RTTableRow create() {
return new RTTableRow();
}

public RTTableRow withCells(RTTableCell... cells) {
public final RTTableRow withCells(RTTableCell... cells) {
this.cells.setAll(cells);
return this;
}

public ObservableList<RTTableCell> getCells() {
public final ObservableList<RTTableCell> getCells() {
return cells;
}
}
Loading

0 comments on commit 1d6be6f

Please sign in to comment.