|
|
@ -1,17 +1,13 @@ |
|
|
|
package com.fr.design.widget.ui; |
|
|
|
package com.fr.design.widget.ui; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
|
|
|
|
import com.fr.design.dialog.DialogActionListener; |
|
|
|
|
|
|
|
import com.fr.design.dialog.UIDialog; |
|
|
|
import com.fr.design.foldablepane.UIExpandablePane; |
|
|
|
import com.fr.design.foldablepane.UIExpandablePane; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.gui.frpane.ReportletParameterViewPane; |
|
|
|
import com.fr.design.gui.frpane.ReportletParameterViewPane; |
|
|
|
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
@ -20,68 +16,114 @@ import com.fr.form.ui.IframeEditor; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> { |
|
|
|
public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> { |
|
|
|
private UITextField srcTextField; |
|
|
|
|
|
|
|
private ReportletParameterViewPane parameterViewPane; |
|
|
|
private static final int P_W = 610; |
|
|
|
private UICheckBox horizontalCheck; |
|
|
|
private static final int P_H = 580; |
|
|
|
private UICheckBox verticalCheck; |
|
|
|
private UITextField srcTextField; |
|
|
|
|
|
|
|
private ReportletParameterViewPane parameterViewPane; |
|
|
|
public IframeEditorDefinePane() { |
|
|
|
private UICheckBox horizontalCheck; |
|
|
|
this.initComponents(); |
|
|
|
private UICheckBox verticalCheck; |
|
|
|
} |
|
|
|
private UIButton parameterViewPaneButton; |
|
|
|
|
|
|
|
private List<ParameterProvider> list; |
|
|
|
private void initComponents() { |
|
|
|
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
|
|
public IframeEditorDefinePane() { |
|
|
|
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
this.initComponents(); |
|
|
|
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); |
|
|
|
} |
|
|
|
JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
|
|
|
|
|
|
|
attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible"))); |
|
|
|
private void initComponents() { |
|
|
|
attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible"))); |
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
contentPane.add(attr); |
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
double f = TableLayout.FILL; |
|
|
|
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); |
|
|
|
double[] rowSize = { p, p, p, p }; |
|
|
|
JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
|
|
|
double[] columnSize = { p, f }; |
|
|
|
attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible"))); |
|
|
|
|
|
|
|
attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible"))); |
|
|
|
java.awt.Component[][] coms = { |
|
|
|
contentPane.add(attr); |
|
|
|
{ horizontalCheck, null }, |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
{ verticalCheck, null }, |
|
|
|
double f = TableLayout.FILL; |
|
|
|
{ new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() }, |
|
|
|
double[] rowSize = {p, p, p, p}; |
|
|
|
{ new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } }; |
|
|
|
double[] columnSize = {p, f}; |
|
|
|
int[][] rowCount = {{1, 1},{1, 1},{1, 1}, {1, 1}}; |
|
|
|
|
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); |
|
|
|
parameterViewPaneButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); |
|
|
|
|
|
|
|
parameterViewPaneButton.addActionListener(parameterListener); |
|
|
|
|
|
|
|
parameterViewPane = new ReportletParameterViewPane(); |
|
|
|
contentPane.add(panel); |
|
|
|
|
|
|
|
|
|
|
|
java.awt.Component[][] coms = { |
|
|
|
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); |
|
|
|
{horizontalCheck, null}, |
|
|
|
this.add(uiExpandablePane, BorderLayout.NORTH); |
|
|
|
{verticalCheck, null}, |
|
|
|
|
|
|
|
{new UILabel(Inter.getLocText("Form-Url")), srcTextField = new UITextField()}, |
|
|
|
} |
|
|
|
{new UILabel(Inter.getLocText("FR-Designer_Parameters")), parameterViewPaneButton}}; |
|
|
|
|
|
|
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
|
|
|
|
|
|
|
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, 45, LayoutConstants.VGAP_LARGE); |
|
|
|
@Override |
|
|
|
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
|
|
|
return "iframe"; |
|
|
|
contentPane.add(panel); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, contentPane); |
|
|
|
@Override |
|
|
|
this.add(uiExpandablePane, BorderLayout.NORTH); |
|
|
|
public void populateBean(IframeEditor e) { |
|
|
|
|
|
|
|
srcTextField.setText(e.getSrc()); |
|
|
|
} |
|
|
|
parameterViewPane.populate(e.getParameters()); |
|
|
|
|
|
|
|
this.horizontalCheck.setSelected(e.isOverflowx()); |
|
|
|
ActionListener parameterListener = new ActionListener() { |
|
|
|
this.verticalCheck.setSelected(e.isOverflowy()); |
|
|
|
@Override |
|
|
|
} |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
List<ParameterProvider> paraList = parameterViewPane.update(); |
|
|
|
@Override |
|
|
|
list = new ArrayList<ParameterProvider>(); |
|
|
|
public IframeEditor updateBean() { |
|
|
|
ParameterProvider pr = null; |
|
|
|
IframeEditor ob = new IframeEditor(); |
|
|
|
for (ParameterProvider parameterProvider : paraList) { |
|
|
|
ob.setSrc(srcTextField.getText()); |
|
|
|
try { |
|
|
|
List<ParameterProvider> parameterList = parameterViewPane.update(); |
|
|
|
pr = (ParameterProvider) parameterProvider.clone(); |
|
|
|
ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()])); |
|
|
|
} catch (CloneNotSupportedException e1) { |
|
|
|
ob.setOverflowx(this.horizontalCheck.isSelected()); |
|
|
|
e1.printStackTrace(); |
|
|
|
ob.setOverflowy(this.verticalCheck.isSelected()); |
|
|
|
} |
|
|
|
return ob; |
|
|
|
list.add(pr); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIDialog dialog = parameterViewPane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void doOk() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void doCancel() { |
|
|
|
|
|
|
|
parameterViewPane.update(list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
dialog.setSize(P_W, P_H); |
|
|
|
|
|
|
|
dialog.setVisible(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
|
|
|
return "iframe"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void populateBean(IframeEditor e) { |
|
|
|
|
|
|
|
srcTextField.setText(e.getSrc()); |
|
|
|
|
|
|
|
parameterViewPane.populate(e.getParameters()); |
|
|
|
|
|
|
|
this.horizontalCheck.setSelected(e.isOverflowx()); |
|
|
|
|
|
|
|
this.verticalCheck.setSelected(e.isOverflowy()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public IframeEditor updateBean() { |
|
|
|
|
|
|
|
IframeEditor ob = new IframeEditor(); |
|
|
|
|
|
|
|
ob.setSrc(srcTextField.getText()); |
|
|
|
|
|
|
|
List<ParameterProvider> parameterList = parameterViewPane.update(); |
|
|
|
|
|
|
|
ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()])); |
|
|
|
|
|
|
|
ob.setOverflowx(this.horizontalCheck.isSelected()); |
|
|
|
|
|
|
|
ob.setOverflowy(this.verticalCheck.isSelected()); |
|
|
|
|
|
|
|
return ob; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |