Browse Source

代码规范

master
mengao 7 years ago
parent
commit
82a49b9e0e
  1. 1
      designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java
  2. 30
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java
  3. 9
      designer_chart/src/com/fr/plugin/chart/designer/style/background/BackgroundNameObjectCreator.java
  4. 9
      designer_chart/src/com/fr/plugin/chart/designer/style/background/ChartNameObjectCreator.java
  5. 3
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAlertValuePane.java
  6. 65
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAxisAreaPane.java
  7. 8
      designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java

1
designer_chart/src/com/fr/plugin/chart/bubble/data/VanChartBubblePlotTableDataContentPane.java

@ -65,6 +65,7 @@ public class VanChartBubblePlotTableDataContentPane extends AbstractTableDataCon
JPanel north = TableLayoutHelper.createTableLayoutPane(components_north,rowSize_north,columnSize_north);
north.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
JPanel filterPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("FR-Chart-Data_Filter"),dataScreeningPane);
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
Component[][] components = new Component[][]{
new Component[]{north},

30
designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java

@ -112,7 +112,7 @@ public class VanChartHyperLinkPane extends UIListControlPane {
if (isPopulating) {
return;
}
update((VanChartPlot)plot);
update((VanChartPlot) plot);
}
public void populate(Plot plot) {
@ -128,8 +128,8 @@ public class VanChartHyperLinkPane extends UIListControlPane {
}
java.util.List<UIMenuNameableCreator> list = refreshList(paneMap);
NameObjectCreator[] creators= new NameObjectCreator[list.size()];
for(int i = 0; list != null && i < list.size(); i++) {
NameObjectCreator[] creators = new NameObjectCreator[list.size()];
for (int i = 0; list != null && i < list.size(); i++) {
UIMenuNameableCreator uiMenuNameableCreator = list.get(i);
creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz());
@ -140,11 +140,11 @@ public class VanChartHyperLinkPane extends UIListControlPane {
java.util.List<NameObject> nameObjects = new ArrayList<NameObject>();
NameJavaScriptGroup nameGroup = populateHotHyperLink(plot);
for(int i = 0; nameGroup != null && i < nameGroup.size(); i++) {
for (int i = 0; nameGroup != null && i < nameGroup.size(); i++) {
NameJavaScript javaScript = nameGroup.getNameHyperlink(i);
if(javaScript != null && javaScript.getJavaScript() != null) {
if (javaScript != null && javaScript.getJavaScript() != null) {
JavaScript script = javaScript.getJavaScript();
UIMenuNameableCreator uiMenuNameableCreator= new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass()));
UIMenuNameableCreator uiMenuNameableCreator = new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass()));
nameObjects.add(new NameObject(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj()));
}
@ -158,7 +158,7 @@ public class VanChartHyperLinkPane extends UIListControlPane {
return plot.getHotHyperLink();
}
protected HashMap getHyperlinkMap(Plot plot){
protected HashMap getHyperlinkMap(Plot plot) {
return HyperlinkMapFactory.getHyperlinkMap(plot);
}
@ -179,10 +179,10 @@ public class VanChartHyperLinkPane extends UIListControlPane {
NameJavaScriptGroup nameGroup = new NameJavaScriptGroup();
nameGroup.clear();
for(int i = 0; i < nameables.length; i++) {
JavaScript javaScript = (JavaScript)((NameObject)nameables[i]).getObject();
for (int i = 0; i < nameables.length; i++) {
JavaScript javaScript = (JavaScript) ((NameObject) nameables[i]).getObject();
String name = nameables[i].getName();
NameJavaScript nameJava = new NameJavaScript(name,javaScript);
NameJavaScript nameJava = new NameJavaScript(name, javaScript);
nameGroup.addNameHyperlink(nameJava);
}
@ -217,13 +217,13 @@ public class VanChartHyperLinkPane extends UIListControlPane {
}
protected Class<? extends BasicBeanPane> getUseMap(HashMap map, Object key) {
if(map.get(key) != null){
return (Class<? extends BasicBeanPane>)map.get(key);
if (map.get(key) != null) {
return (Class<? extends BasicBeanPane>) map.get(key);
}
//引擎在这边放了个provider,当前表单对象
for(Object tempKey : map.keySet()){
if(((Class)tempKey).isAssignableFrom((Class)key)){
return (Class<? extends BasicBeanPane>)map.get(tempKey);
for (Object tempKey : map.keySet()) {
if (((Class) tempKey).isAssignableFrom((Class) key)) {
return (Class<? extends BasicBeanPane>) map.get(tempKey);
}
}
return null;

9
designer_chart/src/com/fr/plugin/chart/designer/style/background/BackgroundNameObjectCreator.java

@ -2,6 +2,7 @@ package com.fr.plugin.chart.designer.style.background;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.general.FRLogger;
import com.fr.general.NameObject;
import com.fr.plugin.chart.base.VanChartCustomIntervalBackground;
import com.fr.stable.Nameable;
@ -33,13 +34,13 @@ public class BackgroundNameObjectCreator extends ChartNameObjectCreator {
return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartCustomIntervalBackground);
} catch (NoSuchMethodException e) {
e.printStackTrace();
FRLogger.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) {
e.printStackTrace();
FRLogger.getLogger().error(e.getMessage(), e);
} catch (InstantiationException e) {
e.printStackTrace();
FRLogger.getLogger().error(e.getMessage(), e);
} catch (InvocationTargetException e) {
e.printStackTrace();
FRLogger.getLogger().error(e.getMessage(), e);
}
return null;
}

9
designer_chart/src/com/fr/plugin/chart/designer/style/background/ChartNameObjectCreator.java

@ -3,6 +3,7 @@ package com.fr.plugin.chart.designer.style.background;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.general.FRLogger;
import com.fr.general.NameObject;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.stable.Nameable;
@ -39,13 +40,13 @@ public class ChartNameObjectCreator extends NameObjectCreator {
return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartAlertValue);
} catch (NoSuchMethodException e) {
e.printStackTrace();
FRLogger.getLogger().error(e.getMessage(), e);
} catch (IllegalAccessException e) {
e.printStackTrace();
FRLogger.getLogger().error(e.getMessage(), e);
} catch (InstantiationException e) {
e.printStackTrace();
FRLogger.getLogger().error(e.getMessage(), e);
} catch (InvocationTargetException e) {
e.printStackTrace();
FRLogger.getLogger().error(e.getMessage(), e);
}
return null;
}

3
designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAlertValuePane.java

@ -168,9 +168,6 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
fontColor.setSelectObject(chartAlertValue.getAlertFont().getForeground());
}
@Override
public void updateBean(VanChartAlertValue chartAlertValue) {}
public VanChartAlertValue updateBean(){
chartAlertValue.setAxisName(alertAxis.getSelectedItem().toString());

65
designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartAxisAreaPane.java

@ -21,7 +21,7 @@ import java.awt.event.ActionListener;
/**
* 样式-背景-绘图区背景-坐标轴图表特有间隔背景网格线警戒线
*/
public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private static final long serialVersionUID = -1880497996650835504L;
protected ColorSelectBox horizontalGridLine;
@ -36,50 +36,50 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
private ColorSelectBox verticalColorBackground;
protected BackgroundListControlPane customIntervalBackground;
public VanChartAxisAreaPane(){
public VanChartAxisAreaPane() {
initComponents();
}
protected void initComponents(){
protected void initComponents() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { f };
double[] rowSize = {p,p,p};
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{createGridLinePane(new double[]{p,p,p}, new double[]{p,f})},
new Component[]{createGridLinePane(new double[]{p, p, p}, new double[]{p, f})},
new Component[]{createAlertLinePane()},
new Component[]{createIntervalPane(new double[]{p,p,p,p}, new double[]{p,f})},
new Component[]{createIntervalPane(new double[]{p, p, p, p}, new double[]{p, f})},
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER);
this.add(panel, BorderLayout.CENTER);
}
private JPanel createGridLinePane(double[] row, double[] col){
private JPanel createGridLinePane(double[] row, double[] col) {
horizontalGridLine = new ColorSelectBox(100);
verticalGridLine = new ColorSelectBox(100);
Component[][] components = getGridLinePaneComponents();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("ChartF-Grid_Line"),panel);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("ChartF-Grid_Line"), panel);
}
protected Component[][] getGridLinePaneComponents() {
return new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Direction_Horizontal")),horizontalGridLine},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Direction_Vertical")),verticalGridLine},
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Direction_Horizontal")), horizontalGridLine},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Direction_Vertical")), verticalGridLine},
};
}
protected JPanel createAlertLinePane(){
protected JPanel createAlertLinePane() {
alertLine = new AlertLineListControlPane();
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_AlertLine"),alertLine);
alertLine.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_AlertLine"), alertLine);
alertLine.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 15));
return panel;
}
protected JPanel createIntervalPane(double[] row, double[] col){
protected JPanel createIntervalPane(double[] row, double[] col) {
isDefaultIntervalBackground = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_IntervalBackground"), Inter.getLocText("Plugin-ChartF_CustomIntervalBackground")});
horizontalColorBackground = new ColorSelectBox(100);
verticalColorBackground = new ColorSelectBox(100);
@ -100,33 +100,33 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
JPanel intervalPane = new JPanel(new BorderLayout(0, 6));
intervalPane.add(isDefaultIntervalBackground, BorderLayout.NORTH);
intervalPane.add(centerPane, BorderLayout.CENTER);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_IntervalBackground"),intervalPane);
intervalPane.setBorder(BorderFactory.createEmptyBorder(10,10,0,15));
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Plugin-ChartF_IntervalBackground"), intervalPane);
intervalPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 15));
return panel;
}
protected Component[][] getIntervalPaneComponents() {
return new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Direction_Horizontal")),horizontalColorBackground},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Direction_Vertical")),verticalColorBackground},
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Direction_Horizontal")), horizontalColorBackground},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Direction_Vertical")), verticalColorBackground},
};
}
private void checkCardPane(){
if(isDefaultIntervalBackground.getSelectedIndex() == 0){
private void checkCardPane() {
if (isDefaultIntervalBackground.getSelectedIndex() == 0) {
cardLayout.show(centerPane, Inter.getLocText("Plugin-ChartF_IntervalBackground"));
} else {
cardLayout.show(centerPane, Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"));
}
}
protected String title4PopupWindow(){
protected String title4PopupWindow() {
return "";
}
public void populateBean(Plot plot){
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot;
public void populateBean(Plot plot) {
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot;
populateGridLine(rectanglePlot);
@ -146,22 +146,22 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
}
public void updateBean(Plot plot){
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot;
public void updateBean(Plot plot) {
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot;
updateGirdLine(rectanglePlot);
alertLine.update(plot);
rectanglePlot.setIsDefaultIntervalBackground(isDefaultIntervalBackground.getSelectedIndex() == 0);
if(rectanglePlot.isDefaultIntervalBackground()){
if (rectanglePlot.isDefaultIntervalBackground()) {
rectanglePlot.getDefaultYAxis().setDefaultIntervalBackgroundColor(horizontalColorBackground.getSelectObject());
rectanglePlot.getDefaultXAxis().setDefaultIntervalBackgroundColor(verticalColorBackground.getSelectObject());
} else {
rectanglePlot.getDefaultYAxis().setDefaultIntervalBackgroundColor(null);
rectanglePlot.getDefaultXAxis().setDefaultIntervalBackgroundColor(null);
}
customIntervalBackground.update(plot,isDefaultIntervalBackground.getSelectedIndex() == 0);
customIntervalBackground.update(plot, isDefaultIntervalBackground.getSelectedIndex() == 0);
}
protected void updateGirdLine(VanChartRectanglePlot rectanglePlot) {
@ -171,6 +171,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
/**
* Y軸和雷達圖的極軸也是相等的
*
* @param axisName
* @param valueAxisName
* @return
@ -180,7 +181,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot>{
ComparatorUtils.equals(VanChartAttrHelper.RADAR_Y_AXIS_PREFIX, axisName);
}
public Plot updateBean(){
public Plot updateBean() {
return null;
}
}

8
designer_chart/src/com/fr/plugin/chart/designer/style/background/VanChartCustomIntervalBackgroundPane.java

@ -34,9 +34,6 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane<VanChart
private VanChartCustomIntervalBackground customIntervalBackground;
public VanChartCustomIntervalBackgroundPane(){
}
private void doLayoutPane(){
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
//
@ -46,8 +43,7 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane<VanChart
top.add(createContentPane());
}
private JPanel createContentPane()
{
private JPanel createContentPane() {
bottomValue = new TinyFormulaPane();
topValue = new TinyFormulaPane();
bottomValue.setPreferredSize(new Dimension(124,20));
@ -104,8 +100,6 @@ public class VanChartCustomIntervalBackgroundPane extends BasicBeanPane<VanChart
transparent.populateBean(customIntervalBackground.getAlpha() * VanChartAttrHelper.PERCENT);
}
public void updateBean(VanChartCustomIntervalBackground customIntervalBackground){}
public VanChartCustomIntervalBackground updateBean(){
customIntervalBackground.setAxisName(backgroundAxis.getSelectedItem().toString());

Loading…
Cancel
Save