Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Thienel2016-03-20 09:15:22 -0400
committerFlorian Thienel2016-03-20 09:15:22 -0400
commitefef91642f59a72e7eb091e7d0b3a5dd83c211d0 (patch)
treea51ce65add755eca75817cce983ef8837f262d35
parent184d6ccd87d32d75cf9a2ae11eccea348b4acb8b (diff)
downloadorg.eclipse.mylyn.docs.vex-efef91642f59a72e7eb091e7d0b3a5dd83c211d0.tar.gz
org.eclipse.mylyn.docs.vex-efef91642f59a72e7eb091e7d0b3a5dd83c211d0.tar.xz
org.eclipse.mylyn.docs.vex-efef91642f59a72e7eb091e7d0b3a5dd83c211d0.zip
separate layout related to outside bullets
Signed-off-by: Florian Thienel <florian@thienel.org>
-rw-r--r--org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/ListItem.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/ListItem.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/ListItem.java
index ba3bd4df..0e0eef26 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/ListItem.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/boxes/ListItem.java
@@ -111,9 +111,6 @@ public class ListItem extends BaseBox implements IStructuralBox, IDecoratorBox<I
public void setBulletAlign(final TextAlign bulletAlign) {
this.bulletAlign = bulletAlign;
- if (bulletContainer != null) {
- bulletContainer.setTextAlign(bulletAlign);
- }
}
public TextAlign getBulletAlign() {
@@ -122,14 +119,7 @@ public class ListItem extends BaseBox implements IStructuralBox, IDecoratorBox<I
public void setBullet(final IInlineBox bullet) {
this.bullet = bullet;
- if (bullet == null) {
- bulletContainer = null;
- } else {
- bulletContainer = new Paragraph();
- bulletContainer.setParent(this);
- bulletContainer.setTextAlign(bulletAlign);
- bulletContainer.appendChild(bullet);
- }
+ bulletContainer = null;
}
public IInlineBox getBullet() {
@@ -148,6 +138,19 @@ public class ListItem extends BaseBox implements IStructuralBox, IDecoratorBox<I
@Override
public void layout(final Graphics graphics) {
+ layoutWithOutsideBullet(graphics);
+
+ height = Math.max(getBulletHeight(), getComponentHeight());
+ }
+
+ private void layoutWithOutsideBullet(final Graphics graphics) {
+ if (bullet != null && bulletContainer == null) {
+ bulletContainer = new Paragraph();
+ bulletContainer.setParent(this);
+ bulletContainer.setTextAlign(bulletAlign);
+ bulletContainer.appendChild(bullet);
+ }
+
if (bulletContainer != null) {
bulletContainer.setWidth(bulletWidth);
bulletContainer.layout(graphics);
@@ -178,8 +181,6 @@ public class ListItem extends BaseBox implements IStructuralBox, IDecoratorBox<I
if (component != null) {
component.setPosition(componentTop, width - component.getWidth());
}
-
- height = Math.max(getBulletHeight(), getComponentHeight());
}
private static int findTopBaselineRelativeToParent(final IStructuralBox parent) {
@@ -254,10 +255,10 @@ public class ListItem extends BaseBox implements IStructuralBox, IDecoratorBox<I
}
private int getBulletHeight() {
- if (bullet == null) {
+ if (bulletContainer == null) {
return 0;
}
- return bullet.getHeight();
+ return bulletContainer.getHeight();
}
private int getComponentHeight() {

Back to the top