Browse Source

面板重构

master
Fangjie Hu 8 years ago
parent
commit
1a6500d1a4
  1. 2
      designer_chart/src/com/fr/design/chart/gui/ChartComponent.java
  2. 6
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  3. 32
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

2
designer_chart/src/com/fr/design/chart/gui/ChartComponent.java

@ -315,7 +315,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
//不直接画chartGlyph而画image的原因是表单的柱形图会溢出表单
//其他图都ok,其实感觉应该是柱形图画的不对,应该也可以改那边
//处理画图事件
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this);
Image chartImage = chartGlyph.toImage(chartWidth,chartHeight,ScreenResolution.getScreenResolution(), this, null);
g2d.drawImage(chartImage, 0, 0, null);
}
}

6
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -283,12 +283,14 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private void changeCollectionSelected(String name) {
if (editingCollection != null) {
//图表切换事件生效
editingCollection.setChangeEvent(true);
int count = editingCollection.getChartCount();
for (int i = 0; i < count; i++) {
if (ComparatorUtils.equals(name, editingCollection.getChartName(i))) {
editingCollection.setSelectedIndex(i);
//重构面板
if (parent != null){
parent.relayOutEditPane(editingCollection.getSelectedChart());
}
break;
}
}

32
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -44,8 +44,6 @@ public class ChartTypePane extends AbstractChartAttrPane{
private SwitchState paneState = SwitchState.DEFAULT;
//记录当前面板是谁在使用切换状态
private String chartID = StringUtils.EMPTY;
//记录当前面板是否处在图表切换的事件状态
private boolean isChangEvent = false;
public SwitchState getPaneState() {
return paneState;
@ -62,17 +60,6 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void setChartID(String chartID) {
this.chartID = chartID;
}
//使用一次即失效
public boolean useChangEvent() {
boolean event = isChangEvent;
isChangEvent = false;
return event;
}
public void setChangEvent(boolean changEvent) {
isChangEvent = changEvent;
}
}
@Override
@ -179,12 +166,9 @@ public class ChartTypePane extends AbstractChartAttrPane{
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID)) || paneState.useChangEvent()){
if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){
editPane.reLayout(chart);
}
//重置面板切换事件状态
paneState.setChangEvent(false);
}
}
@ -278,6 +262,16 @@ public class ChartTypePane extends AbstractChartAttrPane{
}
/**
* 重构面板
* @param chart
*/
public void relayOutEditPane(Chart chart){
if (editPane != null){
editPane.reLayout(chart);
}
}
public void reactorChartTypePane(ChartCollection collection){
if (needReactor(collection)) {
@ -312,10 +306,6 @@ public class ChartTypePane extends AbstractChartAttrPane{
editingCollection = collection;
buttonPane.update(collection);// 内部操作时 已经做过处理.
Chart chart = collection.getSelectedChart();
//判断是否是图表切换事件
if (collection.useChangeEvent()){
paneState.setChangEvent(true);
}
chartTypePane.updateBean(chart);
}

Loading…
Cancel
Save