Browse Source

REPORT-9061 记住历史颜色功能bug

master
Mata.Li 6 years ago
parent
commit
636edef273
  1. 6
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 3
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  3. 10
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectConfigManager.java
  4. 3
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java
  5. 3
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  6. 5
      designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java
  7. 3
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAccColorPane.java
  8. 7
      designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java

6
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -192,6 +192,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return designerEnvManager;
}
public ColorSelectConfigManager getColorConfigManager(){
return this.configManager;
}
public static void checkNameEnvMap() {
if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) {
return;
@ -1302,7 +1306,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private void readRecentColor(XMLableReader reader){
reader.readXMLObject(this.configManager.getInstance());
reader.readXMLObject(this.configManager);
}
/**

3
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -19,6 +19,7 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.DesignerEnvManager;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.itextfield.UINumberField;
@ -104,7 +105,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, GradientBar.this);
Color color = GradientBar.this.getColor();
if (color != null) {
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
list.get(select).setColorInner(color);
stateChanged();
GradientBar.this.repaint();

10
designer-base/src/main/java/com/fr/design/style/color/ColorSelectConfigManager.java

@ -20,7 +20,6 @@ public class ColorSelectConfigManager implements XMLReadable {
// 最近使用的颜色个数
private int colorNums = 20;
private static ColorSelectConfigManager colorSelectConfigManager = null;
private boolean init = true;
// 最近使用颜色
private List<Color> colors = new ArrayList<Color>();
@ -41,12 +40,6 @@ public class ColorSelectConfigManager implements XMLReadable {
this.colorNums = colorNums;
}
public synchronized static ColorSelectConfigManager getInstance() {
if (colorSelectConfigManager == null) {
colorSelectConfigManager = new ColorSelectConfigManager();
}
return colorSelectConfigManager;
}
/**
* 添加颜色到最近使用队列中
@ -66,9 +59,8 @@ public class ColorSelectConfigManager implements XMLReadable {
/*@author yaohwu*/
//将历史颜色信息保存到xml文件中去
ColorSelectConfigManager manager = ColorSelectConfigManager.getInstance();
if (colors != null && !colors.isEmpty()) {
manager.setColorsToFile(colors);
this.setColorsToFile(colors);
}
}

3
designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java

@ -3,6 +3,7 @@
*/
package com.fr.design.style.color;
import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
@ -159,7 +160,7 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
}
}
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
this.repaint();
}

3
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -1,5 +1,6 @@
package com.fr.design.style.color;
import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
@ -163,7 +164,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
this.colorChangeListenerList.get(i).stateChanged(evt);
}
}
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
this.repaint();
}

5
designer-base/src/main/java/com/fr/design/style/color/UsedColorPane.java

@ -1,5 +1,6 @@
package com.fr.design.style.color;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.SpecialUIButton;
@ -66,7 +67,7 @@ public class UsedColorPane extends BasicPane {
panel.setLayout(new GridLayout(rows, columns, 1, 1));
panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
//最近使用颜色
Color[] colors = ColorSelectConfigManager.getInstance().getColors();
Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors();
int size = colors.length;
int i = 0;
if (needPickColorButton) {
@ -96,7 +97,7 @@ public class UsedColorPane extends BasicPane {
*/
public void updateUsedColor() {
int total = columns * rows;
Color[] colors = ColorSelectConfigManager.getInstance().getColors();
Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors();
int size = colors.length;
for (int i = this.reserveCells; i < total; i++) {
ColorCell cell = (ColorCell) this.pane.getComponent(i);

3
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartAccColorPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.chart.gui.style;
import com.fr.chart.base.ChartConstants;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
@ -122,7 +123,7 @@ public class ChartAccColorPane extends BasicPane implements MouseListener, UIObs
Color choosedColor = this.getColor();
if (choosedColor != null) {
colors[currentIndex] = choosedColor;
ColorSelectConfigManager.getInstance().addToColorQueue(choosedColor);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(choosedColor);
ChartAccColorPane.this.stateChanged();
}
ChartAccColorPane.this.repaint();

7
designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java

@ -1,6 +1,7 @@
package com.fr.van.chart.range.component;
import com.fr.chart.base.ChartBaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.DesignerContext;
@ -263,7 +264,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorPointBtnList.get(select).setColorInner(color);
LegendGradientBar.this.repaint();
@ -276,7 +277,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorSlotBtnStart.setColorInner(color);
//stateChanged();
LegendGradientBar.this.repaint();
@ -286,7 +287,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
ColorSelectConfigManager.getInstance().addToColorQueue(color);
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorSlotBtnEnd.setColorInner(color);
//stateChanged();
LegendGradientBar.this.repaint();

Loading…
Cancel
Save