|
|
@ -3,25 +3,15 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.fr.poly.creator; |
|
|
|
package com.fr.poly.creator; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
|
|
|
import com.fr.base.ScreenResolution; |
|
|
|
|
|
|
|
import com.fr.base.chart.BaseChart; |
|
|
|
|
|
|
|
import com.fr.base.chart.BaseChartCollection; |
|
|
|
import com.fr.base.chart.BaseChartCollection; |
|
|
|
import com.fr.base.chart.BaseChartGetter; |
|
|
|
|
|
|
|
import com.fr.base.chart.BaseChartNameID; |
|
|
|
|
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.design.border.UIRoundedBorder; |
|
|
|
|
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
import com.fr.design.gui.chart.MiddleChartComponent; |
|
|
|
import com.fr.design.gui.chart.MiddleChartComponent; |
|
|
|
import com.fr.design.mainframe.EastRegionContainerPane; |
|
|
|
import com.fr.design.mainframe.EastRegionContainerPane; |
|
|
|
import com.fr.design.mainframe.JSliderPane; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.NoSupportAuthorityEdit; |
|
|
|
import com.fr.design.mainframe.NoSupportAuthorityEdit; |
|
|
|
import com.fr.design.mainframe.cell.QuickEditorRegion; |
|
|
|
import com.fr.design.mainframe.cell.QuickEditorRegion; |
|
|
|
import com.fr.design.module.DesignModuleFactory; |
|
|
|
import com.fr.design.module.DesignModuleFactory; |
|
|
|
import com.fr.design.utils.gui.LayoutUtils; |
|
|
|
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
import com.fr.poly.PolyConstants; |
|
|
|
import com.fr.poly.PolyConstants; |
|
|
|
import com.fr.poly.PolyDesigner; |
|
|
|
import com.fr.poly.PolyDesigner; |
|
|
|
import com.fr.poly.PolyDesigner.SelectionType; |
|
|
|
import com.fr.poly.PolyDesigner.SelectionType; |
|
|
@ -31,13 +21,8 @@ import com.fr.report.poly.PolyChartBlock; |
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.Icon; |
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.JToggleButton; |
|
|
|
|
|
|
|
import javax.swing.border.Border; |
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.FlowLayout; |
|
|
|
|
|
|
|
import java.awt.Rectangle; |
|
|
|
import java.awt.Rectangle; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
@ -48,31 +33,10 @@ import java.awt.event.MouseEvent; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
// 图片的命名必须符合下面的代码规范(chart类别+序号的方式) 不然读取不到指定图片
|
|
|
|
// 图片的命名必须符合下面的代码规范(chart类别+序号的方式) 不然读取不到指定图片
|
|
|
|
public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChartBlock> { |
|
|
|
public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChartBlock> { |
|
|
|
private static final int BOUND_OFF = 21; |
|
|
|
|
|
|
|
private static Border buttonBorder; |
|
|
|
|
|
|
|
private static String[][] chartsNames; |
|
|
|
|
|
|
|
private static BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames(); |
|
|
|
|
|
|
|
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
|
|
|
buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5); |
|
|
|
|
|
|
|
chartsNames = new String[typeName.length][]; |
|
|
|
|
|
|
|
for (int i = 0; i < typeName.length; i++) { |
|
|
|
|
|
|
|
BaseChart[] rowCharts = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID()); |
|
|
|
|
|
|
|
chartsNames[i] = new String[rowCharts.length]; |
|
|
|
|
|
|
|
for (int j = 0; j < rowCharts.length; j++) { |
|
|
|
|
|
|
|
chartsNames[i][j] = rowCharts[j].getChartName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ChartButton[] chartButtons = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ChartBlockEditor(PolyDesigner designer, ChartBlockCreator creator) { |
|
|
|
public ChartBlockEditor(PolyDesigner designer, ChartBlockCreator creator) { |
|
|
|
super(designer, creator); |
|
|
|
super(designer, creator); |
|
|
|
this.resolution = creator.resolution; |
|
|
|
this.resolution = creator.resolution; |
|
|
|
//shine:和产品商量后决定把最上面一排切换按钮去掉
|
|
|
|
|
|
|
|
// this.initNorthBarComponent();
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -80,33 +44,6 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar |
|
|
|
this.resolution = resolution; |
|
|
|
this.resolution = resolution; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initNorthBarComponent() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel charttypeToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); |
|
|
|
|
|
|
|
this.add(BlockEditorLayout.TOP, charttypeToolbar); |
|
|
|
|
|
|
|
BaseChart chart = editComponent.getEditingChart(); |
|
|
|
|
|
|
|
String selectedName = chart.getChartName(); |
|
|
|
|
|
|
|
int index = 0; |
|
|
|
|
|
|
|
for (int i = 0; i < typeName.length; i++) { |
|
|
|
|
|
|
|
String[] rowCharts = chartsNames[i]; |
|
|
|
|
|
|
|
for (int j = 0; j < rowCharts.length; j++) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(selectedName, rowCharts[j])) { |
|
|
|
|
|
|
|
index = i; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String plotID = typeName[index].getPlotID(); |
|
|
|
|
|
|
|
BaseChart[] charts = BaseChartGetter.getStaticChartTypes(plotID); |
|
|
|
|
|
|
|
chartButtons = new ChartButton[charts.length]; |
|
|
|
|
|
|
|
for (int i = 0, l = charts.length; i < l; i++) { |
|
|
|
|
|
|
|
chartButtons[i] = new ChartButton(charts[i], charts[i].getChartName(), typeName[index].getName(), i); |
|
|
|
|
|
|
|
charttypeToolbar.add(chartButtons[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 检查控件是否可用 |
|
|
|
* 检查控件是否可用 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -192,76 +129,6 @@ public class ChartBlockEditor extends BlockEditor<MiddleChartComponent, PolyChar |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class ChartButton extends JToggleButton { |
|
|
|
|
|
|
|
private BaseChart chart; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ChartButton(BaseChart chart, String text, String pathName, int index) { |
|
|
|
|
|
|
|
this.chart = chart; |
|
|
|
|
|
|
|
this.setToolTipText(text); |
|
|
|
|
|
|
|
String path = "com/fr/design/images/poly/" + pathName + '/' + pathName + '-' + index + ".png"; |
|
|
|
|
|
|
|
Icon icon = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
icon = BaseUtils.readIcon(path); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
icon = BaseUtils.readIcon("com/fr/design/images/poly/normal.png"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.setIcon(icon); |
|
|
|
|
|
|
|
this.setBorder(null); |
|
|
|
|
|
|
|
this.setMargin(null); |
|
|
|
|
|
|
|
this.setOpaque(false); |
|
|
|
|
|
|
|
this.setContentAreaFilled(false); |
|
|
|
|
|
|
|
this.setFocusPainted(false); |
|
|
|
|
|
|
|
this.setRequestFocusEnabled(false); |
|
|
|
|
|
|
|
this.addMouseListener(new MouseAdapter() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
|
|
|
|
if (DesignerMode.isAuthorityEditing()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BaseChart chart = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
chart = (BaseChart) ChartButton.this.chart.clone(); |
|
|
|
|
|
|
|
} catch (CloneNotSupportedException ex) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BaseChartCollection cc = creator.getValue().getChartCollection(); |
|
|
|
|
|
|
|
cc.switchPlot(chart.getBasePlot()); |
|
|
|
|
|
|
|
initEffective(cc); |
|
|
|
|
|
|
|
creator.setValue(creator.getValue()); |
|
|
|
|
|
|
|
ChartBlockEditor.this.removeAll(); |
|
|
|
|
|
|
|
ChartBlockEditor.this.initComponets(); |
|
|
|
|
|
|
|
ChartBlockEditor.this.initNorthBarComponent(); |
|
|
|
|
|
|
|
ChartBlockEditor.this.addColumnRowListeners(); |
|
|
|
|
|
|
|
ChartBlockEditor.this.addBoundsListener(); |
|
|
|
|
|
|
|
ChartBlockEditor.this.initDataChangeListener(); |
|
|
|
|
|
|
|
ChartBlockEditor.this.doLayout(); |
|
|
|
|
|
|
|
ChartBlockEditor.this.repaint(); |
|
|
|
|
|
|
|
QuickEditorRegion.getInstance().populate(creator.getQuickEditor(designer)); |
|
|
|
|
|
|
|
LayoutUtils.layoutRootContainer(designer); |
|
|
|
|
|
|
|
designer.fireTargetModified(); |
|
|
|
|
|
|
|
designer.repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
|
|
|
|
ChartButton.this.setBorder(buttonBorder); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
|
|
|
|
ChartButton.this.setBorder(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
|
|
|
return new Dimension(22, 22); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MiddleChartComponent getEditChartComponent() { |
|
|
|
public MiddleChartComponent getEditChartComponent() { |
|
|
|
return createEffective(); |
|
|
|
return createEffective(); |
|
|
|
} |
|
|
|
} |
|
|
|