Browse Source

配色

master
zheng 6 years ago
parent
commit
1f10444b20
  1. 21
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java
  2. 41
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java
  3. 1
      designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java

21
designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java

@ -1,13 +1,13 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.module;
import com.fr.base.ChartColorMatching; import com.fr.base.ChartColorMatching;
import com.fr.chart.base.ChartConstants;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartAccColorPane;
import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -21,7 +21,6 @@ import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@ -41,8 +40,6 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private ChartAccColorPane colorAcc; private ChartAccColorPane colorAcc;
private FixedGradientBar colorGradient; private FixedGradientBar colorGradient;
private ChartColorMatching chartColorMatching;
public ChartPreFillStylePane() { public ChartPreFillStylePane() {
initComponents(); initComponents();
@ -70,6 +67,8 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
customPane.setPreferredSize(new Dimension(200, 200)); customPane.setPreferredSize(new Dimension(200, 200));
colorGradient.setPreferredSize(new Dimension(120, 30)); colorGradient.setPreferredSize(new Dimension(120, 30));
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE);
colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {p, p}; double[] columnSize = {p, p};
@ -110,12 +109,6 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
} }
public void populateBean(ChartColorMatching condition) { public void populateBean(ChartColorMatching condition) {
chartColorMatching = condition;
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE);
colorGradient.getSelectColorPointBtnP2().setColorInner(Color.black);
colorAcc.populateBean(ChartConstants.CHART_COLOR_ARRAY);
if (condition == null) { if (condition == null) {
return; return;
} }
@ -145,7 +138,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
@Override @Override
public ChartColorMatching updateBean() { public ChartColorMatching updateBean() {
chartColorMatching = chartColorMatching == null ? new ChartColorMatching() : chartColorMatching; ChartColorMatching chartColorMatching = new ChartColorMatching();
List<Color> colorList = new ArrayList<Color>(); List<Color> colorList = new ArrayList<Color>();
@ -160,7 +153,9 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
chartColorMatching.setGradient(false); chartColorMatching.setGradient(false);
Color[] colors = colorAcc.updateBean(); Color[] colors = colorAcc.updateBean();
colorList = Arrays.asList(colors); for(Color color : colors) {
colorList.add(color);
}
} }
chartColorMatching.setColorList(colorList); chartColorMatching.setColorList(colorList);

41
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java

@ -3,6 +3,7 @@ package com.fr.design.module;
import com.fr.base.ChartColorMatching; import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig; import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.config.Configuration;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
@ -11,10 +12,11 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
/** /**
@ -36,22 +38,13 @@ public class ChartPreStyleManagerPane extends JListControlPane {
}; };
} }
@Override
public void addNameable(Nameable nameable, int index) {
super.addNameable(nameable, index);
if (!ChartPreStyleConfig.getInstance().containsName(nameable.getName())) {
ChartPreStyleConfig.getInstance().putPreStyle(nameable.getName(), ((NameObject) nameable).getObject());
}
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Chart-PreStyle"); return Inter.getLocText("FR-Designer_Chart-PreStyle");
} }
public void populateBean() { public void populateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror();
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
Iterator keys = config.names(); Iterator keys = config.names();
@ -71,22 +64,18 @@ public class ChartPreStyleManagerPane extends JListControlPane {
} }
public void updateBean() { public void updateBean() {
Configurations.update(new Worker() {
@Override
public void run() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
config.setCurrentStyle(getSelectedName()); config.setCurrentStyle(getSelectedName());
Nameable[] values = this.update(); Nameable[] values = update();
config.setPreStyleMap(new LinkedHashMap()); config.clearAllPreStyle();
for(int i = 0; i < values.length; i++) { for(Nameable value : values) {
Nameable value = values[i]; config.putPreStyle(value.getName(), ((NameObject) value).getObject());
ChartColorMatching chartColorMatching = (ChartColorMatching) ((NameObject) value).getObject();
try {
chartColorMatching = (ChartColorMatching) chartColorMatching.clone();
} catch (CloneNotSupportedException e) {
//do nothing
}
config.putPreStyle(value.getName(), chartColorMatching);
} }
// 通知报表整个刷新. // 通知报表整个刷新.
@ -96,4 +85,12 @@ public class ChartPreStyleManagerPane extends JListControlPane {
} }
} }
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ChartPreStyleConfig.class};
}
});
}
} }

1
designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java

@ -12,7 +12,6 @@ import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.gui.style.ChartPreFillStylePane;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.JPanel; import javax.swing.JPanel;

Loading…
Cancel
Save