Browse Source

REPORT-2897 9.0设计器修改

控件设置网页框
master
MoMeak 7 years ago
parent
commit
f4e24d4031
  1. 77
      designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java
  2. 15
      designer_base/src/com/fr/design/gui/frpane/ReportletParameterViewPane.java
  3. 19
      designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java

77
designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java

@ -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,11 +16,24 @@ 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 static final int P_W = 610;
private static final int P_H = 580;
private UITextField srcTextField; private UITextField srcTextField;
private ReportletParameterViewPane parameterViewPane; private ReportletParameterViewPane parameterViewPane;
private UICheckBox horizontalCheck; private UICheckBox horizontalCheck;
private UICheckBox verticalCheck; private UICheckBox verticalCheck;
private UIButton parameterViewPaneButton;
private List<ParameterProvider> list;
public IframeEditorDefinePane() { public IframeEditorDefinePane() {
this.initComponents(); this.initComponents();
@ -41,25 +50,59 @@ public class IframeEditorDefinePane extends AbstractDataModify<IframeEditor> {
contentPane.add(attr); contentPane.add(attr);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] rowSize = { p, p, p, p }; double[] rowSize = {p, p, p, p};
double[] columnSize = { p, f }; double[] columnSize = {p, f};
parameterViewPaneButton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
parameterViewPaneButton.addActionListener(parameterListener);
parameterViewPane = new ReportletParameterViewPane();
java.awt.Component[][] coms = { java.awt.Component[][] coms = {
{ horizontalCheck, null }, {horizontalCheck, null},
{ verticalCheck, null }, {verticalCheck, null},
{ new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() }, {new UILabel(Inter.getLocText("Form-Url")), srcTextField = new UITextField()},
{ new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } }; {new UILabel(Inter.getLocText("FR-Designer_Parameters")), parameterViewPaneButton}};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, 45, LayoutConstants.VGAP_LARGE);
contentPane.add(panel); contentPane.add(panel);
UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, contentPane);
this.add(uiExpandablePane, BorderLayout.NORTH); this.add(uiExpandablePane, BorderLayout.NORTH);
} }
ActionListener parameterListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
List<ParameterProvider> paraList = parameterViewPane.update();
list = new ArrayList<ParameterProvider>();
ParameterProvider pr = null;
for (ParameterProvider parameterProvider : paraList) {
try {
pr = (ParameterProvider) parameterProvider.clone();
} catch (CloneNotSupportedException e1) {
e1.printStackTrace();
}
list.add(pr);
}
UIDialog dialog = parameterViewPane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() {
@Override
public void doOk() {
// list = parameterViewPane.update();
}
@Override
public void doCancel() {
parameterViewPane.update(list);
}
});
dialog.setSize(P_W, P_H);
dialog.setVisible(true);
}
};
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {

15
designer_base/src/com/fr/design/gui/frpane/ReportletParameterViewPane.java

@ -23,6 +23,7 @@ import java.util.List;
/** /**
* Defin hyperlink. * Defin hyperlink.
* in fact,this is a TablEditorPane * in fact,this is a TablEditorPane
*
* @editor zhou * @editor zhou
* @since 2012-3-23下午3:48:10 * @since 2012-3-23下午3:48:10
*/ */
@ -53,6 +54,7 @@ public class ReportletParameterViewPane extends BasicPane {
/** /**
* 初始化组件 * 初始化组件
*
* @param actions Chart的热点链接actions * @param actions Chart的热点链接actions
* @param useParaType 类型 * @param useParaType 类型
*/ */
@ -63,8 +65,8 @@ public class ReportletParameterViewPane extends BasicPane {
ParameterTableModel model = new ParameterTableModel(valueEditorPane, valueRenderPane, this) { ParameterTableModel model = new ParameterTableModel(valueEditorPane, valueRenderPane, this) {
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
UITableEditAction[] tableEditActions = new UITableEditAction[] { new AddChartParameterAction(), new DeleteAction(this.component), UITableEditAction[] tableEditActions = new UITableEditAction[]{new AddChartParameterAction(), new DeleteAction(this.component),
new MoveUpAction(), new MoveDownAction() }; new MoveUpAction(), new MoveDownAction()};
return (UITableEditAction[]) ArrayUtils.addAll(tableEditActions, actions); return (UITableEditAction[]) ArrayUtils.addAll(tableEditActions, actions);
} }
}; };
@ -84,6 +86,7 @@ public class ReportletParameterViewPane extends BasicPane {
/** /**
* 增加事件监听 * 增加事件监听
*
* @param l 加的东东 * @param l 加的东东
*/ */
public void addTableEditorListener(TableModelListener l) { public void addTableEditorListener(TableModelListener l) {
@ -117,8 +120,14 @@ public class ReportletParameterViewPane extends BasicPane {
return editorPane.update(); return editorPane.update();
} }
public void update(List list) {
editorPane.update(list);
}
/** /**
* 更新 * 更新
*
* @return 数组 * @return 数组
*/ */
public KV[] updateKV() { public KV[] updateKV() {
@ -128,7 +137,7 @@ public class ReportletParameterViewPane extends BasicPane {
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
kv[i] = new KV(); kv[i] = new KV();
kv[i].setKey(list.get(i).getName()); kv[i].setKey(list.get(i).getName());
kv[i].setValue( list.get(i).getValue()); kv[i].setValue(list.get(i).getValue());
} }
return kv; return kv;
} }

19
designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java

@ -1,12 +1,12 @@
package com.fr.design.gui.itableeditorpane; package com.fr.design.gui.itableeditorpane;
import com.fr.design.constants.UIConstants;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
@ -61,11 +61,11 @@ public class UITableEditorPane<T> extends BasicPane {
} }
public UITableModelAdapter<T> getTableModel(){ public UITableModelAdapter<T> getTableModel() {
return tableModel; return tableModel;
} }
private void initbuttonPane(UITableEditAction[] action){ private void initbuttonPane(UITableEditAction[] action) {
buttonPane = new JPanel(); buttonPane = new JPanel();
if (action != null) { if (action != null) {
@ -87,6 +87,7 @@ public class UITableEditorPane<T> extends BasicPane {
/** /**
* 增加事件监听 * 增加事件监听
*
* @param l 加的东东 * @param l 加的东东
*/ */
public void addTableListener(TableModelListener l) { public void addTableListener(TableModelListener l) {
@ -95,6 +96,7 @@ public class UITableEditorPane<T> extends BasicPane {
/** /**
* 移除事件监听 * 移除事件监听
*
* @param l 去的东东 * @param l 去的东东
*/ */
public void removeTableListener(TableModelListener l) { public void removeTableListener(TableModelListener l) {
@ -108,7 +110,7 @@ public class UITableEditorPane<T> extends BasicPane {
public void populate(T[] objs) { public void populate(T[] objs) {
tableModel.clear(); tableModel.clear();
if(objs==null){ if (objs == null) {
return; return;
} }
for (T obj : objs) { for (T obj : objs) {
@ -126,6 +128,11 @@ public class UITableEditorPane<T> extends BasicPane {
return tableModel.getList(); return tableModel.getList();
} }
public void update(List list) {
tableModel.stopCellEditing();
tableModel.setList(list);
}
public int getSelectedRow() { public int getSelectedRow() {
return this.editTable.getSelectedRow(); return this.editTable.getSelectedRow();
} }
@ -134,7 +141,7 @@ public class UITableEditorPane<T> extends BasicPane {
return this.editTable.getSelectedColumn(); return this.editTable.getSelectedColumn();
} }
public JPanel getbuttonPane(){ public JPanel getbuttonPane() {
return buttonPane; return buttonPane;
} }

Loading…
Cancel
Save