提交 346f87ea 编写于 作者: S serge-rider

ERD colors customization

上级 1edd0c54
......@@ -32,58 +32,54 @@ import java.util.List;
/**
* Figure used to hold the column labels
*
* @author Serge Rider
*/
public class AttributeListFigure extends Figure
{
public class AttributeListFigure extends Figure {
public AttributeListFigure(ERDEntity entity, boolean key)
{
GridLayout layout = new GridLayout(2, false);
layout.verticalSpacing = 3;
layout.marginHeight = 0;
layout.marginWidth = 0;
public AttributeListFigure(ERDEntity entity, boolean key) {
GridLayout layout = new GridLayout(2, false);
layout.verticalSpacing = 3;
layout.marginHeight = 0;
layout.marginWidth = 0;
/*
FlowLayout layout = new FlowLayout(false);
FlowLayout layout = new FlowLayout(false);
layout.setMinorAlignment(FlowLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(true);
layout.setMinorSpacing(2);
*/
setLayoutManager(layout);
setBorder(new ColumnFigureBorder());
ColorRegistry colorRegistry = UIUtils.getColorRegistry();
setLayoutManager(layout);
setBorder(new ColumnFigureBorder());
ColorRegistry colorRegistry = UIUtils.getColorRegistry();
setBackgroundColor(colorRegistry.get(ERDConstants.COLOR_ERD_ATTR_BACKGROUND));
setForegroundColor(colorRegistry.get(ERDConstants.COLOR_ERD_ATTR_FOREGROUND));
setForegroundColor(colorRegistry.get(ERDConstants.COLOR_ERD_ATTR_FOREGROUND));
setOpaque(true);
}
setOpaque(true);
}
public List<AttributeItemFigure> getAttributes() {
List<AttributeItemFigure> result = new ArrayList<>();
for (Object child : getChildren()) {
if (child instanceof AttributeItemFigure) {
result.add((AttributeItemFigure) child);
}
}
return result;
}
public List<AttributeItemFigure> getAttributes() {
List<AttributeItemFigure> result = new ArrayList<>();
for (Object child : getChildren()) {
if (child instanceof AttributeItemFigure) {
result.add((AttributeItemFigure) child);
}
}
return result;
}
class ColumnFigureBorder extends AbstractBorder
{
class ColumnFigureBorder extends AbstractBorder {
@Override
public Insets getInsets(IFigure figure)
{
return new Insets(5, 3, 3, 3);
}
@Override
public Insets getInsets(IFigure figure) {
return new Insets(5, 3, 3, 3);
}
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets)
{
graphics.setForegroundColor(UIUtils.getColorRegistry().get(ERDConstants.COLOR_ERD_LINES_FOREGROUND));
Rectangle rect = getPaintRectangle(figure, insets);
graphics.setLineWidth(2);
graphics.drawLine(rect.getTopLeft(), tempRect.getTopRight());
}
}
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
graphics.setForegroundColor(((EntityFigure) getParent()).getBorderColor());
Rectangle rect = getPaintRectangle(figure, insets);
graphics.setLineWidth(2);
graphics.drawLine(rect.getTopLeft(), tempRect.getTopRight());
}
}
}
\ No newline at end of file
......@@ -21,6 +21,7 @@ package org.jkiss.dbeaver.ext.erd.figures;
import org.eclipse.draw2d.*;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.jkiss.dbeaver.ext.erd.ERDConstants;
import org.jkiss.dbeaver.ext.erd.editor.ERDViewStyle;
......@@ -91,7 +92,7 @@ public class EntityFigure extends Figure {
layout.setStretchMinorAxis(true);
setLayoutManager(layout);
LineBorder border = new LineBorder(UIUtils.getColorRegistry().get(ERDConstants.COLOR_ERD_LINES_FOREGROUND), ERDConstants.DEFAULT_ENTITY_BORDER_WIDTH);
LineBorder border = new LineBorder(getBorderColor(), ERDConstants.DEFAULT_ENTITY_BORDER_WIDTH);
setBorder(border);
setOpaque(true);
......@@ -112,6 +113,14 @@ public class EntityFigure extends Figure {
refreshColors();
}
protected Color getBorderColor() {
return UIUtils.getColorRegistry().get(ERDConstants.COLOR_ERD_LINES_FOREGROUND);
}
public EntityPart getPart() {
return part;
}
public void refreshColors() {
ColorRegistry colorRegistry = UIUtils.getColorRegistry();
......
......@@ -14,9 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Created on Jul 13, 2004
*/
package org.jkiss.dbeaver.ext.erd.model;
import org.jkiss.code.NotNull;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册