Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Scene background color in themes. For both themes WHITE color is the background color. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions UMLModel/src/org/uml/model/relations/CardinalityEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public enum CardinalityEnum {
One2One {
@Override
public String toString() {
return "1..1";
return "1";
}
},
/**
Expand All @@ -45,7 +45,7 @@ public String toString() {
Zero2Many {
@Override
public String toString() {
return "0..*";
return "*";
}
};

Expand All @@ -57,7 +57,7 @@ public String toString() {
* @return
*/
public static CardinalityEnum parseString(String cardinalityEnum) {
if (cardinalityEnum.equalsIgnoreCase("1..1")) {
if (cardinalityEnum.equalsIgnoreCase("1")) {
return CardinalityEnum.One2One;
}
if (cardinalityEnum.equalsIgnoreCase("0..1")) {
Expand All @@ -66,7 +66,7 @@ public static CardinalityEnum parseString(String cardinalityEnum) {
if (cardinalityEnum.equalsIgnoreCase("1..*")) {
return CardinalityEnum.One2Many;
}
if (cardinalityEnum.equalsIgnoreCase("0..*")) {
if (cardinalityEnum.equalsIgnoreCase("*")) {
return CardinalityEnum.Zero2Many;
}
return CardinalityEnum.Zero2One;
Expand Down
8 changes: 8 additions & 0 deletions UMLVisual/src/org/uml/visual/themes/BlueGrayTheme.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.uml.visual.themes;

import java.awt.Color;
import java.awt.Paint;
import org.netbeans.api.visual.border.Border;
import org.netbeans.api.visual.border.BorderFactory;
import static org.uml.visual.widgets.components.ComponentWidgetBase.SELECT_BORDER_SIZE;
Expand Down Expand Up @@ -45,6 +46,8 @@ public class BlueGrayTheme implements Theme {
protected static final Color DEFAULT_FONT_COLOR = Color.BLACK;
protected static final Color HOVER_FONT_COLOR = DEFAULT_FONT_COLOR;
protected static final Color SELECT_FONT_COLOR = Color.WHITE;

protected static final Color SCENE_BACKGROUND_COLOR = Color.WHITE;

@Override
public String getName() {
Expand Down Expand Up @@ -165,4 +168,9 @@ public Color getHoverFontColor() {
public Color getSelectFontColor() {
return SELECT_FONT_COLOR;
}

@Override
public Paint getSceneBackgroundColor() {
return SCENE_BACKGROUND_COLOR;
}
}
8 changes: 8 additions & 0 deletions UMLVisual/src/org/uml/visual/themes/SandRedTheme.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.uml.visual.themes;

import java.awt.Color;
import java.awt.Paint;
import org.netbeans.api.visual.border.Border;
import org.netbeans.api.visual.border.BorderFactory;
import static org.uml.visual.widgets.components.ComponentWidgetBase.SELECT_BORDER_SIZE;
Expand Down Expand Up @@ -46,6 +47,8 @@ public class SandRedTheme implements Theme {
protected static final Color DEFAULT_FONT_COLOR = Color.BLACK;
protected static final Color HOVER_FONT_COLOR = DEFAULT_FONT_COLOR;
protected static final Color SELECT_FONT_COLOR = Color.WHITE;

protected static final Color SCENE_BACKGROUND_COLOR = Color.WHITE;

@Override
public String getName() {
Expand Down Expand Up @@ -166,4 +169,9 @@ public Color getHoverFontColor() {
public Color getSelectFontColor() {
return SELECT_FONT_COLOR;
}

@Override
public Paint getSceneBackgroundColor() {
return SCENE_BACKGROUND_COLOR;
}
}
3 changes: 3 additions & 0 deletions UMLVisual/src/org/uml/visual/themes/Theme.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.uml.visual.themes;

import java.awt.Color;
import java.awt.Paint;
import org.netbeans.api.visual.border.Border;

/**
Expand Down Expand Up @@ -42,4 +43,6 @@ public interface Theme {
public Color getSelectFontColor();

public String getName();

public Paint getSceneBackgroundColor();
}
5 changes: 4 additions & 1 deletion UMLVisual/src/org/uml/visual/widgets/ClassDiagramScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public ClassDiagramScene(ClassDiagram umlClassDiagram, final UMLTopComponent uml
addChild(connectionLayer);
interractionLayer = new LayerWidget(this);
addChild(interractionLayer);


setBackground(colorTheme.getSceneBackgroundColor());

// middle-click + drag Scene.getInputBindings().getPanActionButton()
getActions().addAction(ActionFactory.createPanAction());
// ctrl + scroll Scene.getInputBindings().getZoomActionModifiers()
Expand Down Expand Up @@ -201,6 +203,7 @@ public Theme getColorTheme() {

public void setColorTheme(String name) {
colorTheme = ColorThemesStore.getColorTheme(name);
setBackground(colorTheme.getSceneBackgroundColor());
for (Widget widget : mainLayer.getChildren()) {
if (widget instanceof ComponentWidgetBase) {
ComponentWidgetBase componentWidget = (ComponentWidgetBase) widget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public ComponentWidgetBase(final ClassDiagramScene scene, ComponentBase componen
setLayout(LayoutFactory.createVerticalFlowLayout());
setOpaque(true);
setCheckClipping(true);
setBackground(getColorTheme().getDefaultColor());
// setBackground(getColorTheme().getDefaultColor()); //ovo je visak

headerWidget = new Widget(scene); // mora ovako zbog layouta ne moze this
headerWidget.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 0));
Expand Down