Skip to content
Snippets Groups Projects
Commit 180e02d8 authored by Lukas Ladenberger's avatar Lukas Ladenberger
Browse files

better handling of columns in tables

parent d7cad032
No related branches found
No related tags found
No related merge requests found
Showing
with 39 additions and 25 deletions
de.bmotionstudio.gef.editor/icons/eclipse16/updated_co.gif

105 B

......@@ -25,6 +25,7 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
public static final String IMG_ICON_CONNECTION24 = "icon_connection24";
public static final String IMG_ICON_NEW_WIZ = "icon_new_wiz";
public static final String IMG_ICON_DELETE_EDIT = "icon_delete_edit";
public static final String IMG_ICON_TR_UP = "icon_tr_up";
public static final String IMG_ICON_JPG = "icon_jpg";
public static final String IMG_ICON_GIF = "icon_gif";
......@@ -66,6 +67,10 @@ public class EditorImageRegistry implements IBMotionStudioImageRegistry {
BMotionStudioImage.registerImage(IMG_ICON_DELETE_EDIT,
"org.eclipse.ui", "$nl$/icons/full/etool16/delete_edit.gif");
BMotionStudioImage
.registerImage(IMG_ICON_TR_UP, BMotionEditorPlugin.PLUGIN_ID,
"icons/eclipse16/updated_co.gif");
BMotionStudioImage.registerImage(IMG_ICON_JPG,
BMotionEditorPlugin.PLUGIN_ID, "icons/icon_jpg.gif");
BMotionStudioImage.registerImage(IMG_ICON_GIF,
......
......@@ -32,6 +32,7 @@ public class TableCellFigure extends AbstractTableFigure {
Color foregroundColor = getForegroundColor();
if (foregroundColor != null)
g.setForegroundColor(foregroundColor);
// Bottom cell line
g.drawLine(r.x, r.y, r.x + r.width, r.y);
}
......
......@@ -9,6 +9,7 @@ public class TableColumnFigure extends AbstractTableFigure {
public TableColumnFigure() {
ToolbarLayout toolbarLayout = new ToolbarLayout();
toolbarLayout.setSpacing(0);
setLayoutManager(toolbarLayout);
setOpaque(true);
}
......@@ -19,9 +20,12 @@ public class TableColumnFigure extends AbstractTableFigure {
Color foregroundColor = getForegroundColor();
if (foregroundColor != null)
g.setForegroundColor(foregroundColor);
g.drawLine(r.x, r.y, r.x + r.width, r.y);
g.drawLine(r.x, r.y, r.x, r.y + r.height - 1);
g.drawLine(r.x, r.y + r.height - 1, r.x + r.width, r.y + r.height - 1);
// g.drawLine(r.x, r.y, r.x + r.width, r.y);
// Left line
g.drawLine(r.x, r.y, r.x, r.y + r.height - 15);
// Bottom line
g.drawLine(r.x, r.y + r.height - 15, r.x + r.width, r.y + r.height - 15);
super.paintBorder(g);
}
......
......@@ -24,8 +24,9 @@ public class TableFigure extends AbstractTableFigure {
protected void paintBorder(Graphics g) {
Rectangle r = getClientArea();
g.setForegroundColor(getForegroundColor());
// Right table border line
g.drawLine(r.x + r.width - 1, r.y, r.x + r.width - 1, r.y + r.height
- 1);
- 15);
super.paintBorder(g);
}
......
package de.bmotionstudio.gef.editor.observer;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import de.bmotionstudio.gef.editor.Animation;
import de.bmotionstudio.gef.editor.AttributeConstants;
......@@ -21,10 +17,6 @@ public class TableObserver extends Observer {
private String predicate;
public static List<String> split(String input, char tempReplacement) {
while (input.matches(".*\"[^\\{\\}]+,[^\\{\\}]+.*")) {
input = input.replaceAll("([^\\{\\}]+),([^\\{\\}]+)", "$1"
+ tempReplacement + "$2");
}
while (input.matches(".*\\{[^\\}]+,[^\\}]+\\}.*")) {
input = input.replaceAll("(\\{[^\\}]+),([^\\}]+\\})", "$1"
+ tempReplacement + "$2");
......@@ -38,10 +30,6 @@ public class TableObserver extends Observer {
}
public static List<String> split2(String input, char tempReplacement) {
while (input.matches(".*\"[^\\(\\)]+\\|->[^\\(\\)]+.*")) {
input = input.replaceAll("(\"[^\\(\\)]+)\\|->([^\\(\\)]+)", "$1"
+ tempReplacement + "$2");
}
while (input.matches(".*\\([^\\)]+\\|->[^\\)]+\\).*")) {
input = input.replaceAll("(\\([^\\)]+)\\|->([^\\)]+\\))", "$1"
+ tempReplacement + "$2");
......@@ -135,12 +123,13 @@ public class TableObserver extends Observer {
}
private Iterable<MatchResult> findMatches(String pattern, CharSequence s) {
List<MatchResult> results = new ArrayList<MatchResult>();
for (Matcher m = Pattern.compile(pattern).matcher(s); m.find();)
results.add(m.toMatchResult());
return results;
}
// private Iterable<MatchResult> findMatches(String pattern, CharSequence s)
// {
// List<MatchResult> results = new ArrayList<MatchResult>();
// for (Matcher m = Pattern.compile(pattern).matcher(s); m.find();)
// results.add(m.toMatchResult());
// return results;
// }
public void setExpression(String expression) {
this.expression = expression;
......
......@@ -30,6 +30,7 @@ public class BTableCellPart extends AppAbstractEditPart {
installEditPolicy(EditPolicy.NODE_ROLE, new RenamePolicy());
}
@Override
protected void prepareRunPolicies() {
}
......
......@@ -4,10 +4,13 @@ import java.beans.PropertyChangeEvent;
import java.util.List;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.gef.EditPolicy;
import org.eclipse.swt.graphics.RGB;
import de.bmotionstudio.gef.editor.AttributeConstants;
import de.bmotionstudio.gef.editor.BMotionStudioImage;
import de.bmotionstudio.gef.editor.EditorImageRegistry;
import de.bmotionstudio.gef.editor.editpolicy.BMotionNodeEditPolicy;
import de.bmotionstudio.gef.editor.editpolicy.BMotionStudioFlowEditPolicy;
import de.bmotionstudio.gef.editor.figure.TableColumnFigure;
......@@ -17,7 +20,15 @@ public class BTableColumnPart extends AppAbstractEditPart {
@Override
protected IFigure createEditFigure() {
return new TableColumnFigure();
TableColumnFigure tableColumnFigure = new TableColumnFigure();
Label figure = new Label();
figure.setOpaque(true);
tableColumnFigure.add(figure);
if (!isRunning()) {
figure.setIcon(BMotionStudioImage
.getImage(EditorImageRegistry.IMG_ICON_TR_UP));
}
return tableColumnFigure;
}
@Override
......
......@@ -54,7 +54,9 @@ public class BTablePart extends AppAbstractEditPart {
figure.getParent().setConstraint(
figure,
new Rectangle(control.getLocation().x, control.getLocation().y,
width + 1, (rows * 20) + 1));
width + 1, (rows * 20) + 15));
// super.refreshEditLayout(figure, control);
}
......@@ -93,7 +95,7 @@ public class BTablePart extends AppAbstractEditPart {
BTableColumn bTableColumn = new BTableColumn(
model.getVisualization());
CreateCommand cmd = new CreateCommand(bTableColumn, model);
cmd.setLayout(new Rectangle(0, 0, 50, 25));
// cmd.setLayout(new Rectangle(0, 0, 50, 40));
cmd.execute();
Integer numberOfRows = Integer.valueOf(model.getAttributeValue(
AttributeConstants.ATTRIBUTE_ROWS).toString());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment