Author: mvw
Date: 2008-01-30 14:22:27-0800
New Revision: 14072
Modified:
trunk/src_new/org/argouml/i18n/label.properties
trunk/src_new/org/argouml/ui/StylePanelFig.java
trunk/src_new/org/argouml/ui/StylePanelFigText.java
Log:
This makes the "Custom..." text color for the primitive text work.
Also: some i18n for the FigText presentation panel.
Modified: trunk/src_new/org/argouml/i18n/label.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/label.properties?view=diff&rev=14072&p1=trunk/src_new/org/argouml/i18n/label.properties&p2=trunk/src_new/org/argouml/i18n/label.properties&r1=14071&r2=14072
==============================================================================
--- trunk/src_new/org/argouml/i18n/label.properties (original)
+++ trunk/src_new/org/argouml/i18n/label.properties 2008-01-30 14:22:27-0800
@@ -1,5 +1,5 @@
# $Id$
-# Copyright (c) 2005-2007 The Regents of the University of California. All
+# Copyright (c) 2005-2008 The Regents of the University of California. All
# Rights Reserved. Permission to use, copy, modify, and distribute this
# software and its documentation without fee, and without a written
# agreement is hereby granted, provided that the above copyright notice
@@ -381,14 +381,22 @@
label.style-pane = Style Pane
label.stylepane.bounds = Bounds
label.stylepane.custom = Custom
+label.stylepane.custom-fill-color = Custom Fill Color
+label.stylepane.custom-line-color = Custom Line Color
+label.stylepane.custom-text-color = Custom Text Color
label.stylepane.display = Display
label.stylepane.fill = Fill
+label.stylepane.font = Font
+label.stylepane.justify = Justify
label.stylepane.line = Line
label.stylepane.no-fill = No Fill
label.stylepane.no-line = No Line
label.stylepane.no-shadow = No Shadow
label.stylepane.path = Path
label.stylepane.rounding = Rounding
+label.stylepane.size = Size
+label.stylepane.style = Style
+label.stylepane.text-color = Text Color
label.subactivity-state = SubactivityState
label.submachine = Submachine:
label.submachinestate = Submachine State:
Modified: trunk/src_new/org/argouml/ui/StylePanelFig.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/StylePanelFig.java?view=diff&rev=14072&p1=trunk/src_new/org/argouml/ui/StylePanelFig.java&p2=trunk/src_new/org/argouml/ui/StylePanelFig.java&r1=14071&r2=14072
==============================================================================
--- trunk/src_new/org/argouml/ui/StylePanelFig.java (original)
+++ trunk/src_new/org/argouml/ui/StylePanelFig.java 2008-01-30 14:22:27-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2003-2006 The Regents of the University of California. All
+// Copyright (c) 2003-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -51,9 +51,13 @@
import org.argouml.util.ArgoFrame;
/**
- * The basic stylepanel which provides the boundaries box,
- * line and fill color information and the stereotype view combo box.
- *
+ * The basic stylepanel for a Fig which allows the user to see and adjust
+ * the common attributes of a Fig:
+ * the boundaries box,
+ * line and fill color information
+ * and the stereotype view combo box. <p>
+ *
+ * Shown to the user as the "Presentation" tab.
*/
public class StylePanelFig
extends StylePanel
@@ -429,14 +433,14 @@
* box.
*
* @param field the combobox to enter a new color for
- * @param title the title for the dialog box
+ * @param title the i18n key for the title for the dialog box
* @param targetColor the initial Color set when the color-chooser is shown
*/
protected void handleCustomColor(JComboBox field, String title,
Color targetColor) {
Color newColor =
JColorChooser.showDialog(ArgoFrame.getInstance(),
- title, targetColor);
+ Translator.localize(title), targetColor);
if (newColor != null) {
field.insertItemAt(newColor, field.getItemCount() - 1);
field.setSelectedItem(newColor);
@@ -487,13 +491,15 @@
&& target != null) {
if (src == fillField) {
if (e.getItem() == CUSTOM_ITEM) {
- handleCustomColor(fillField, "Custom Fill Color",
+ handleCustomColor(fillField,
+ "label.stylepane.custom-fill-color",
target.getFillColor());
}
setTargetFill();
} else if (src == lineField) {
if (e.getItem() == CUSTOM_ITEM) {
- handleCustomColor(lineField, "Custom Line Color",
+ handleCustomColor(lineField,
+ "label.stylepane.custom-line-color",
target.getLineColor());
}
setTargetLine();
@@ -634,4 +640,11 @@
* The UID.
*/
private static final long serialVersionUID = -6232843473753751128L;
+
+ /**
+ * @return returns the translated name of the "Custom..." item.
+ */
+ protected static String getCustomItemName() {
+ return CUSTOM_ITEM;
+ }
}
Modified: trunk/src_new/org/argouml/ui/StylePanelFigText.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/StylePanelFigText.java?view=diff&rev=14072&p1=trunk/src_new/org/argouml/ui/StylePanelFigText.java&p2=trunk/src_new/org/argouml/ui/StylePanelFigText.java&r1=14071&r2=14072
==============================================================================
--- trunk/src_new/org/argouml/ui/StylePanelFigText.java (original)
+++ trunk/src_new/org/argouml/ui/StylePanelFigText.java 2008-01-30 14:22:27-0800
@@ -30,6 +30,8 @@
import javax.swing.JComboBox;
import javax.swing.JLabel;
+import org.argouml.i18n.Translator;
+import org.tigris.gef.presentation.Fig;
import org.tigris.gef.presentation.FigText;
import org.tigris.gef.ui.ColorRenderer;
@@ -40,6 +42,9 @@
*/
public class StylePanelFigText extends StylePanelFig {
+ /**
+ * TODO: These can not simply be translated...
+ */
private static final String[] FONT_NAMES = {
"dialog", "serif", "sanserif",
"monospaced",
@@ -63,23 +68,28 @@
"Left", "Right", "Center",
};
- private JLabel fontLabel = new JLabel("Font: ");
+ private JLabel fontLabel = new JLabel(
+ Translator.localize("label.stylepane.font") + ": ");
private JComboBox fontField = new JComboBox(FONT_NAMES);
- private JLabel sizeLabel = new JLabel("Size: ");
+ private JLabel sizeLabel = new JLabel(
+ Translator.localize("label.stylepane.size") + ": ");
private JComboBox sizeField = new JComboBox(COMMON_SIZES);
- private JLabel styleLabel = new JLabel("Style: ");
+ private JLabel styleLabel = new JLabel(
+ Translator.localize("label.stylepane.style") + ": ");
private JComboBox styleField = new JComboBox(STYLES);
- private JLabel justLabel = new JLabel("Justify: ");
+ private JLabel justLabel = new JLabel(
+ Translator.localize("label.stylepane.justify") + ": ");
private JComboBox justField = new JComboBox(JUSTIFIES);
- private JLabel textColorLabel = new JLabel("Text Color: ");
+ private JLabel textColorLabel = new JLabel(
+ Translator.localize("label.stylepane.text-color") + ": ");
private JComboBox textColorField = new JComboBox();
@@ -136,7 +146,7 @@
textColorField.addItem(Color.green);
textColorField.addItem(Color.orange);
textColorField.addItem(Color.pink);
- textColorField.addItem("Custom...");
+ textColorField.addItem(getCustomItemName());
}
@@ -277,18 +287,27 @@
*/
public void itemStateChanged(ItemEvent e) {
Object src = e.getSource();
- if (src == fontField) {
- setTargetFont();
- } else if (src == sizeField) {
- setTargetSize();
- } else if (src == styleField) {
- setTargetStyle();
- } else if (src == justField) {
- setTargetJustification();
- } else if (src == textColorField) {
- setTargetTextColor();
- } else {
- super.itemStateChanged(e);
+ Fig target = getPanelTarget();
+ if (e.getStateChange() == ItemEvent.SELECTED
+ && target instanceof FigText) {
+ if (src == fontField) {
+ setTargetFont();
+ } else if (src == sizeField) {
+ setTargetSize();
+ } else if (src == styleField) {
+ setTargetStyle();
+ } else if (src == justField) {
+ setTargetJustification();
+ } else if (src == textColorField) {
+ if (e.getItem() == getCustomItemName()) {
+ handleCustomColor(textColorField,
+ "label.stylepane.custom-text-color",
+ ((FigText) target).getTextColor());
+ }
+ setTargetTextColor();
+ } else {
+ super.itemStateChanged(e);
+ }
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.