Browse Source

条件显示,超链等弹出面板整理

master
mengao 7 years ago
parent
commit
3b1fe49d8e
  1. 109
      designer_chart/src/com/fr/plugin/chart/custom/component/VanChartHyperLinkPane.java
  2. 133
      designer_chart/src/com/fr/plugin/chart/designer/component/VanChartUIListControlPane.java
  3. 17
      designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionListControlPane.java
  4. 16
      designer_chart/src/com/fr/plugin/chart/designer/style/background/AlertLineListControlPane.java
  5. 21
      designer_chart/src/com/fr/plugin/chart/designer/style/background/BackgroundListControlPane.java

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

@ -10,13 +10,8 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.js.EmailJavaScript;
@ -28,16 +23,12 @@ import com.fr.js.NameJavaScriptGroup;
import com.fr.js.ParameterJavaScript;
import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.designer.component.VanChartUIListControlPane;
import com.fr.plugin.chart.designer.other.HyperlinkMapFactory;
import com.fr.stable.ListMap;
import com.fr.stable.Nameable;
import com.fr.stable.bridge.StableFactory;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@ -46,7 +37,7 @@ import java.util.Set;
/**
* Created by Fangjie on 2016/4/28.
*/
public class VanChartHyperLinkPane extends UIListControlPane {
public class VanChartHyperLinkPane extends VanChartUIListControlPane {
public VanChartHyperLinkPane() {
super();
@ -114,20 +105,7 @@ public class VanChartHyperLinkPane extends UIListControlPane {
return new NameJavaScriptGroup(res_array);
}
@Override
public void saveSettings() {
if (isPopulating) {
return;
}
update((VanChartPlot) plot);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
public void populate(Plot plot) {
//特殊处理,使用instanceof判断,处理连续弹窗问题
if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
popupEditDialog = new HyperDialog(cardPane);
}
this.plot = plot;
HashMap paneMap = getHyperlinkMap(plot);
@ -240,87 +218,4 @@ public class VanChartHyperLinkPane extends UIListControlPane {
}
return null;
}
protected void popupEditDialog(Point mousePos) {
//特殊处理,处理连续弹窗情况
if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
GUICoreUtils.centerWindow(popupEditDialog);
popupEditDialog.setVisible(true);
return;
}
super.popupEditDialog(mousePos);
}
// 点击"编辑"按钮,弹出面板
protected class HyperDialog extends JDialog {
private JComponent editPane;
private static final int WIDTH = 570;
private static final int HEIGHT = 490;
private UIButton okButton, cancelButton;
HyperDialog(JComponent pane) {
super(DesignerContext.getDesignerFrame(), true);
pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
this.editPane = pane;
JPanel editPaneWrapper = new JPanel(new BorderLayout());
editPaneWrapper.add(editPane, BorderLayout.CENTER);
this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER);
this.getContentPane().add(createControlButtonPane(), BorderLayout.SOUTH);
setSize(WIDTH, HEIGHT);
this.setVisible(false);
}
private JPanel createControlButtonPane() {
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0));
controlPane.add(buttonsPane, BorderLayout.EAST);
//确定
addOkButton(buttonsPane);
//取消
addCancelButton(buttonsPane);
controlPane.setBorder(BorderFactory.createEmptyBorder(10,0,10,0));
return controlPane;
}
private void addCancelButton(JPanel buttonsPane) {
cancelButton = new UIButton(Inter.getLocText("Cancel"));
buttonsPane.add(cancelButton);
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
doCancel();
}
});
}
private void addOkButton(JPanel buttonsPane) {
okButton = new UIButton(Inter.getLocText("OK"));
buttonsPane.add(okButton);
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
doOK();
}
});
}
public void doOK() {
saveSettings();
setVisible(false);
}
public void doCancel() {
setVisible(false);
}
}
}

133
designer_chart/src/com/fr/plugin/chart/designer/component/VanChartUIListControlPane.java

@ -0,0 +1,133 @@
package com.fr.plugin.chart.designer.component;
import com.fr.base.chart.BasePlot;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.Nameable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by mengao on 2017/9/8.
* 新图表UIListControlPane基础面板
*/
public abstract class VanChartUIListControlPane extends UIListControlPane {
public VanChartUIListControlPane() {
super();
}
public VanChartUIListControlPane(BasePlot plot) {
super(plot);
}
@Override
public void saveSettings() {
if (isPopulating) {
return;
}
update((Plot) plot);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
protected abstract void update(Plot plot);
//-------------------连续弹窗问题 start-------------------//
public void populate (Nameable[] nameableArray) {
//特殊处理,使用instanceof判断,弹出不同的面板
if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
popupEditDialog = new HyperDialog(cardPane);
}
super.populate(nameableArray);
}
protected void popupEditDialog(Point mousePos) {
//特殊处理,处理连续弹窗情况,弹出面板定为方式不同
if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
GUICoreUtils.centerWindow(popupEditDialog);
popupEditDialog.setVisible(true);
return;
}
super.popupEditDialog(mousePos);
}
// 点击"编辑"按钮,弹出面板(这个面板是弹窗里面的弹窗)
protected class HyperDialog extends JDialog {
private JComponent editPane;
private static final int WIDTH = 570;
private static final int HEIGHT = 490;
private UIButton okButton, cancelButton;
HyperDialog(JComponent pane) {
super(DesignerContext.getDesignerFrame(), true);
pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
this.editPane = pane;
JPanel editPaneWrapper = new JPanel(new BorderLayout());
editPaneWrapper.add(editPane, BorderLayout.CENTER);
this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER);
this.getContentPane().add(createControlButtonPane(), BorderLayout.SOUTH);
setSize(WIDTH, HEIGHT);
this.setVisible(false);
}
private JPanel createControlButtonPane() {
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0));
controlPane.add(buttonsPane, BorderLayout.EAST);
//确定
addOkButton(buttonsPane);
//取消
addCancelButton(buttonsPane);
controlPane.setBorder(BorderFactory.createEmptyBorder(10,0,10,0));
return controlPane;
}
private void addCancelButton(JPanel buttonsPane) {
cancelButton = new UIButton(Inter.getLocText("Cancel"));
buttonsPane.add(cancelButton);
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
doCancel();
}
});
}
private void addOkButton(JPanel buttonsPane) {
okButton = new UIButton(Inter.getLocText("OK"));
buttonsPane.add(okButton);
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
doOK();
}
});
}
public void doOK() {
saveSettings();
setVisible(false);
}
public void doCancel() {
setVisible(false);
}
}
}

17
designer_chart/src/com/fr/plugin/chart/designer/other/VanChartConditionListControlPane.java

@ -8,11 +8,9 @@ import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.designer.component.VanChartUIListControlPane;
import com.fr.stable.Nameable;
import java.lang.reflect.Constructor;
@ -22,7 +20,7 @@ import java.lang.reflect.InvocationTargetException;
* Created by mengao on 2017/8/18.
* 条件属性ListControlPane弹出条件属性设置面板
*/
public class VanChartConditionListControlPane extends UIListControlPane {
public class VanChartConditionListControlPane extends VanChartUIListControlPane {
public VanChartConditionListControlPane(BasePlot plot) {
super(plot);
@ -58,14 +56,6 @@ public class VanChartConditionListControlPane extends UIListControlPane {
return null;
}
@Override
public void saveSettings() {
if (isPopulating) {
return;
}
updateConditionCollection(((VanChartPlot) plot).getConditionCollection());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
@Override
public String getAddItemText() {
@ -81,7 +71,8 @@ public class VanChartConditionListControlPane extends UIListControlPane {
/**
* Update.
*/
public void updateConditionCollection(ConditionCollection cc) {
protected void update(Plot plot) {
ConditionCollection cc = plot.getConditionCollection();
Nameable[] nameables = this.update();
cc.clearConditionAttr();

16
designer_chart/src/com/fr/plugin/chart/designer/style/background/AlertLineListControlPane.java

@ -3,16 +3,14 @@ package com.fr.plugin.chart.designer.style.background;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.plugin.chart.attr.DefaultAxisHelper;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.designer.component.VanChartUIListControlPane;
import com.fr.stable.Nameable;
import java.util.ArrayList;
@ -22,17 +20,7 @@ import java.util.List;
* Created by mengao on 2017/8/22.
* 自定义警戒线列表面板
*/
public class AlertLineListControlPane extends UIListControlPane {
@Override
public void saveSettings() {
if (isPopulating) {
return;
}
update((VanChartPlot) plot);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
public class AlertLineListControlPane extends VanChartUIListControlPane {
@Override
public NameableCreator[] createNameableCreators() {

21
designer_chart/src/com/fr/plugin/chart/designer/style/background/BackgroundListControlPane.java

@ -3,8 +3,6 @@ package com.fr.plugin.chart.designer.style.background;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.NameObject;
@ -12,8 +10,8 @@ import com.fr.plugin.chart.attr.DefaultAxisHelper;
import com.fr.plugin.chart.attr.axis.VanChartAlertValue;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartCustomIntervalBackground;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.designer.component.VanChartUIListControlPane;
import com.fr.stable.Nameable;
import java.util.ArrayList;
@ -23,16 +21,7 @@ import java.util.List;
* Created by mengao on 2017/8/22.
* 自定义间隔背景列表面板
*/
public class BackgroundListControlPane extends UIListControlPane {
@Override
public void saveSettings() {
if (isPopulating) {
return;
}
update((VanChartPlot) plot, false);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
public class BackgroundListControlPane extends VanChartUIListControlPane {
@Override
public NameableCreator[] createNameableCreators() {
@ -93,6 +82,12 @@ public class BackgroundListControlPane extends UIListControlPane {
doLayout();
}
@Override
protected void update(Plot plot) {
update(plot, false);
}
public void update(Plot plot, boolean isDefaultIntervalBackground) {
Nameable[] nameables = this.update();

Loading…
Cancel
Save