You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/10/05 01:45:53 UTC
svn commit: r1529349 [43/44] - in /pivot/trunk:
charts/src/org/apache/pivot/charts/
charts/src/org/apache/pivot/charts/skin/ core/src/org/apache/pivot/beans/
core/src/org/apache/pivot/collections/
core/src/org/apache/pivot/collections/adapter/ core/src...
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java Fri Oct 4 23:45:40 2013
@@ -61,7 +61,7 @@ public class TextPaneSkin extends Contai
caretOn = !caretOn;
if (selection == null) {
- TextPane textPane = (TextPane)getComponent();
+ TextPane textPane = (TextPane) getComponent();
textPane.repaint(caret.x, caret.y, caret.width, caret.height);
}
}
@@ -70,7 +70,7 @@ public class TextPaneSkin extends Contai
private class ScrollSelectionCallback implements Runnable {
@Override
public void run() {
- TextPane textPane = (TextPane)getComponent();
+ TextPane textPane = (TextPane) getComponent();
int selectionStart = textPane.getSelectionStart();
int selectionLength = textPane.getSelectionLength();
int selectionEnd = selectionStart + selectionLength - 1;
@@ -93,7 +93,8 @@ public class TextPaneSkin extends Contai
int offset = getNextInsertionPoint(mouseX, selectionEnd, scrollDirection);
if (offset != -1) {
- // If the next character is a paragraph terminator and is not the
+ // If the next character is a paragraph terminator and
+ // is not the
// final terminator character, increment the selection
Document document = textPane.getDocument();
if (document.getCharacterAt(offset) == '\n'
@@ -162,7 +163,7 @@ public class TextPaneSkin extends Contai
public void install(Component component) {
super.install(component);
- TextPane textPane = (TextPane)component;
+ TextPane textPane = (TextPane) component;
textPane.getTextPaneListeners().add(this);
textPane.getTextPaneSelectionListeners().add(this);
@@ -170,7 +171,7 @@ public class TextPaneSkin extends Contai
Document document = textPane.getDocument();
if (document != null) {
- documentView = (TextPaneSkinDocumentView)createNodeView(document);
+ documentView = (TextPaneSkinDocumentView) createNodeView(document);
documentView.attach();
updateSelection();
}
@@ -186,7 +187,7 @@ public class TextPaneSkin extends Contai
int preferredWidth;
if (documentView == null) {
- preferredWidth = 0;
+ preferredWidth = 0;
} else {
Dimensions documentDimensions = documentView.getPreferredSize(Integer.MAX_VALUE);
@@ -200,8 +201,7 @@ public class TextPaneSkin extends Contai
public int getPreferredHeight(int width) {
int preferredHeight;
- if (documentView == null
- || width == -1) {
+ if (documentView == null || width == -1) {
preferredHeight = 0;
} else {
int breakWidth;
@@ -225,8 +225,8 @@ public class TextPaneSkin extends Contai
int preferredWidth;
if (documentView == null) {
- preferredWidth = 0;
- preferredHeight = 0;
+ preferredWidth = 0;
+ preferredHeight = 0;
} else {
Dimensions documentDimensions = documentView.getPreferredSize(Integer.MAX_VALUE);
@@ -248,7 +248,7 @@ public class TextPaneSkin extends Contai
@Override
public void layout() {
if (documentView != null) {
- TextPane textPane = (TextPane)getComponent();
+ TextPane textPane = (TextPane) getComponent();
int width = getWidth();
int breakWidth;
@@ -267,8 +267,7 @@ public class TextPaneSkin extends Contai
scrollCharacterToVisible(textPane.getSelectionStart());
}
- showCaret(textPane.isFocused()
- && textPane.getSelectionLength() == 0);
+ showCaret(textPane.isFocused() && textPane.getSelectionLength() == 0);
}
}
@@ -276,14 +275,13 @@ public class TextPaneSkin extends Contai
public void paint(Graphics2D graphics) {
super.paint(graphics);
- TextPane textPane = (TextPane)getComponent();
+ TextPane textPane = (TextPane) getComponent();
if (documentView != null) {
// Draw the selection highlight
if (selection != null) {
- graphics.setColor(textPane.isFocused()
- && textPane.isEditable() ?
- selectionBackgroundColor : inactiveSelectionBackgroundColor);
+ graphics.setColor(textPane.isFocused() && textPane.isEditable() ? selectionBackgroundColor
+ : inactiveSelectionBackgroundColor);
graphics.fill(selection);
}
@@ -302,9 +300,7 @@ public class TextPaneSkin extends Contai
graphics.translate(-margin.left, -margin.top);
// Draw the caret
- if (selection == null
- && caretOn
- && textPane.isFocused()) {
+ if (selection == null && caretOn && textPane.isFocused()) {
graphics.setColor(textPane.isEditable() ? color : inactiveColor);
graphics.fill(caret);
}
@@ -321,9 +317,11 @@ public class TextPaneSkin extends Contai
int xUpdated = Math.min(documentView.getWidth() - 1, Math.max(x - margin.left, 0));
if (y < margin.top) {
- offset = documentView.getNextInsertionPoint(xUpdated, -1, TextPane.ScrollDirection.DOWN);
+ offset = documentView.getNextInsertionPoint(xUpdated, -1,
+ TextPane.ScrollDirection.DOWN);
} else if (y > documentView.getHeight() + margin.top) {
- offset = documentView.getNextInsertionPoint(xUpdated, -1, TextPane.ScrollDirection.UP);
+ offset = documentView.getNextInsertionPoint(xUpdated, -1,
+ TextPane.ScrollDirection.UP);
} else {
offset = documentView.getInsertionPoint(xUpdated, y - margin.top);
}
@@ -389,7 +387,7 @@ public class TextPaneSkin extends Contai
}
private void scrollCharacterToVisible(int offset) {
- TextPane textPane = (TextPane)getComponent();
+ TextPane textPane = (TextPane) getComponent();
Bounds characterBounds = getCharacterBounds(offset);
if (characterBounds != null) {
@@ -419,6 +417,7 @@ public class TextPaneSkin extends Contai
/**
* Sets the font of the text
+ *
* @param font A {@link ComponentSkin#decodeFont(String) font specification}
*/
public final void setFont(String font) {
@@ -431,6 +430,7 @@ public class TextPaneSkin extends Contai
/**
* Sets the font of the text
+ *
* @param font A dictionary {@link Theme#deriveFont describing a font}
*/
public final void setFont(Dictionary<String, ?> font) {
@@ -462,7 +462,9 @@ public class TextPaneSkin extends Contai
/**
* Sets the foreground color of the text
- * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ *
+ * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
+ * values recognized by Pivot}.
*/
public final void setColor(String color) {
if (color == null) {
@@ -578,14 +580,16 @@ public class TextPaneSkin extends Contai
}
/**
- * Returns the amount of space between the edge of the TextPane and its Document
+ * Returns the amount of space between the edge of the TextPane and its
+ * Document
*/
public Insets getMargin() {
return margin;
}
/**
- * Sets the amount of space between the edge of the TextPane and its Document
+ * Sets the amount of space between the edge of the TextPane and its
+ * Document
*/
public void setMargin(Insets margin) {
if (margin == null) {
@@ -597,8 +601,11 @@ public class TextPaneSkin extends Contai
}
/**
- * Sets the amount of space between the edge of the TextPane and its Document
- * @param margin A dictionary with keys in the set {left, top, bottom, right}.
+ * Sets the amount of space between the edge of the TextPane and its
+ * Document
+ *
+ * @param margin A dictionary with keys in the set {left, top, bottom,
+ * right}.
*/
public final void setMargin(Dictionary<String, ?> margin) {
if (margin == null) {
@@ -609,14 +616,16 @@ public class TextPaneSkin extends Contai
}
/**
- * Sets the amount of space between the edge of the TextPane and its Document
+ * Sets the amount of space between the edge of the TextPane and its
+ * Document
*/
public final void setMargin(int margin) {
setMargin(new Insets(margin));
}
/**
- * Sets the amount of space between the edge of the TextPane and its Document
+ * Sets the amount of space between the edge of the TextPane and its
+ * Document
*/
public final void setMargin(Number margin) {
if (margin == null) {
@@ -627,9 +636,11 @@ public class TextPaneSkin extends Contai
}
/**
- * Sets the amount of space between the edge of the TextPane and its Document
- * @param margin A string containing an integer or a JSON dictionary with keys
- * left, top, bottom, and/or right.
+ * Sets the amount of space between the edge of the TextPane and its
+ * Document
+ *
+ * @param margin A string containing an integer or a JSON dictionary with
+ * keys left, top, bottom, and/or right.
*/
public final void setMargin(String margin) {
if (margin == null) {
@@ -658,14 +669,13 @@ public class TextPaneSkin extends Contai
boolean consumed = super.mouseMove(component, x, y);
if (Mouse.getCapturer() == component) {
- TextPane textPane = (TextPane)getComponent();
+ TextPane textPane = (TextPane) getComponent();
Bounds visibleArea = textPane.getVisibleArea();
- visibleArea = new Bounds(visibleArea.x, visibleArea.y,
- visibleArea.width, visibleArea.height);
+ visibleArea = new Bounds(visibleArea.x, visibleArea.y, visibleArea.width,
+ visibleArea.height);
- if (y >= visibleArea.y
- && y < visibleArea.y + visibleArea.height) {
+ if (y >= visibleArea.y && y < visibleArea.y + visibleArea.height) {
// Stop the scroll selection timer
if (scheduledScrollSelectionCallback != null) {
scheduledScrollSelectionCallback.cancel();
@@ -685,22 +695,21 @@ public class TextPaneSkin extends Contai
}
} else {
if (scheduledScrollSelectionCallback == null) {
- scrollDirection = (y < visibleArea.y) ? TextPane.ScrollDirection.UP : TextPane.ScrollDirection.DOWN;
+ scrollDirection = (y < visibleArea.y) ? TextPane.ScrollDirection.UP
+ : TextPane.ScrollDirection.DOWN;
- scheduledScrollSelectionCallback =
- ApplicationContext.scheduleRecurringCallback(scrollSelectionCallback,
- SCROLL_RATE);
+ scheduledScrollSelectionCallback = ApplicationContext.scheduleRecurringCallback(
+ scrollSelectionCallback, SCROLL_RATE);
- // Run the callback once now to scroll the selection immediately
+ // Run the callback once now to scroll the selection
+ // immediately
scrollSelectionCallback.run();
}
}
mouseX = x;
} else {
- if (Mouse.isPressed(Mouse.Button.LEFT)
- && Mouse.getCapturer() == null
- && anchor != -1) {
+ if (Mouse.isPressed(Mouse.Button.LEFT) && Mouse.getCapturer() == null && anchor != -1) {
// Capture the mouse so we can select text
Mouse.capture(component);
}
@@ -714,7 +723,7 @@ public class TextPaneSkin extends Contai
boolean consumed = super.mouseDown(component, button, x, y);
if (button == Mouse.Button.LEFT) {
- TextPane textPane = (TextPane)component;
+ TextPane textPane = (TextPane) component;
anchor = getInsertionPoint(x, y);
@@ -765,12 +774,11 @@ public class TextPaneSkin extends Contai
return consumed;
}
-
@Override
public boolean keyTyped(final Component component, char character) {
boolean consumed = super.keyTyped(component, character);
- final TextPane textPane = (TextPane)getComponent();
+ final TextPane textPane = (TextPane) getComponent();
if (textPane.isEditable()) {
Document document = textPane.getDocument();
@@ -778,8 +786,7 @@ public class TextPaneSkin extends Contai
if (document != null) {
// Ignore characters in the control range and the ASCII delete
// character as well as meta key presses
- if (character > 0x1F
- && character != 0x7F
+ if (character > 0x1F && character != 0x7F
&& !Keyboard.isPressed(Keyboard.Modifier.META)) {
textPane.insert(character);
showCaret(true);
@@ -791,26 +798,24 @@ public class TextPaneSkin extends Contai
}
@Override
- public boolean keyPressed(final Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
+ public boolean keyPressed(final Component component, int keyCode,
+ Keyboard.KeyLocation keyLocation) {
boolean consumed = false;
- final TextPane textPane = (TextPane)getComponent();
+ final TextPane textPane = (TextPane) getComponent();
Document document = textPane.getDocument();
Keyboard.Modifier commandModifier = Platform.getCommandModifier();
if (document != null) {
- if (keyCode == Keyboard.KeyCode.ENTER
- && textPane.isEditable()) {
+ if (keyCode == Keyboard.KeyCode.ENTER && textPane.isEditable()) {
textPane.insertParagraph();
consumed = true;
- } else if (keyCode == Keyboard.KeyCode.DELETE
- && textPane.isEditable()) {
+ } else if (keyCode == Keyboard.KeyCode.DELETE && textPane.isEditable()) {
textPane.delete(false);
consumed = true;
- } else if (keyCode == Keyboard.KeyCode.BACKSPACE
- && textPane.isEditable()) {
+ } else if (keyCode == Keyboard.KeyCode.BACKSPACE && textPane.isEditable()) {
textPane.delete(true);
consumed = true;
@@ -829,12 +834,12 @@ public class TextPaneSkin extends Contai
if (selectionStart > 0) {
// first, skip over any space immediately to our left
while (selectionStart > 0
- && Character.isWhitespace(document.getCharacterAt(selectionStart - 1))) {
+ && Character.isWhitespace(document.getCharacterAt(selectionStart - 1))) {
selectionStart--;
}
// then, skip over any word-letters to our left
while (selectionStart > 0
- && !Character.isWhitespace(document.getCharacterAt(selectionStart - 1))) {
+ && !Character.isWhitespace(document.getCharacterAt(selectionStart - 1))) {
selectionStart--;
}
@@ -843,8 +848,7 @@ public class TextPaneSkin extends Contai
} else {
// Clear the selection and move the caret back by one
// character
- if (selectionLength == 0
- && selectionStart > 0) {
+ if (selectionLength == 0 && selectionStart > 0) {
selectionStart--;
}
@@ -874,12 +878,12 @@ public class TextPaneSkin extends Contai
if (selectionStart < document.getCharacterCount()) {
// first, skip over any word-letters to our right
while (selectionStart < document.getCharacterCount() - 1
- && !Character.isWhitespace(document.getCharacterAt(selectionStart))) {
+ && !Character.isWhitespace(document.getCharacterAt(selectionStart))) {
selectionStart++;
}
// then, skip over any space immediately to our right
while (selectionStart < document.getCharacterCount() - 1
- && Character.isWhitespace(document.getCharacterAt(selectionStart))) {
+ && Character.isWhitespace(document.getCharacterAt(selectionStart))) {
selectionStart++;
}
@@ -909,7 +913,8 @@ public class TextPaneSkin extends Contai
} else if (keyCode == Keyboard.KeyCode.UP) {
int selectionStart = textPane.getSelectionStart();
- int offset = getNextInsertionPoint(caretX, selectionStart, TextPane.ScrollDirection.UP);
+ int offset = getNextInsertionPoint(caretX, selectionStart,
+ TextPane.ScrollDirection.UP);
if (offset == -1) {
offset = 0;
@@ -935,11 +940,13 @@ public class TextPaneSkin extends Contai
int from;
int x;
if (selectionLength == 0) {
- // Get next insertion point from leading selection character
+ // Get next insertion point from leading selection
+ // character
from = selectionStart;
x = caretX;
} else {
- // Get next insertion point from right edge of trailing selection
+ // Get next insertion point from right edge of trailing
+ // selection
// character
from = selectionStart + selectionLength - 1;
@@ -952,7 +959,8 @@ public class TextPaneSkin extends Contai
if (offset == -1) {
offset = documentView.getCharacterCount() - 1;
} else {
- // If the next character is a paragraph terminator and is not the
+ // If the next character is a paragraph terminator and
+ // is not the
// final terminator character, increment the selection
if (document.getCharacterAt(offset) == '\n'
&& offset < documentView.getCharacterCount() - 1) {
@@ -965,10 +973,12 @@ public class TextPaneSkin extends Contai
} else {
int from;
if (selectionLength == 0) {
- // Get next insertion point from leading selection character
+ // Get next insertion point from leading selection
+ // character
from = selectionStart;
} else {
- // Get next insertion point from trailing selection character
+ // Get next insertion point from trailing selection
+ // character
from = selectionStart + selectionLength - 1;
}
@@ -983,30 +993,26 @@ public class TextPaneSkin extends Contai
}
consumed = true;
- } else if (Keyboard.isPressed(commandModifier)
- && keyCode == Keyboard.KeyCode.TAB
- && textPane.isEditable()) {
- textPane.insert("\t");
- showCaret(true);
+ } else if (Keyboard.isPressed(commandModifier) && keyCode == Keyboard.KeyCode.TAB
+ && textPane.isEditable()) {
+ textPane.insert("\t");
+ showCaret(true);
- consumed = true;
+ consumed = true;
} else if (Keyboard.isPressed(commandModifier)) {
if (keyCode == Keyboard.KeyCode.A) {
textPane.setSelection(0, document.getCharacterCount());
consumed = true;
- } else if (keyCode == Keyboard.KeyCode.X
- && textPane.isEditable()) {
+ } else if (keyCode == Keyboard.KeyCode.X && textPane.isEditable()) {
textPane.cut();
consumed = true;
} else if (keyCode == Keyboard.KeyCode.C) {
textPane.copy();
consumed = true;
- } else if (keyCode == Keyboard.KeyCode.V
- && textPane.isEditable()) {
+ } else if (keyCode == Keyboard.KeyCode.V && textPane.isEditable()) {
textPane.paste();
consumed = true;
- } else if (keyCode == Keyboard.KeyCode.Z
- && textPane.isEditable()) {
+ } else if (keyCode == Keyboard.KeyCode.Z && textPane.isEditable()) {
if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
textPane.redo();
} else {
@@ -1038,8 +1044,7 @@ public class TextPaneSkin extends Contai
consumed = true;
} else if (keyCode == Keyboard.KeyCode.INSERT) {
- if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)
- && textPane.isEditable()) {
+ if (Keyboard.isPressed(Keyboard.Modifier.SHIFT) && textPane.isEditable()) {
textPane.paste();
consumed = true;
}
@@ -1063,9 +1068,8 @@ public class TextPaneSkin extends Contai
public void focusedChanged(Component component, Component obverseComponent) {
super.focusedChanged(component, obverseComponent);
- TextPane textPane = (TextPane)getComponent();
- if (textPane.isFocused()
- && textPane.getSelectionLength() == 0) {
+ TextPane textPane = (TextPane) getComponent();
+ if (textPane.isFocused() && textPane.getSelectionLength() == 0) {
scrollCharacterToVisible(textPane.getSelectionStart());
showCaret(true);
} else {
@@ -1085,7 +1089,7 @@ public class TextPaneSkin extends Contai
Document document = textPane.getDocument();
if (document != null) {
- documentView = (TextPaneSkinDocumentView)createNodeView(document);
+ documentView = (TextPaneSkinDocumentView) createNodeView(document);
documentView.attach();
}
@@ -1101,10 +1105,10 @@ public class TextPaneSkin extends Contai
@Override
public void selectionChanged(TextPane textPane, int previousSelectionStart,
int previousSelectionLength) {
- // If the document view is valid, repaint the selection state; otherwise,
+ // If the document view is valid, repaint the selection state;
+ // otherwise,
// the selection will be updated in layout()
- if (documentView != null
- && documentView.isValid()) {
+ if (documentView != null && documentView.isValid()) {
if (selection == null) {
// Repaint previous caret bounds
textPane.repaint(caret.x, caret.y, caret.width, caret.height);
@@ -1132,23 +1136,23 @@ public class TextPaneSkin extends Contai
TextPaneSkinNodeView nodeView = null;
if (node instanceof Document) {
- nodeView = new TextPaneSkinDocumentView(this, (Document)node);
+ nodeView = new TextPaneSkinDocumentView(this, (Document) node);
} else if (node instanceof Paragraph) {
- nodeView = new TextPaneSkinParagraphView((Paragraph)node);
+ nodeView = new TextPaneSkinParagraphView((Paragraph) node);
} else if (node instanceof TextNode) {
- nodeView = new TextPaneSkinTextNodeView((TextNode)node);
+ nodeView = new TextPaneSkinTextNodeView((TextNode) node);
} else if (node instanceof ImageNode) {
- nodeView = new TextPaneSkinImageNodeView((ImageNode)node);
+ nodeView = new TextPaneSkinImageNodeView((ImageNode) node);
} else if (node instanceof ComponentNode) {
- nodeView = new TextPaneSkinComponentNodeView((ComponentNode)node);
+ nodeView = new TextPaneSkinComponentNodeView((ComponentNode) node);
} else if (node instanceof TextSpan) {
- nodeView = new TextPaneSkinSpanView((TextSpan)node);
+ nodeView = new TextPaneSkinSpanView((TextSpan) node);
} else if (node instanceof NumberedList) {
- nodeView = new TextPaneSkinNumberedListView((NumberedList)node);
+ nodeView = new TextPaneSkinNumberedListView((NumberedList) node);
} else if (node instanceof BulletedList) {
- nodeView = new TextPaneSkinBulletedListView((BulletedList)node);
+ nodeView = new TextPaneSkinBulletedListView((BulletedList) node);
} else if (node instanceof List.Item) {
- nodeView = new TextPaneSkinListItemView((List.Item)node);
+ nodeView = new TextPaneSkinListItemView((List.Item) node);
} else {
throw new IllegalArgumentException("Unsupported node type: "
+ node.getClass().getName());
@@ -1159,7 +1163,7 @@ public class TextPaneSkin extends Contai
private void updateSelection() {
if (documentView.getCharacterCount() > 0) {
- TextPane textPane = (TextPane)getComponent();
+ TextPane textPane = (TextPane) getComponent();
// Update the caret
int selectionStart = textPane.getSelectionStart();
@@ -1184,23 +1188,23 @@ public class TextPaneSkin extends Contai
int lastRowIndex = getRowAt(selectionEnd);
if (firstRowIndex == lastRowIndex) {
- selection.add(new Area(new Rectangle(leadingSelectionBounds.x, leadingSelectionBounds.y,
- trailingSelectionBounds.x + trailingSelectionBounds.width - leadingSelectionBounds.x,
- trailingSelectionBounds.y + trailingSelectionBounds.height - leadingSelectionBounds.y)));
+ selection.add(new Area(new Rectangle(leadingSelectionBounds.x,
+ leadingSelectionBounds.y, trailingSelectionBounds.x
+ + trailingSelectionBounds.width - leadingSelectionBounds.x,
+ trailingSelectionBounds.y + trailingSelectionBounds.height
+ - leadingSelectionBounds.y)));
} else {
int width = getWidth();
selection.add(new Area(new Rectangle(leadingSelectionBounds.x,
- leadingSelectionBounds.y,
- width - margin.right - leadingSelectionBounds.x,
+ leadingSelectionBounds.y, width - margin.right - leadingSelectionBounds.x,
leadingSelectionBounds.height)));
if (lastRowIndex - firstRowIndex > 0) {
- selection.add(new Area(new Rectangle(margin.left,
- leadingSelectionBounds.y + leadingSelectionBounds.height,
- width - (margin.left + margin.right),
- trailingSelectionBounds.y - (leadingSelectionBounds.y
- + leadingSelectionBounds.height))));
+ selection.add(new Area(new Rectangle(margin.left, leadingSelectionBounds.y
+ + leadingSelectionBounds.height, width - (margin.left + margin.right),
+ trailingSelectionBounds.y
+ - (leadingSelectionBounds.y + leadingSelectionBounds.height))));
}
selection.add(new Area(new Rectangle(margin.left, trailingSelectionBounds.y,
@@ -1224,9 +1228,8 @@ public class TextPaneSkin extends Contai
if (show) {
caretOn = true;
- scheduledBlinkCaretCallback =
- ApplicationContext.scheduleRecurringCallback(blinkCaretCallback,
- Platform.getCursorBlinkRate());
+ scheduledBlinkCaretCallback = ApplicationContext.scheduleRecurringCallback(
+ blinkCaretCallback, Platform.getCursorBlinkRate());
// Run the callback once now to show the cursor immediately
blinkCaretCallback.run();
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBlockView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBlockView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBlockView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBlockView.java Fri Oct 4 23:45:40 2013
@@ -20,8 +20,7 @@ import org.apache.pivot.wtk.HorizontalAl
import org.apache.pivot.wtk.text.Block;
import org.apache.pivot.wtk.text.BlockListener;
-abstract class TextPaneSkinBlockView extends TextPaneSkinElementView implements
- BlockListener {
+abstract class TextPaneSkinBlockView extends TextPaneSkinElementView implements BlockListener {
public TextPaneSkinBlockView(Block block) {
super(block);
@@ -31,7 +30,7 @@ abstract class TextPaneSkinBlockView ext
protected void attach() {
super.attach();
- Block block = (Block)getNode();
+ Block block = (Block) getNode();
block.getBlockListeners().add(this);
}
@@ -39,12 +38,13 @@ abstract class TextPaneSkinBlockView ext
protected void detach() {
super.detach();
- Block block = (Block)getNode();
+ Block block = (Block) getNode();
block.getBlockListeners().remove(this);
}
@Override
- public void horizontalAlignmentChanged(Block block, HorizontalAlignment previousHorizontalAlignment) {
+ public void horizontalAlignmentChanged(Block block,
+ HorizontalAlignment previousHorizontalAlignment) {
invalidateUpTree();
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBulletedListView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBulletedListView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBulletedListView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBulletedListView.java Fri Oct 4 23:45:40 2013
@@ -29,7 +29,7 @@ class TextPaneSkinBulletedListView exten
protected void attach() {
super.attach();
- BulletedList bulletedList = (BulletedList)getNode();
+ BulletedList bulletedList = (BulletedList) getNode();
bulletedList.getBulletedListListeners().add(this);
}
@@ -37,16 +37,16 @@ class TextPaneSkinBulletedListView exten
protected void detach() {
super.detach();
- BulletedList bulletedList = (BulletedList)getNode();
+ BulletedList bulletedList = (BulletedList) getNode();
bulletedList.getBulletedListListeners().remove(this);
}
@Override
protected void childLayout(int breakWidth) {
- BulletedList bulletedList = (BulletedList)getNode();
+ BulletedList bulletedList = (BulletedList) getNode();
for (TextPaneSkinNodeView nodeView : this) {
- TextPaneSkinListItemView listItemView = (TextPaneSkinListItemView)nodeView;
+ TextPaneSkinListItemView listItemView = (TextPaneSkinListItemView) nodeView;
switch (bulletedList.getStyle()) {
case CIRCLE:
@@ -62,7 +62,7 @@ class TextPaneSkinBulletedListView exten
this.maxIndexTextWidth = 0;
for (TextPaneSkinNodeView nodeView : this) {
- TextPaneSkinListItemView listItemView = (TextPaneSkinListItemView)nodeView;
+ TextPaneSkinListItemView listItemView = (TextPaneSkinListItemView) nodeView;
this.maxIndexTextWidth = Math.max(this.maxIndexTextWidth,
listItemView.getIndexTextWidth());
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinComponentNodeView.java Fri Oct 4 23:45:40 2013
@@ -104,8 +104,10 @@ class TextPaneSkinComponentNodeView exte
if (component != null) {
// I have to un-translate the x and y coordinates because the
- // component is painted by the Container object, and it's co-ordinates
- // are relative to the Container object, not to the document node hierarchy.
+ // component is painted by the Container object, and it's
+ // co-ordinates
+ // are relative to the Container object, not to the document node
+ // hierarchy.
component.setLocation(skinX, skinY);
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java Fri Oct 4 23:45:40 2013
@@ -35,8 +35,8 @@ import org.apache.pivot.wtk.text.Node;
/**
* Abstract base class for element views.
*/
-abstract class TextPaneSkinElementView extends TextPaneSkinNodeView
- implements Sequence<TextPaneSkinNodeView>, Iterable<TextPaneSkinNodeView>, ElementListener {
+abstract class TextPaneSkinElementView extends TextPaneSkinNodeView implements
+ Sequence<TextPaneSkinNodeView>, Iterable<TextPaneSkinNodeView>, ElementListener {
private ArrayList<TextPaneSkinNodeView> nodeViews = new ArrayList<>();
private int skinX = 0;
private int skinY = 0;
@@ -49,7 +49,7 @@ abstract class TextPaneSkinElementView e
protected void attach() {
super.attach();
- Element element = (Element)getNode();
+ Element element = (Element) getNode();
element.getElementListeners().add(this);
// Attach child node views
@@ -60,7 +60,7 @@ abstract class TextPaneSkinElementView e
@Override
protected void detach() {
- Element element = (Element)getNode();
+ Element element = (Element) getNode();
element.getElementListeners().remove(this);
// Detach child node views
@@ -168,28 +168,32 @@ abstract class TextPaneSkinElementView e
}
}
- protected final void paintChild(Graphics2D graphics, Bounds paintBounds, TextPaneSkinNodeView nodeView) {
+ protected final void paintChild(Graphics2D graphics, Bounds paintBounds,
+ TextPaneSkinNodeView nodeView) {
Bounds nodeViewBounds = nodeView.getBounds();
// Only paint node views that intersect the current clip rectangle
if (nodeViewBounds.intersects(paintBounds)) {
// Create a copy of the current graphics context and
// translate to the node view's coordinate system
- Graphics2D nodeViewGraphics = (Graphics2D)graphics.create();
+ Graphics2D nodeViewGraphics = (Graphics2D) graphics.create();
Color styledBackgroundColor = getStyledBackgroundColor();
if (styledBackgroundColor != null) {
// don't paint over the selection background
Area selection = getTextPaneSkin().getSelection();
if (selection != null) {
- Area fillArea = new Area(new Rectangle(nodeViewBounds.x, nodeViewBounds.y, nodeViewBounds.width, nodeViewBounds.height));
- selection = selection.createTransformedArea(AffineTransform.getTranslateInstance(-skinX, -skinY));
+ Area fillArea = new Area(new Rectangle(nodeViewBounds.x, nodeViewBounds.y,
+ nodeViewBounds.width, nodeViewBounds.height));
+ selection = selection.createTransformedArea(AffineTransform.getTranslateInstance(
+ -skinX, -skinY));
fillArea.subtract(selection);
nodeViewGraphics.setColor(styledBackgroundColor);
nodeViewGraphics.fill(fillArea);
} else {
nodeViewGraphics.setColor(styledBackgroundColor);
- nodeViewGraphics.fillRect(nodeViewBounds.x, nodeViewBounds.y, nodeViewBounds.width, nodeViewBounds.height);
+ nodeViewGraphics.fillRect(nodeViewBounds.x, nodeViewBounds.y,
+ nodeViewBounds.width, nodeViewBounds.height);
}
}
nodeViewGraphics.translate(nodeViewBounds.x, nodeViewBounds.y);
@@ -231,8 +235,7 @@ abstract class TextPaneSkinElementView e
int nodeViewOffset = nodeView.getOffset();
int characterCount = nodeView.getCharacterCount();
- if (offset >= nodeViewOffset
- && offset < nodeViewOffset + characterCount) {
+ if (offset >= nodeViewOffset && offset < nodeViewOffset + characterCount) {
characterBounds = nodeView.getCharacterBounds(offset - nodeViewOffset);
if (characterBounds != null) {
@@ -264,8 +267,10 @@ abstract class TextPaneSkinElementView e
@Override
public void fontChanged(Element element, Font previousFont) {
- // because children may depend on parents for their style information, we need to invalidate the whole tree
- // TODO, we don't need to invalidate the whole tree, just the sub-tree from here down
+ // because children may depend on parents for their style information,
+ // we need to invalidate the whole tree
+ // TODO, we don't need to invalidate the whole tree, just the sub-tree
+ // from here down
getTextPaneSkin().invalidateNodeViewTree();
}
@@ -276,22 +281,28 @@ abstract class TextPaneSkinElementView e
@Override
public void foregroundColorChanged(Element element, Color previousForegroundColor) {
- // Because children may depend on parents for their style information, we need to invalidate the whole tree.
- // TODO we don't need to invalidate the whole tree, just the sub-tree from here down.
+ // Because children may depend on parents for their style information,
+ // we need to invalidate the whole tree.
+ // TODO we don't need to invalidate the whole tree, just the sub-tree
+ // from here down.
getTextPaneSkin().invalidateNodeViewTree();
}
@Override
public void underlineChanged(Element element) {
- // Because children may depend on parents for their style information, we need to invalidate the whole tree.
- // TODO we don't need to invalidate the whole tree, just the sub-tree from here down.
+ // Because children may depend on parents for their style information,
+ // we need to invalidate the whole tree.
+ // TODO we don't need to invalidate the whole tree, just the sub-tree
+ // from here down.
getTextPaneSkin().invalidateNodeViewTree();
}
@Override
public void strikethroughChanged(Element element) {
- // Because children may depend on parents for their style information, we need to invalidate the whole tree.
- // TODO we don't need to invalidate the whole tree, just the sub-tree from here down.
+ // Because children may depend on parents for their style information,
+ // we need to invalidate the whole tree.
+ // TODO we don't need to invalidate the whole tree, just the sub-tree
+ // from here down.
getTextPaneSkin().invalidateNodeViewTree();
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinImageNodeView.java Fri Oct 4 23:45:40 2013
@@ -26,7 +26,8 @@ import org.apache.pivot.wtk.media.ImageL
import org.apache.pivot.wtk.text.ImageNode;
import org.apache.pivot.wtk.text.ImageNodeListener;
-class TextPaneSkinImageNodeView extends TextPaneSkinNodeView implements ImageNodeListener, ImageListener {
+class TextPaneSkinImageNodeView extends TextPaneSkinNodeView implements ImageNodeListener,
+ ImageListener {
public TextPaneSkinImageNodeView(ImageNode imageNode) {
super(imageNode);
}
@@ -35,7 +36,7 @@ class TextPaneSkinImageNodeView extends
protected void attach() {
super.attach();
- ImageNode imageNode = (ImageNode)getNode();
+ ImageNode imageNode = (ImageNode) getNode();
imageNode.getImageNodeListeners().add(this);
Image image = imageNode.getImage();
@@ -48,13 +49,13 @@ class TextPaneSkinImageNodeView extends
protected void detach() {
super.detach();
- ImageNode imageNode = (ImageNode)getNode();
+ ImageNode imageNode = (ImageNode) getNode();
imageNode.getImageNodeListeners().remove(this);
}
@Override
protected void childLayout(int breakWidth) {
- ImageNode imageNode = (ImageNode)getNode();
+ ImageNode imageNode = (ImageNode) getNode();
Image image = imageNode.getImage();
if (image == null) {
@@ -66,7 +67,7 @@ class TextPaneSkinImageNodeView extends
@Override
public Dimensions getPreferredSize(int breakWidth) {
- ImageNode imageNode = (ImageNode)getNode();
+ ImageNode imageNode = (ImageNode) getNode();
Image image = imageNode.getImage();
if (image == null) {
@@ -82,7 +83,7 @@ class TextPaneSkinImageNodeView extends
@Override
public int getBaseline() {
- ImageNode imageNode = (ImageNode)getNode();
+ ImageNode imageNode = (ImageNode) getNode();
Image image = imageNode.getImage();
int baseline = -1;
@@ -96,7 +97,7 @@ class TextPaneSkinImageNodeView extends
@Override
public void paint(Graphics2D graphics) {
- ImageNode imageNode = (ImageNode)getNode();
+ ImageNode imageNode = (ImageNode) getNode();
Image image = imageNode.getImage();
if (image != null) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java Fri Oct 4 23:45:40 2013
@@ -20,7 +20,6 @@ import java.util.Iterator;
import org.apache.pivot.wtk.text.TextNode;
-
class TextPaneSkinListItemView extends TextPaneSkinVerticalElementView {
private TextNode indexTextNode;
@@ -60,7 +59,7 @@ class TextPaneSkinListItemView extends T
Iterator<TextPaneSkinNodeView> iterator = this.iterator();
iterator.next();
- for ( ; iterator.hasNext(); ) {
+ for (; iterator.hasNext();) {
TextPaneSkinNodeView nodeView = iterator.next();
nodeView.layout(bw);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java Fri Oct 4 23:45:40 2013
@@ -87,8 +87,8 @@ abstract class TextPaneSkinNodeView impl
}
protected void setSize(int width, int height) {
- assert(width >= 0);
- assert(height >= 0);
+ assert (width >= 0);
+ assert (height >= 0);
// Redraw the region formerly occupied by this view
repaint();
@@ -124,9 +124,9 @@ abstract class TextPaneSkinNodeView impl
}
/**
- * Set location of the NodeView relative to the skin component.
- * This is needed by the ComponentViewNode to correctly position child Component's.
- *
+ * Set location of the NodeView relative to the skin component. This is
+ * needed by the ComponentViewNode to correctly position child Component's.
+ *
* @param skinX the X coordinate in the skin's frame of reference
* @param skinY the Y coordinate in the skin's frame of reference
*/
@@ -141,8 +141,8 @@ abstract class TextPaneSkinNodeView impl
}
public void repaint(int xArgument, int yArgument, int widthArgument, int heightArgument) {
- assert(widthArgument >= 0);
- assert(heightArgument >= 0);
+ assert (widthArgument >= 0);
+ assert (heightArgument >= 0);
if (parent != null) {
parent.repaint(xArgument + this.x, yArgument + this.y, widthArgument, heightArgument);
@@ -166,7 +166,8 @@ abstract class TextPaneSkinNodeView impl
}
public final void layout(int breakWidth) {
- // reduce the number of layout calculations we need to do by only redoing them if necessary
+ // reduce the number of layout calculations we need to do by only
+ // redoing them if necessary
if (!valid || previousBreakWidth != breakWidth) {
childLayout(breakWidth);
valid = true;
@@ -191,9 +192,14 @@ abstract class TextPaneSkinNodeView impl
}
public abstract int getInsertionPoint(int xArgument, int yArgument);
- public abstract int getNextInsertionPoint(int xArgument, int from, TextPane.ScrollDirection direction);
+
+ public abstract int getNextInsertionPoint(int xArgument, int from,
+ TextPane.ScrollDirection direction);
+
public abstract int getRowAt(int offset);
+
public abstract int getRowCount();
+
public abstract Bounds getCharacterBounds(int offset);
@Override
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java Fri Oct 4 23:45:40 2013
@@ -34,21 +34,11 @@ class TextPaneSkinNumberedListView exten
}
}
- private static final RomanValue[] ROMAN_VALUE_TABLE = {
- new RomanValue(1000, "M"),
- new RomanValue(900, "CM"),
- new RomanValue(500, "D"),
- new RomanValue(400, "CD"),
- new RomanValue(100, "C"),
- new RomanValue(90, "XC"),
- new RomanValue(50, "L"),
- new RomanValue(40, "XL"),
- new RomanValue(10, "X"),
- new RomanValue(9, "IX"),
- new RomanValue(5, "V"),
- new RomanValue(4, "IV"),
- new RomanValue(1, "I")
- };
+ private static final RomanValue[] ROMAN_VALUE_TABLE = { new RomanValue(1000, "M"),
+ new RomanValue(900, "CM"), new RomanValue(500, "D"), new RomanValue(400, "CD"),
+ new RomanValue(100, "C"), new RomanValue(90, "XC"), new RomanValue(50, "L"),
+ new RomanValue(40, "XL"), new RomanValue(10, "X"), new RomanValue(9, "IX"),
+ new RomanValue(5, "V"), new RomanValue(4, "IV"), new RomanValue(1, "I") };
private static String int2roman(int n) {
int num = n;
@@ -66,7 +56,7 @@ class TextPaneSkinNumberedListView exten
}
private static String int2alpha(int n) {
- return (char)('A' + n - 1) + "";
+ return (char) ('A' + n - 1) + "";
}
public TextPaneSkinNumberedListView(NumberedList numberedList) {
@@ -77,7 +67,7 @@ class TextPaneSkinNumberedListView exten
protected void attach() {
super.attach();
- NumberedList numberedList = (NumberedList)getNode();
+ NumberedList numberedList = (NumberedList) getNode();
numberedList.getNumberedListListeners().add(this);
}
@@ -85,17 +75,17 @@ class TextPaneSkinNumberedListView exten
protected void detach() {
super.detach();
- NumberedList numberedList = (NumberedList)getNode();
+ NumberedList numberedList = (NumberedList) getNode();
numberedList.getNumberedListListeners().remove(this);
}
@Override
protected void childLayout(int breakWidth) {
- NumberedList numberedList = (NumberedList)getNode();
+ NumberedList numberedList = (NumberedList) getNode();
int index = 1;
for (TextPaneSkinNodeView nodeView : this) {
- TextPaneSkinListItemView listItemView = (TextPaneSkinListItemView)nodeView;
+ TextPaneSkinListItemView listItemView = (TextPaneSkinListItemView) nodeView;
switch (numberedList.getStyle()) {
case DECIMAL:
@@ -122,7 +112,7 @@ class TextPaneSkinNumberedListView exten
this.maxIndexTextWidth = 0;
for (TextPaneSkinNodeView nodeView : this) {
- TextPaneSkinListItemView listItemView = (TextPaneSkinListItemView)nodeView;
+ TextPaneSkinListItemView listItemView = (TextPaneSkinListItemView) nodeView;
this.maxIndexTextWidth = Math.max(this.maxIndexTextWidth,
listItemView.getIndexTextWidth());
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java Fri Oct 4 23:45:40 2013
@@ -44,6 +44,7 @@ class TextPaneSkinParagraphView extends
private static class RowSegment {
public TextPaneSkinNodeView nodeView;
public int offset;
+
public RowSegment(TextPaneSkinNodeView nodeView, int offset) {
this.nodeView = nodeView;
this.offset = offset;
@@ -67,20 +68,18 @@ class TextPaneSkinParagraphView extends
protected void childLayout(int breakWidth) {
// Break the views into multiple rows
- Paragraph paragraph = (Paragraph)getNode();
+ Paragraph paragraph = (Paragraph) getNode();
rows = new ArrayList<>();
int offset = 0;
ParagraphChildLayouter layouter = new ParagraphChildLayouter();
Row row = new Row();
for (TextPaneSkinNodeView nodeView : this) {
- nodeView.layout(Math.max(breakWidth - (row.width
- + PARAGRAPH_TERMINATOR_WIDTH), 0));
+ nodeView.layout(Math.max(breakWidth - (row.width + PARAGRAPH_TERMINATOR_WIDTH), 0));
int nodeViewWidth = nodeView.getWidth();
- if (row.width + nodeViewWidth > breakWidth
- && row.width > 0) {
+ if (row.width + nodeViewWidth > breakWidth && row.width > 0) {
// The view is too big to fit in the remaining space,
// and it is not the only view in this row
rows.add(row);
@@ -128,7 +127,7 @@ class TextPaneSkinParagraphView extends
// Recalculate terminator bounds
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
LineMetrics lm = getTextPaneSkin().getFont().getLineMetrics("", 0, 0, fontRenderContext);
- int terminatorHeight = (int)Math.ceil(lm.getHeight());
+ int terminatorHeight = (int) Math.ceil(lm.getHeight());
int terminatorY;
if (getCharacterCount() == 1) {
@@ -138,8 +137,8 @@ class TextPaneSkinParagraphView extends
terminatorY = layouter.rowY - terminatorHeight;
}
- terminatorBounds = new Bounds(layouter.x, terminatorY,
- PARAGRAPH_TERMINATOR_WIDTH, terminatorHeight);
+ terminatorBounds = new Bounds(layouter.x, terminatorY, PARAGRAPH_TERMINATOR_WIDTH,
+ terminatorHeight);
// Ensure that the paragraph is visible even when empty
layouter.paragraphWidth += terminatorBounds.width;
@@ -152,20 +151,18 @@ class TextPaneSkinParagraphView extends
public Dimensions getPreferredSize(int breakWidth) {
// Break the views into multiple rows
- Paragraph paragraph = (Paragraph)getNode();
+ Paragraph paragraph = (Paragraph) getNode();
ArrayList<Row> rowsLocal = new ArrayList<>();
int offset = 0;
ParagraphChildLayouter layouter = new ParagraphChildLayouter();
Row row = new Row();
for (TextPaneSkinNodeView nodeView : this) {
- nodeView.layout(Math.max(breakWidth - (row.width
- + PARAGRAPH_TERMINATOR_WIDTH), 0));
+ nodeView.layout(Math.max(breakWidth - (row.width + PARAGRAPH_TERMINATOR_WIDTH), 0));
int nodeViewWidth = nodeView.getWidth();
- if (row.width + nodeViewWidth > breakWidth
- && row.width > 0) {
+ if (row.width + nodeViewWidth > breakWidth && row.width > 0) {
// The view is too big to fit in the remaining space,
// and it is not the only view in this row
rowsLocal.add(row);
@@ -213,7 +210,7 @@ class TextPaneSkinParagraphView extends
// Recalculate terminator bounds
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
LineMetrics lm = getTextPaneSkin().getFont().getLineMetrics("", 0, 0, fontRenderContext);
- int terminatorHeight = (int)Math.ceil(lm.getHeight());
+ int terminatorHeight = (int) Math.ceil(lm.getHeight());
int terminatorY;
if (getCharacterCount() == 1) {
@@ -234,7 +231,8 @@ class TextPaneSkinParagraphView extends
}
private static TextPaneSkinNodeView getNext(TextPaneSkinNodeView child) {
- // Using instanceof checks because there is no nice place in the hierarchy
+ // Using instanceof checks because there is no nice place in the
+ // hierarchy
// to put an abstract method
if (child instanceof TextPaneSkinSpanView) {
return ((TextPaneSkinSpanView) child).getNext();
@@ -246,9 +244,9 @@ class TextPaneSkinParagraphView extends
}
/**
- * The layout process and the line breaking process are interleaved,
- * because tab stops mean that we need to calculate X and width for each
- * segment before moving on to the next segment.
+ * The layout process and the line breaking process are interleaved, because
+ * tab stops mean that we need to calculate X and width for each segment
+ * before moving on to the next segment.
*/
private static class ParagraphChildLayouter {
// Add the row views to this view, lay out, and calculate height
@@ -290,7 +288,7 @@ class TextPaneSkinParagraphView extends
rowY += row.height;
}
- public void end(Paragraph paragraph, ArrayList<Row> rows) {
+ public void end(Paragraph paragraph, ArrayList<Row> rows) {
// calculate paragraph width
for (Row row : rows) {
paragraphWidth = Math.max(paragraphWidth, row.width);
@@ -322,14 +320,16 @@ class TextPaneSkinParagraphView extends
for (int i = 0, n = rows.getLength(); i < n; i++) {
Row row = rows.get(i);
for (RowSegment segment : row.rowSegments) {
- segment.nodeView.setSkinLocation(skinX + segment.nodeView.getX(), skinY + segment.nodeView.getY());
+ segment.nodeView.setSkinLocation(skinX + segment.nodeView.getX(), skinY
+ + segment.nodeView.getY());
}
}
}
@Override
public void paint(Graphics2D graphics) {
- // The default paint() method paints the document children, but because of row-splitting,
+ // The default paint() method paints the document children, but because
+ // of row-splitting,
// the children we want to paint are not the same.
// Determine the paint bounds
@@ -356,14 +356,14 @@ class TextPaneSkinParagraphView extends
for (int i = 0; i < n; i++) {
Row row = rows.get(i);
- if (y >= row.y
- && y < row.y + row.height) {
+ if (y >= row.y && y < row.y + row.height) {
if (x < row.x) {
RowSegment firstNodeSegment = row.rowSegments.get(0);
offset = firstNodeSegment.offset;
} else if (x > row.x + row.width - 1) {
RowSegment lastNodeSegment = row.rowSegments.get(row.rowSegments.getLength() - 1);
- offset = lastNodeSegment.offset + lastNodeSegment.nodeView.getCharacterCount();
+ offset = lastNodeSegment.offset
+ + lastNodeSegment.nodeView.getCharacterCount();
if (offset < getCharacterCount() - 1) {
offset--;
@@ -373,7 +373,8 @@ class TextPaneSkinParagraphView extends
Bounds nodeViewBounds = segment.nodeView.getBounds();
if (nodeViewBounds.contains(x, y)) {
- offset = segment.nodeView.getInsertionPoint(x - segment.nodeView.getX(), y - segment.nodeView.getY())
+ offset = segment.nodeView.getInsertionPoint(
+ x - segment.nodeView.getX(), y - segment.nodeView.getY())
+ segment.offset;
break;
}
@@ -397,8 +398,7 @@ class TextPaneSkinParagraphView extends
int offset = -1;
int n = rows.getLength();
- if (n == 0
- && from == -1) {
+ if (n == 0 && from == -1) {
// There are no rows; select the terminator character
offset = 0;
} else {
@@ -416,7 +416,8 @@ class TextPaneSkinParagraphView extends
RowSegment firstNodeSegment = row.rowSegments.get(0);
RowSegment lastNodeSegment = row.rowSegments.get(row.rowSegments.getLength() - 1);
if (from >= firstNodeSegment.offset
- && from < lastNodeSegment.offset + lastNodeSegment.nodeView.getCharacterCount()) {
+ && from < lastNodeSegment.offset
+ + lastNodeSegment.nodeView.getCharacterCount()) {
break;
}
@@ -432,23 +433,23 @@ class TextPaneSkinParagraphView extends
i--;
}
- if (i >= 0
- && i < n) {
- // Find the node view that contains x and get the insertion point from it
+ if (i >= 0 && i < n) {
+ // Find the node view that contains x and get the insertion
+ // point from it
Row row = rows.get(i);
for (RowSegment segment : row.rowSegments) {
Bounds bounds = segment.nodeView.getBounds();
- if (x >= bounds.x
- && x < bounds.x + bounds.width) {
- offset = segment.nodeView.getNextInsertionPoint(x - segment.nodeView.getX(), -1, direction)
- + segment.offset;
+ if (x >= bounds.x && x < bounds.x + bounds.width) {
+ offset = segment.nodeView.getNextInsertionPoint(
+ x - segment.nodeView.getX(), -1, direction) + segment.offset;
break;
}
}
if (offset == -1) {
- // No node view contained the x position; move to the end of the row
+ // No node view contained the x position; move to the end of
+ // the row
RowSegment lastNodeSegment = row.rowSegments.get(row.rowSegments.getLength() - 1);
offset = lastNodeSegment.offset + lastNodeSegment.nodeView.getCharacterCount();
@@ -475,7 +476,8 @@ class TextPaneSkinParagraphView extends
RowSegment lastNodeSegment = row.rowSegments.get(row.rowSegments.getLength() - 1);
if (offset >= firstNodeSegment.offset
- && offset < lastNodeSegment.offset + firstNodeSegment.nodeView.getCharacterCount()) {
+ && offset < lastNodeSegment.offset
+ + firstNodeSegment.nodeView.getCharacterCount()) {
rowIndex = i;
break;
}
@@ -504,12 +506,13 @@ class TextPaneSkinParagraphView extends
int nodeViewOffset = segment.offset;
int characterCount = segment.nodeView.getCharacterCount();
- if (offset >= nodeViewOffset
- && offset < nodeViewOffset + characterCount) {
- characterBounds = segment.nodeView.getCharacterBounds(offset - nodeViewOffset);
+ if (offset >= nodeViewOffset && offset < nodeViewOffset + characterCount) {
+ characterBounds = segment.nodeView.getCharacterBounds(offset
+ - nodeViewOffset);
if (characterBounds != null) {
- characterBounds = characterBounds.translate(segment.nodeView.getX(), segment.nodeView.getY());
+ characterBounds = characterBounds.translate(
+ segment.nodeView.getX(), segment.nodeView.getY());
}
break;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinSpanView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinSpanView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinSpanView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinSpanView.java Fri Oct 4 23:45:40 2013
@@ -33,7 +33,7 @@ class TextPaneSkinSpanView extends TextP
protected void attach() {
super.attach();
- TextSpan span = (TextSpan)getNode();
+ TextSpan span = (TextSpan) getNode();
// for now, assume that span contains at most one child, and
// that child is a TextNode
@@ -75,7 +75,8 @@ class TextPaneSkinSpanView extends TextP
}
/**
- * Used by TextPaneSkinParagraphView when it breaks child nodes into multiple views.
+ * Used by TextPaneSkinParagraphView when it breaks child nodes into
+ * multiple views.
*/
public TextPaneSkinTextNodeView getNext() {
if (getLength() == 0) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinTextNodeView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinTextNodeView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinTextNodeView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinTextNodeView.java Fri Oct 4 23:45:40 2013
@@ -60,7 +60,7 @@ class TextPaneSkinTextNodeView extends T
protected void attach() {
super.attach();
- TextNode textNode = (TextNode)getNode();
+ TextNode textNode = (TextNode) getNode();
textNode.getTextNodeListeners().add(this);
}
@@ -68,7 +68,7 @@ class TextPaneSkinTextNodeView extends T
protected void detach() {
super.detach();
- TextNode textNode = (TextNode)getNode();
+ TextNode textNode = (TextNode) getNode();
textNode.getTextNodeListeners().remove(this);
}
@@ -83,24 +83,25 @@ class TextPaneSkinTextNodeView extends T
@Override
protected void childLayout(int breakWidth) {
- TextNode textNode = (TextNode)getNode();
+ TextNode textNode = (TextNode) getNode();
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
- CharSequenceCharacterIterator ci = new CharSequenceCharacterIterator(textNode.getCharacters(), start);
+ CharSequenceCharacterIterator ci = new CharSequenceCharacterIterator(
+ textNode.getCharacters(), start);
float lineWidth = 0;
int lastWhitespaceIndex = -1;
Font effectiveFont = getEffectiveFont();
char c = ci.first();
- while (c != CharacterIterator.DONE
- && lineWidth < breakWidth) {
+ while (c != CharacterIterator.DONE && lineWidth < breakWidth) {
if (Character.isWhitespace(c)) {
lastWhitespaceIndex = ci.getIndex();
}
int i = ci.getIndex();
- Rectangle2D characterBounds = effectiveFont.getStringBounds(ci, i, i + 1, fontRenderContext);
+ Rectangle2D characterBounds = effectiveFont.getStringBounds(ci, i, i + 1,
+ fontRenderContext);
lineWidth += characterBounds.getWidth();
c = ci.current();
@@ -137,35 +138,36 @@ class TextPaneSkinTextNodeView extends T
next.setParent(getParent());
} else {
length = ci.getEndIndex() - start;
- // set to null in case this node used to be broken across multiple, but is no longer
+ // set to null in case this node used to be broken across multiple,
+ // but is no longer
next = null;
}
Rectangle2D textBounds = glyphVector.getLogicalBounds();
- setSize((int)Math.ceil(textBounds.getWidth()),
- (int)Math.ceil(textBounds.getHeight()));
+ setSize((int) Math.ceil(textBounds.getWidth()), (int) Math.ceil(textBounds.getHeight()));
}
@Override
public Dimensions getPreferredSize(int breakWidth) {
- TextNode textNode = (TextNode)getNode();
+ TextNode textNode = (TextNode) getNode();
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
- CharSequenceCharacterIterator ci = new CharSequenceCharacterIterator(textNode.getCharacters(), start);
+ CharSequenceCharacterIterator ci = new CharSequenceCharacterIterator(
+ textNode.getCharacters(), start);
float lineWidth = 0;
int lastWhitespaceIndex = -1;
Font effectiveFont = getEffectiveFont();
char c = ci.first();
- while (c != CharacterIterator.DONE
- && lineWidth < breakWidth) {
+ while (c != CharacterIterator.DONE && lineWidth < breakWidth) {
if (Character.isWhitespace(c)) {
lastWhitespaceIndex = ci.getIndex();
}
int i = ci.getIndex();
- Rectangle2D characterBounds = effectiveFont.getStringBounds(ci, i, i + 1, fontRenderContext);
+ Rectangle2D characterBounds = effectiveFont.getStringBounds(ci, i, i + 1,
+ fontRenderContext);
lineWidth += characterBounds.getWidth();
c = ci.current();
@@ -197,8 +199,8 @@ class TextPaneSkinTextNodeView extends T
new CharSequenceCharacterIterator(textNode.getCharacters(), start, end));
Rectangle2D textBounds = glyphVectorLocal.getLogicalBounds();
- return new Dimensions((int)Math.ceil(textBounds.getWidth()),
- (int)Math.ceil(textBounds.getHeight()));
+ return new Dimensions((int) Math.ceil(textBounds.getWidth()),
+ (int) Math.ceil(textBounds.getHeight()));
}
@Override
@@ -217,7 +219,7 @@ class TextPaneSkinTextNodeView extends T
@Override
public void paint(Graphics2D graphics) {
if (glyphVector != null) {
- TextPane textPane = (TextPane)getTextPaneSkin().getComponent();
+ TextPane textPane = (TextPane) getTextPaneSkin().getComponent();
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
LineMetrics lm = getEffectiveFont().getLineMetrics("", fontRenderContext);
@@ -239,12 +241,12 @@ class TextPaneSkinTextNodeView extends T
int width = getWidth();
int height = getHeight();
- if (selectionLength > 0
- && characterRange.intersects(selectionRange)) {
+ if (selectionLength > 0 && characterRange.intersects(selectionRange)) {
// Determine the selection bounds
int x0;
if (selectionRange.start > characterRange.start) {
- Bounds leadingSelectionBounds = getCharacterBounds(selectionRange.start - documentOffset);
+ Bounds leadingSelectionBounds = getCharacterBounds(selectionRange.start
+ - documentOffset);
x0 = leadingSelectionBounds.x;
} else {
x0 = 0;
@@ -252,7 +254,8 @@ class TextPaneSkinTextNodeView extends T
int x1;
if (selectionRange.end < characterRange.end) {
- Bounds trailingSelectionBounds = getCharacterBounds(selectionRange.end - documentOffset);
+ Bounds trailingSelectionBounds = getCharacterBounds(selectionRange.end
+ - documentOffset);
x1 = trailingSelectionBounds.x + trailingSelectionBounds.width;
} else {
x1 = width;
@@ -265,7 +268,7 @@ class TextPaneSkinTextNodeView extends T
unselectedArea.add(new Area(new Rectangle(0, 0, width, height)));
unselectedArea.subtract(new Area(selection));
- Graphics2D textGraphics = (Graphics2D)graphics.create();
+ Graphics2D textGraphics = (Graphics2D) graphics.create();
textGraphics.setColor(getEffectiveForegroundColor());
textGraphics.clip(unselectedArea);
textGraphics.drawGlyphVector(glyphVector, 0, ascent);
@@ -285,9 +288,9 @@ class TextPaneSkinTextNodeView extends T
selectionColor = getTextPaneSkin().getInactiveSelectionColor();
}
- Graphics2D selectedTextGraphics = (Graphics2D)graphics.create();
- selectedTextGraphics.setColor(textPane.isFocused() &&
- textPane.isEditable() ? selectionColor : getTextPaneSkin().getInactiveSelectionColor());
+ Graphics2D selectedTextGraphics = (Graphics2D) graphics.create();
+ selectedTextGraphics.setColor(textPane.isFocused() && textPane.isEditable() ? selectionColor
+ : getTextPaneSkin().getInactiveSelectionColor());
selectedTextGraphics.clip(selection.getBounds());
selectedTextGraphics.drawGlyphVector(glyphVector, 0, ascent);
if (underline) {
@@ -322,7 +325,8 @@ class TextPaneSkinTextNodeView extends T
}
/**
- * Used by TextPaneSkinParagraphView when it breaks child nodes into multiple views.
+ * Used by TextPaneSkinParagraphView when it breaks child nodes into
+ * multiple views.
*/
public TextPaneSkinNodeView getNext() {
return next;
@@ -343,9 +347,9 @@ class TextPaneSkinTextNodeView extends T
if (glyphBounds.contains(x, y - ascent)) {
Rectangle2D glyphBounds2D = glyphBounds.getBounds2D();
- if (x - glyphBounds2D.getX() > glyphBounds2D.getWidth() / 2
- && i < n - 1) {
- // The user clicked on the right half of the character; select
+ if (x - glyphBounds2D.getX() > glyphBounds2D.getWidth() / 2 && i < n - 1) {
+ // The user clicked on the right half of the character;
+ // select
// the next character
i++;
}
@@ -435,13 +439,13 @@ class TextPaneSkinTextNodeView extends T
Shape glyphBounds = glyphVector.getGlyphLogicalBounds(i);
Rectangle2D glyphBounds2D = glyphBounds.getBounds2D();
- float glyphX = (float)glyphBounds2D.getX();
- float glyphWidth = (float)glyphBounds2D.getWidth();
+ float glyphX = (float) glyphBounds2D.getX();
+ float glyphWidth = (float) glyphBounds2D.getWidth();
if (x >= glyphX && x < glyphX + glyphWidth) {
- if (x - glyphX > glyphWidth / 2
- && i < n - 1) {
- // The x position falls within the right half of the character;
+ if (x - glyphX > glyphWidth / 2 && i < n - 1) {
+ // The x position falls within the right half of the
+ // character;
// select the next character
i++;
}
@@ -472,8 +476,8 @@ class TextPaneSkinTextNodeView extends T
Shape glyphBounds = glyphVector.getGlyphLogicalBounds(offset);
Rectangle2D glyphBounds2D = glyphBounds.getBounds2D();
- return new Bounds((int)Math.floor(glyphBounds2D.getX()), 0,
- (int)Math.ceil(glyphBounds2D.getWidth()), getHeight());
+ return new Bounds((int) Math.floor(glyphBounds2D.getX()), 0,
+ (int) Math.ceil(glyphBounds2D.getWidth()), getHeight());
}
@Override
@@ -488,7 +492,7 @@ class TextPaneSkinTextNodeView extends T
@Override
public String toString() {
- TextNode textNode = (TextNode)getNode();
+ TextNode textNode = (TextNode) getNode();
String text = textNode.getText();
return "[" + text.substring(start, start + length) + "]";
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinVerticalElementView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinVerticalElementView.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinVerticalElementView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinVerticalElementView.java Fri Oct 4 23:45:40 2013
@@ -22,7 +22,8 @@ import org.apache.pivot.wtk.TextPane;
import org.apache.pivot.wtk.text.Element;
/**
- * Some of the classes in the text hierarchy are very similar in layout ie. they lay their children out vertically. This class groups that functionality.
+ * Some of the classes in the text hierarchy are very similar in layout ie. they
+ * lay their children out vertically. This class groups that functionality.
*/
abstract class TextPaneSkinVerticalElementView extends TextPaneSkinElementView {
@@ -32,16 +33,25 @@ abstract class TextPaneSkinVerticalEleme
@Override
protected void childLayout(int breakWidth) {
- // TODO At some point, we may want to optimize this method by deferring layout of
- // non-visible views. If so, we should not recycle views but rather recreate them
- // (as is done in ParagraphView). This way, we avoid thread contention over the
- // existing views (e.g. trying to paint one while modifying its size/location, etc.).
- // Any invalid node views are simply replaced (in the queued callback, when the
- // thread has finished processing the new ones). This allows the definition of
- // validate() to remain as-is. Of course, if we redefine NodeView to implement
+ // TODO At some point, we may want to optimize this method by deferring
+ // layout of
+ // non-visible views. If so, we should not recycle views but rather
+ // recreate them
+ // (as is done in ParagraphView). This way, we avoid thread contention
+ // over the
+ // existing views (e.g. trying to paint one while modifying its
+ // size/location, etc.).
+ // Any invalid node views are simply replaced (in the queued callback,
+ // when the
+ // thread has finished processing the new ones). This allows the
+ // definition of
+ // validate() to remain as-is. Of course, if we redefine NodeView to
+ // implement
// ConstrainedVisual, this may no longer be an issue.
- // Note that, if anything happens to invalidate the existence of the new views before
- // they are added to the document view, we need to make sure they are disposed (i.e.
+ // Note that, if anything happens to invalidate the existence of the new
+ // views before
+ // they are added to the document view, we need to make sure they are
+ // disposed (i.e.
// detached).
int width = 0;
@@ -90,8 +100,7 @@ abstract class TextPaneSkinVerticalEleme
TextPaneSkinNodeView nodeView = get(i);
Bounds nodeViewBounds = nodeView.getBounds();
- if (y >= nodeViewBounds.y
- && y < nodeViewBounds.y + nodeViewBounds.height) {
+ if (y >= nodeViewBounds.y && y < nodeViewBounds.y + nodeViewBounds.height) {
offset = nodeView.getInsertionPoint(x - nodeView.getX(), y - nodeView.getY())
+ nodeView.getOffset();
break;
@@ -124,8 +133,7 @@ abstract class TextPaneSkinVerticalEleme
int nodeViewOffset = nodeView.getOffset();
int characterCount = nodeView.getCharacterCount();
- if (from >= nodeViewOffset
- && from < nodeViewOffset + characterCount) {
+ if (from >= nodeViewOffset && from < nodeViewOffset + characterCount) {
break;
}
@@ -146,7 +154,8 @@ abstract class TextPaneSkinVerticalEleme
}
if (nodeView != null) {
- offset = nodeView.getNextInsertionPoint(x - nodeView.getX(), -1, direction);
+ offset = nodeView.getNextInsertionPoint(x - nodeView.getX(), -1,
+ direction);
}
}
@@ -168,8 +177,7 @@ abstract class TextPaneSkinVerticalEleme
int nodeViewOffset = nodeView.getOffset();
int characterCount = nodeView.getCharacterCount();
- if (offset >= nodeViewOffset
- && offset < nodeViewOffset + characterCount) {
+ if (offset >= nodeViewOffset && offset < nodeViewOffset + characterCount) {
rowIndex += nodeView.getRowAt(offset - nodeView.getOffset());
break;
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/VFSBrowserSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/VFSBrowserSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/VFSBrowserSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/VFSBrowserSkin.java Fri Oct 4 23:45:40 2013
@@ -19,18 +19,17 @@ package org.apache.pivot.wtk.skin;
import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.VFSBrowser;
import org.apache.pivot.wtk.VFSBrowserListener;
-import org.apache.pivot.wtk.skin.ContainerSkin;
/**
* Abstract base class for Commons VFS browser skins.
*/
-public abstract class VFSBrowserSkin extends ContainerSkin
- implements VFSBrowser.Skin, VFSBrowserListener {
+public abstract class VFSBrowserSkin extends ContainerSkin implements VFSBrowser.Skin,
+ VFSBrowserListener {
@Override
public void install(Component component) {
super.install(component);
- VFSBrowser fileBrowser = (VFSBrowser)component;
+ VFSBrowser fileBrowser = (VFSBrowser) component;
fileBrowser.getFileBrowserListeners().add(this);
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/WindowSkin.java Fri Oct 4 23:45:40 2013
@@ -36,22 +36,23 @@ import org.apache.pivot.wtk.media.Image;
/**
* Window skin.
*/
-public class WindowSkin extends ContainerSkin implements Window.Skin,
- WindowListener, WindowStateListener {
+public class WindowSkin extends ContainerSkin implements Window.Skin, WindowListener,
+ WindowStateListener {
/**
* Focus traversal policy that always returns the window's content. This
* ensures that focus does not traverse out of the window.
*/
public static class WindowFocusTraversalPolicy implements FocusTraversalPolicy {
@Override
- public Component getNextComponent(Container container, Component component, FocusTraversalDirection direction) {
+ public Component getNextComponent(Container container, Component component,
+ FocusTraversalDirection direction) {
assert (container instanceof Window) : "container is not a Window";
if (direction == null) {
throw new IllegalArgumentException("direction is null.");
}
- Window window = (Window)container;
+ Window window = (Window) container;
return window.getContent();
}
@@ -65,7 +66,7 @@ public class WindowSkin extends Containe
public void install(Component component) {
super.install(component);
- Window window = (Window)component;
+ Window window = (Window) component;
window.getWindowListeners().add(this);
window.getWindowStateListeners().add(this);
@@ -74,7 +75,7 @@ public class WindowSkin extends Containe
@Override
public int getPreferredWidth(int height) {
- Window window = (Window)getComponent();
+ Window window = (Window) getComponent();
Component content = window.getContent();
return (content != null) ? content.getPreferredWidth(height) : 0;
@@ -82,7 +83,7 @@ public class WindowSkin extends Containe
@Override
public int getPreferredHeight(int width) {
- Window window = (Window)getComponent();
+ Window window = (Window) getComponent();
Component content = window.getContent();
return (content != null) ? content.getPreferredHeight(width) : 0;
@@ -90,7 +91,7 @@ public class WindowSkin extends Containe
@Override
public Dimensions getPreferredSize() {
- Window window = (Window)getComponent();
+ Window window = (Window) getComponent();
Component content = window.getContent();
return (content != null) ? content.getPreferredSize() : new Dimensions(0, 0);
@@ -98,7 +99,7 @@ public class WindowSkin extends Containe
@Override
public void layout() {
- Window window = (Window)getComponent();
+ Window window = (Window) getComponent();
Component content = window.getContent();
if (content != null) {
@@ -115,7 +116,7 @@ public class WindowSkin extends Containe
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
boolean consumed = super.mouseDown(container, button, x, y);
- Window window = (Window)container;
+ Window window = (Window) container;
window.moveToFront();
return consumed;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Block.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Block.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Block.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Block.java Fri Oct 4 23:45:40 2013
@@ -20,16 +20,16 @@ import org.apache.pivot.util.ListenerLis
import org.apache.pivot.wtk.HorizontalAlignment;
/**
- * Abstract base class for block elements.
- * <p>
- * TODO Add margin, and line spacing properties.
+ * Abstract base class for block elements. <p> TODO Add margin, and line spacing
+ * properties.
*/
public abstract class Block extends Element {
private static class BlockListenerList extends ListenerList<BlockListener> implements
BlockListener {
@Override
- public void horizontalAlignmentChanged(Block block, HorizontalAlignment previousHorizontalAlignment) {
+ public void horizontalAlignmentChanged(Block block,
+ HorizontalAlignment previousHorizontalAlignment) {
for (BlockListener listener : this) {
listener.horizontalAlignmentChanged(block, previousHorizontalAlignment);
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BlockListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BlockListener.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BlockListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BlockListener.java Fri Oct 4 23:45:40 2013
@@ -33,7 +33,7 @@ public interface BlockListener {
/**
* Called when the horizontal alignment has changed.
- *
+ *
* @param block
* @param previousHorizontalAlignment
*/
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BulletedListListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BulletedListListener.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BulletedListListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/text/BulletedListListener.java Fri Oct 4 23:45:40 2013
@@ -16,7 +16,6 @@
*/
package org.apache.pivot.wtk.text;
-
/**
* BulletedList listener interface.
*/
@@ -31,7 +30,7 @@ public interface BulletedListListener {
/**
* Called when the list style has changed.
- *
+ *
* @param bulletedList
* @param previousStyle
*/