Browse Source

merge

master
plough 7 years ago
parent
commit
5e19697e3e
  1. 15
      designer/src/com/fr/design/actions/insert/flot/AbstractShapeAction.java
  2. 124
      designer/src/com/fr/design/actions/insert/flot/ChartFloatAction.java
  3. 57
      designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  4. 17
      designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java
  5. 43
      designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java
  6. 22
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  7. 99
      designer/src/com/fr/design/mainframe/ReportFloatPane.java
  8. 1
      designer/src/com/fr/design/parameter/ParameterDefinitePane.java
  9. 55
      designer/src/com/fr/grid/GridMouseAdapter.java
  10. 23
      designer/src/com/fr/grid/GridUtils.java
  11. 267
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  12. 89
      designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java
  13. 201
      designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java
  14. 12
      designer_base/src/com/fr/design/locale/designer.properties
  15. 12
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  16. 33
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  17. 33
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  18. 8
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  19. 16
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  20. 8
      designer_base/src/com/fr/design/parameter/ParameterBridge.java
  21. 1
      designer_base/src/com/fr/design/parameter/ParameterDesignerProvider.java
  22. 294
      designer_base/src/com/fr/start/StartServer.java
  23. 188
      designer_form/src/com/fr/design/designer/creator/XLabel.java
  24. 13
      designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java
  25. 15
      designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java
  26. 224
      designer_form/src/com/fr/design/designer/creator/XWidgetCreator.java
  27. 166
      designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java

15
designer/src/com/fr/design/actions/insert/flot/AbstractShapeAction.java

@ -4,6 +4,7 @@
package com.fr.design.actions.insert.flot; package com.fr.design.actions.insert.flot;
import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.ElementCaseAction;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
@ -11,20 +12,20 @@ import com.fr.report.cell.FloatElement;
* Abstract shape. * Abstract shape.
*/ */
public abstract class AbstractShapeAction extends ElementCaseAction { public abstract class AbstractShapeAction extends ElementCaseAction {
protected AbstractShapeAction(ElementCasePane t) { protected AbstractShapeAction(ElementCasePane t) {
super(t); super(t);
} }
public void startDraw(FloatElement floatElement) { public void startDraw(FloatElement floatElement) {
ElementCasePane jws = getEditingComponent(); ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (jws == null) { if (jws == null) {
return; return;
} }
jws.getGrid().setDrawingFloatElement(floatElement); jws.getGrid().setDrawingFloatElement(floatElement);
} }
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
return false; return false;
} }
} }

124
designer/src/com/fr/design/actions/insert/flot/ChartFloatAction.java

@ -8,6 +8,7 @@ import com.fr.base.Style;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.chart.MiddleChartDialog; import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
@ -32,77 +33,78 @@ public class ChartFloatAction extends ElementCaseAction {
/** /**
* 构造函数 图表插入悬浮元素 * 构造函数 图表插入悬浮元素
*/ */
public ChartFloatAction(ElementCasePane t) { public ChartFloatAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(FLOAT_INSERT_CHART); this.setMenuKeySet(FLOAT_INSERT_CHART);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png"));
} }
public static final MenuKeySet FLOAT_INSERT_CHART = new MenuKeySet() { public static final MenuKeySet FLOAT_INSERT_CHART = new MenuKeySet() {
@Override @Override
public char getMnemonic() { public char getMnemonic() {
return 'C'; return 'C';
} }
@Override @Override
public String getMenuName() { public String getMenuName() {
return Inter.getLocText("M_Insert-Chart"); return Inter.getLocText("FR-Designer_Insert_Chart");
} }
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return null; return null;
} }
}; };
/** /**
* 执行插入悬浮元素操作, 并返回true, 需要记录撤销. * 执行插入悬浮元素操作, 并返回true, 需要记录撤销.
*
* @return 是则返回true * @return 是则返回true
*/ */
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
final ElementCasePane reportPane = getEditingComponent(); final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) { if (reportPane == null) {
return false; return false;
} }
reportPane.stopEditing(); reportPane.stopEditing();
final BaseChartCollection cc = (BaseChartCollection)StableFactory.createXmlObject(BaseChartCollection.XML_TAG); final BaseChartCollection cc = (BaseChartCollection) StableFactory.createXmlObject(BaseChartCollection.XML_TAG);
cc.removeAllNameObject(); cc.removeAllNameObject();
final MiddleChartDialog chartDialog = DesignModuleFactory.getChartDialog(DesignerContext.getDesignerFrame()); final MiddleChartDialog chartDialog = DesignModuleFactory.getChartDialog(DesignerContext.getDesignerFrame());
chartDialog.populate(cc); chartDialog.populate(cc);
chartDialog.addDialogActionListener(new DialogActionAdapter() { chartDialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
FloatElement newFloatElement; FloatElement newFloatElement;
try { try {
newFloatElement = new FloatElement(chartDialog.getChartCollection().clone()); newFloatElement = new FloatElement(chartDialog.getChartCollection().clone());
newFloatElement.setLeftDistance(new OLDPIX(20)); newFloatElement.setLeftDistance(new OLDPIX(20));
newFloatElement.setTopDistance(new OLDPIX(20)); newFloatElement.setTopDistance(new OLDPIX(20));
newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH)); newFloatElement.setWidth(new OLDPIX(BaseChartCollection.CHART_DEFAULT_WIDTH));
newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT)); newFloatElement.setHeight(new OLDPIX(BaseChartCollection.CHART_DEFAULT_HEIGHT));
Style style = newFloatElement.getStyle(); Style style = newFloatElement.getStyle();
if(style != null) { if (style != null) {
newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black, newFloatElement.setStyle(style.deriveBorder(Constants.LINE_NONE, Color.black,
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black,
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black,
Constants.LINE_NONE, Color.black)); Constants.LINE_NONE, Color.black));
} }
reportPane.getEditingElementCase().addFloatElement(newFloatElement); reportPane.getEditingElementCase().addFloatElement(newFloatElement);
reportPane.setSelection(new FloatSelection(newFloatElement.getName())); reportPane.setSelection(new FloatSelection(newFloatElement.getName()));
reportPane.fireTargetModified(); reportPane.fireTargetModified();
reportPane.fireSelectionChangeListener(); reportPane.fireSelectionChangeListener();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("Error in Float"); FRLogger.getLogger().error("Error in Float");
} }
} }
}); });
chartDialog.setVisible(true); chartDialog.setVisible(true);
return true; return true;
} }
} }

57
designer/src/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -4,11 +4,18 @@
package com.fr.design.actions.insert.flot; package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -17,10 +24,10 @@ import java.awt.event.ActionEvent;
* Insert formula. * Insert formula.
*/ */
public class FormulaFloatAction extends AbstractShapeAction { public class FormulaFloatAction extends AbstractShapeAction {
public FormulaFloatAction(ElementCasePane t) { public FormulaFloatAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(FLOAT_INSERT_FORMULA); this.setMenuKeySet(FLOAT_INSERT_FORMULA);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
} }
@ -33,7 +40,7 @@ public class FormulaFloatAction extends AbstractShapeAction {
@Override @Override
public String getMenuName() { public String getMenuName() {
return Inter.getLocText("HF-Insert_Formula"); return Inter.getLocText("FR-Designer_Insert_Formula");
} }
@Override @Override
@ -44,16 +51,48 @@ public class FormulaFloatAction extends AbstractShapeAction {
/** /**
* 动作 * 动作
*
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
ElementCasePane jws = getEditingComponent(); ElementCasePane jws = getEditingComponent();
if (jws == null) { if (jws == null) {
return; return;
} }
//
// FloatElement floatElement = new FloatElement(new Formula(""));
FloatElement floatElement = new FloatElement( new Formula(""));
this.startDraw(floatElement); this.startDraw(floatElement);
doWithDrawingFloatElement();
jws.getGrid().startEditing();
} }
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane();
TemplateElementCase report = reportPane.getEditingElementCase();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
int resolution = grid.getResolution();
int floatWdith = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
int floatHeight = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
FU evtX_fu = FU.valueOfPix((grid.getWidth() - floatWdith) / 2, resolution);
FU evtY_fu = FU.valueOfPix((grid.getHeight() - floatHeight) / 2, resolution);
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU());
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU());
grid.getDrawingFloatElement().setLeftDistance(leftDistance);
grid.getDrawingFloatElement().setTopDistance(topDistance);
report.addFloatElement(grid.getDrawingFloatElement());
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
}
} }

17
designer/src/com/fr/design/actions/insert/flot/ImageFloatAction.java

@ -8,6 +8,7 @@ import com.fr.base.ScreenResolution;
import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -28,12 +29,12 @@ import java.io.File;
*/ */
public class ImageFloatAction extends ElementCaseAction { public class ImageFloatAction extends ElementCaseAction {
private boolean returnValue = false; private boolean returnValue = false;
public ImageFloatAction(ElementCasePane t) { public ImageFloatAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(FLOAT_INSERT_IMAGE); this.setMenuKeySet(FLOAT_INSERT_IMAGE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
} }
@ -46,7 +47,7 @@ public class ImageFloatAction extends ElementCaseAction {
@Override @Override
public String getMenuName() { public String getMenuName() {
return Inter.getLocText("HF-Insert_Image"); return Inter.getLocText("FR-Designer_Insert_Image");
} }
@Override @Override
@ -57,10 +58,11 @@ public class ImageFloatAction extends ElementCaseAction {
/** /**
* 执行动作 * 执行动作
*
* @return 成功返回true * @return 成功返回true
*/ */
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
final ElementCasePane reportPane = getEditingComponent(); final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
if (reportPane == null) { if (reportPane == null) {
return false; return false;
} }
@ -96,9 +98,10 @@ public class ImageFloatAction extends ElementCaseAction {
returnValue = true; returnValue = true;
} }
} }
@Override @Override
public void doCancel() { public void doCancel() {
returnValue = false; returnValue = false;
} }
}); });
dialog.setVisible(true); dialog.setVisible(true);

43
designer/src/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -4,10 +4,17 @@
package com.fr.design.actions.insert.flot; package com.fr.design.actions.insert.flot;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -15,7 +22,7 @@ import java.awt.event.ActionEvent;
/** /**
* Insert textbox. * Insert textbox.
*/ */
public class TextBoxFloatAction extends AbstractShapeAction { public class TextBoxFloatAction extends AbstractShapeAction {
public TextBoxFloatAction(ElementCasePane t) { public TextBoxFloatAction(ElementCasePane t) {
super(t); super(t);
this.setMenuKeySet(FLOAT_INSERT_TEXT); this.setMenuKeySet(FLOAT_INSERT_TEXT);
@ -32,7 +39,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
@Override @Override
public String getMenuName() { public String getMenuName() {
return Inter.getLocText("M_Insert-Text"); return Inter.getLocText("FR-Designer_Insert_Text");
} }
@Override @Override
@ -54,5 +61,37 @@ public class TextBoxFloatAction extends AbstractShapeAction {
} }
FloatElement floatElement = new FloatElement("Text"); FloatElement floatElement = new FloatElement("Text");
this.startDraw(floatElement); this.startDraw(floatElement);
doWithDrawingFloatElement();
}
private void doWithDrawingFloatElement() {
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane();
;
Grid grid = jws.getGrid();
ElementCasePane reportPane = grid.getElementCasePane();
TemplateElementCase report = reportPane.getEditingElementCase();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
int resolution = grid.getResolution();
int floatWdith = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
int floatHeight = grid.getDrawingFloatElement().getWidth().toPixI(resolution);
FU evtX_fu = FU.valueOfPix((grid.getWidth() - floatWdith) / 2, resolution);
FU evtY_fu = FU.valueOfPix((grid.getHeight() - floatHeight) / 2, resolution);
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU());
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU());
grid.getDrawingFloatElement().setLeftDistance(leftDistance);
grid.getDrawingFloatElement().setTopDistance(topDistance);
report.addFloatElement(grid.getDrawingFloatElement());
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName()));
} }
} }

22
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -12,18 +12,21 @@ import com.fr.grid.selection.Selection;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.*; import com.fr.design.actions.cell.*;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.merge.MergeCellAction; import com.fr.design.actions.edit.merge.MergeCellAction;
import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -31,11 +34,17 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.report.core.SheetUtils; import com.fr.report.core.SheetUtils;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.page.ReportSettingsProvider;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
/** /**
* 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块. * 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块.
@ -71,13 +80,16 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this); hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (editingSelection instanceof FloatSelection) { if (editingSelection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
// EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); JPanel floatPane = new JPanel(new BorderLayout());
EastRegionContainerPane.getInstance().replaceFloatElementPane(QuickEditorRegion.getInstance()); floatPane.add(ReportFloatPane.getInstance(), BorderLayout.NORTH);
floatPane.add(QuickEditorRegion.getInstance(), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceFloatElementPane(floatPane);
} else { } else {
// 条件属性 // 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance(); ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(ElementCasePaneDelegate.this); conditionAttributesGroupPane.populate(ElementCasePaneDelegate.this);
EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance()); EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());

99
designer/src/com/fr/design/mainframe/ReportFloatPane.java

@ -0,0 +1,99 @@
package com.fr.design.mainframe;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* 悬浮元素
* Created by MoMeak on 2017/7/27.
*/
public class ReportFloatPane extends JPanel {
private static ReportFloatPane THIS;
private ElementCasePaneDelegate elementCasePaneDelegate;
private MenuDef insertFloatMenu;
private ReportFloatPane() {
initComponent();
}
public synchronized static final ReportFloatPane getInstance() {
if (THIS == null) {
THIS = new ReportFloatPane();
}
return THIS;
}
private void initComponent() {
this.setLayout(new BorderLayout());
UIToolbar topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout());
insertFloatMenu = createInsertToolBar();
topToolBar.add(createButtonUI());
topToolBar.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 0));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Add_FloatElement")), topToolBar},
};
JPanel leftTopPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 10));
this.add(leftTopPane, BorderLayout.NORTH);
}
private MenuDef createInsertToolBar() {
MenuDef insertFloatMenu = new MenuDef();
insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName());
insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float"));
insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png");
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane();
UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate);
for (int i = 0; i < actions.length; i++) {
insertFloatMenu.addShortCut(actions[i]);
}
return insertFloatMenu;
}
private UIButton createButtonUI() {
UIButton createdButton = insertFloatMenu.createUIButton();
// 此按钮单独抽出,不应使用工具栏外观
if (!createdButton.isOpaque()) {
createdButton.setOpaque(true);
createdButton.setNormalPainted(true);
createdButton.setBorderPaintedOnlyWhenPressed(false);
}
return createdButton;
}
public static void main(String[] args) {
// JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
// content.add(ReportFloatPane.getInstance(), BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(250, 400);
// jf.setVisible(true);
}
}

1
designer/src/com/fr/design/parameter/ParameterDefinitePane.java

@ -355,6 +355,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
reportParameterAttr.setShowWindow(bridge.isDisplay()); reportParameterAttr.setShowWindow(bridge.isDisplay());
reportParameterAttr.setAlign(bridge.getPosition()); reportParameterAttr.setAlign(bridge.getPosition());
reportParameterAttr.setBackground(bridge.getDataBackground()); reportParameterAttr.setBackground(bridge.getDataBackground());
reportParameterAttr.setUseParamsTemplate(bridge.isUseParamsTemplate());
} }
//这里不用 parameterUI 的原因是考虑到没有控件的时候设置宽度有效果但不保存,只有含有控件才保存属性 //这里不用 parameterUI 的原因是考虑到没有控件的时候设置宽度有效果但不保存,只有含有控件才保存属性
paraDesignEditor.getParaTarget().setDesignSize(new Dimension(bridge.getDesignWidth(), paraDesignEditor.getParaTarget().setDesignSize(new Dimension(bridge.getDesignWidth(),

55
designer/src/com/fr/grid/GridMouseAdapter.java

@ -25,7 +25,6 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -72,7 +71,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private int ECBlockGap = 40; private int ECBlockGap = 40;
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); private int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
protected GridMouseAdapter(Grid grid) { protected GridMouseAdapter(Grid grid) {
this.grid = grid; this.grid = grid;
@ -93,19 +92,15 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
grid.requestFocus(); grid.requestFocus();
} }
if (grid.getDrawingFloatElement() != null) { if (SwingUtilities.isRightMouseButton(evt)) {
doWithDrawingFloatElement(); doWithRightButtonPressed();
} else { } else {
if (SwingUtilities.isRightMouseButton(evt)) { doWithLeftButtonPressed(evt);
doWithRightButtonPressed(); }
} else { // 用户没有按住Shift键时,tempOldSelectedCell是一直变化的。如果一直按住shift,是不变的
doWithLeftButtonPressed(evt); ElementCasePane ePane = grid.getElementCasePane();
} if (!evt.isShiftDown() && ePane.getSelection() instanceof CellSelection) {
// 用户没有按住Shift键时,tempOldSelectedCell是一直变化的。如果一直按住shift,是不变的 tempOldSelectedCell = GridUtils.getAdjustEventColumnRow_withresolution(ePane, oldEvtX, oldEvtY, resolution);
ElementCasePane ePane = grid.getElementCasePane();
if (!evt.isShiftDown() && ePane.getSelection() instanceof CellSelection) {
tempOldSelectedCell = GridUtils.getAdjustEventColumnRow_withresolution(ePane, oldEvtX, oldEvtY,resolution);
}
} }
} }
@ -240,14 +235,9 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
boolean isDataChanged = false; boolean isDataChanged = false;
ElementCasePane reportPane = grid.getElementCasePane(); ElementCasePane reportPane = grid.getElementCasePane();
Selection selection = reportPane.getSelection(); Selection selection = reportPane.getSelection();
if (grid.getDrawingFloatElement() != null) {
if (grid.getDrawingFloatElement().getWidth().equal_zero() && grid.getDrawingFloatElement().getHeight().equal_zero()) { if (selection instanceof FloatSelection) {
grid.getDrawingFloatElement().setWidth(new OLDPIX(100)); grid.setCursor(new Cursor(Cursor.MOVE_CURSOR));
grid.getDrawingFloatElement().setHeight(new OLDPIX(100));
}
grid.setDrawingFloatElement(null);
} else if (selection instanceof FloatSelection) {
grid.setCursor(Cursor.getDefaultCursor());
} }
if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION) { if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION) {
if (selection instanceof CellSelection) { if (selection instanceof CellSelection) {
@ -586,16 +576,13 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
*/ */
private void mouseMoveOnGrid(int evtX, int evtY) { private void mouseMoveOnGrid(int evtX, int evtY) {
grid.setToolTipText(null); grid.setToolTipText(null);
if (grid.getDrawingFloatElement() != null) { Object[] floatElementCursor = GridUtils.getAboveFloatElementCursor(grid.getElementCasePane(), evtX, evtY);
grid.setCursor(UIConstants.DRAW_CURSOR); // august:是否是将要画悬浮元素,就是那个笔的形状 if (!ArrayUtils.isEmpty(floatElementCursor)) {// 鼠标在悬浮元素上移动
} else { grid.setCursor((Cursor) floatElementCursor[1]);
Object[] floatElementCursor = GridUtils.getAboveFloatElementCursor(grid.getElementCasePane(), evtX, evtY); } else {// 鼠标在单元格上移动
if (!ArrayUtils.isEmpty(floatElementCursor)) {// 鼠标在悬浮元素上移动 doMouseMoveOnCells(evtX, evtY);
grid.setCursor((Cursor) floatElementCursor[1]);
} else {// 鼠标在单元格上移动
doMouseMoveOnCells(evtX, evtY);
}
} }
} }
/** /**
@ -765,8 +752,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
FloatElement floatElement = (FloatElement) tmpFloatElementCursor[0]; FloatElement floatElement = (FloatElement) tmpFloatElementCursor[0];
String floatName = floatElement.getName(); String floatName = floatElement.getName();
reportPane.setSelection(new FloatSelection(floatName)); reportPane.setSelection(new FloatSelection(floatName));
double[] floatArray = GridUtils.caculateFloatElementLocations(floatElement, ReportHelper.getColumnWidthList(report), ReportHelper.getRowHeightList(report), reportPane // double[] floatArray = GridUtils.caculateFloatElementLocations(floatElement, ReportHelper.getColumnWidthList(report), ReportHelper.getRowHeightList(report), reportPane
.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue()); // .getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue());
double[] floatArray = GridUtils.caculateFloatElementLocations_withresolution(floatElement, ReportHelper.getColumnWidthList(report), ReportHelper.getRowHeightList(report), reportPane
.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue(), grid.getResolution());
int cursorType = ((Cursor) tmpFloatElementCursor[1]).getType(); int cursorType = ((Cursor) tmpFloatElementCursor[1]).getType();
if (cursorType == Cursor.MOVE_CURSOR) { if (cursorType == Cursor.MOVE_CURSOR) {

23
designer/src/com/fr/grid/GridUtils.java

@ -65,12 +65,11 @@ public class GridUtils {
Iterator flotIt = report.floatIterator(); Iterator flotIt = report.floatIterator();
while (flotIt.hasNext()) { while (flotIt.hasNext()) {
FloatElement tmpFloatElement = (FloatElement) flotIt.next(); FloatElement tmpFloatElement = (FloatElement) flotIt.next();
int resolution = reportPane.getGrid().getResolution();
//peter:计算悬浮元素的四个角落的位置. //peter:计算悬浮元素的四个角落的位置.
double[] floatArray = caculateFloatElementLocations(tmpFloatElement, ReportHelper.getColumnWidthList(report), double[] floatArray = caculateFloatElementLocations_withresolution(tmpFloatElement, ReportHelper.getColumnWidthList(report),
ReportHelper.getRowHeightList(report), reportPane.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue()); ReportHelper.getRowHeightList(report), reportPane.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue(), resolution);
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
//peter:悬浮元素的范围. //peter:悬浮元素的范围.
Rectangle2D floatElementRect = new Rectangle2D.Double(floatArray[0], floatArray[1], tmpFloatElement.getWidth().toPixD(resolution), tmpFloatElement.getHeight().toPixD(resolution)); Rectangle2D floatElementRect = new Rectangle2D.Double(floatArray[0], floatArray[1], tmpFloatElement.getWidth().toPixD(resolution), tmpFloatElement.getHeight().toPixD(resolution));
//peter:不是当前选中的悬浮元素,不支持六个改变大小的点. //peter:不是当前选中的悬浮元素,不支持六个改变大小的点.
@ -127,7 +126,19 @@ public class GridUtils {
public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList, public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList,
int verticalValue, int horizentalValue) { int verticalValue, int horizentalValue) {
// int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution);
double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution);
double floatX2 = floatX + floatElement.getWidth().toPixD(resolution);
double floatY2 = floatY + floatElement.getHeight().toPixD(resolution);
return new double[]{floatX, floatY, floatX2, floatY2};
}
public static double[] caculateFloatElementLocations_withresolution(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList,
int verticalValue, int horizentalValue, int resolution) {
double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution); double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution);
double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution); double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution);
@ -170,7 +181,7 @@ public class GridUtils {
double tmpIntIndex = 0; double tmpIntIndex = 0;
int selectedCellIndex = 0; int selectedCellIndex = 0;
// int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); int resolution = (int) (ScreenResolution.getScreenResolution() * JSliderPane.getInstance().resolutionTimes);
if (mouseEvtPosition < 0) { if (mouseEvtPosition < 0) {
selectedCellIndex = value; selectedCellIndex = value;
for (; true; selectedCellIndex--) { for (; true; selectedCellIndex--) {

267
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -3,8 +3,6 @@
*/ */
package com.fr.poly.creator; package com.fr.poly.creator;
import java.awt.Dimension;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -16,6 +14,8 @@ import com.fr.design.mainframe.*;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.present.ConditionAttributesGroupPane; import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.grid.GridUtils; import com.fr.grid.GridUtils;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
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;
@ -25,135 +25,146 @@ import com.fr.report.poly.PolyECBlock;
import com.fr.stable.unit.UNITConstants; import com.fr.stable.unit.UNITConstants;
import com.fr.stable.unit.UnitRectangle; import com.fr.stable.unit.UnitRectangle;
import javax.swing.*;
import java.awt.*;
/** /**
* @author richer * @author richer
* @since 6.5.4 创建于2011-5-5 单元格类型的聚合块编辑器 * @since 6.5.4 创建于2011-5-5 单元格类型的聚合块编辑器
*/ */
public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> { public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
private static final int HEIGHT_MORE = 5;
private static final int HEIGHT_MORE = 5;
public ECBlockEditor(PolyDesigner designer, ECBlockCreator creator) {
public ECBlockEditor(PolyDesigner designer, ECBlockCreator creator) { super(designer, creator);
super(designer, creator); }
}
@Override
@Override protected void initDataChangeListener() {
protected void initDataChangeListener() { editComponent.addTargetModifiedListener(new TargetModifiedListener() {
editComponent.addTargetModifiedListener(new TargetModifiedListener() {
@Override
@Override public void targetModified(TargetModifiedEvent e) {
public void targetModified(TargetModifiedEvent e) { designer.fireTargetModified();
designer.fireTargetModified(); }
} });
}); }
}
/**
/** * 获取当前编辑的组件
* 获取当前编辑的组件 *
* * @return 聚合报表组件
* @return 聚合报表组件 * @date 2014-11-24-下午3:49:12
* */
* public ECBlockPane createEffective() {
* @date 2014-11-24-下午3:49:12 PolyECBlock pcb = creator.getValue();
* if (editComponent == null) {
*/ editComponent = new ECBlockPane(designer, pcb, this);
public ECBlockPane createEffective() { }
PolyECBlock pcb = creator.getValue(); if (DesignerContext.getFormatState() == DesignerContext.FORMAT_STATE_NULL) {
if (editComponent == null) { editComponent.getGrid().setCursor(UIConstants.CELL_DEFAULT_CURSOR);
editComponent = new ECBlockPane(designer, pcb, this); }
} return editComponent;
if (DesignerContext.getFormatState() == DesignerContext.FORMAT_STATE_NULL) { }
editComponent.getGrid().setCursor(UIConstants.CELL_DEFAULT_CURSOR);
} @Override
return editComponent; protected void initSize() {
} resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
if (resolution == 0) {
@Override resolution = ScreenResolution.getScreenResolution();
protected void initSize() { }
resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution(); Dimension cornerSize = getCornerSize();
if (resolution == 0){ PolyECBlock block = getValue();
resolution = ScreenResolution.getScreenResolution(); UnitRectangle ub = block.getBounds();
} int x = ub.x.toPixI(resolution) - cornerSize.width - designer.getHorizontalValue();
Dimension cornerSize = getCornerSize(); int y = ub.y.toPixI(resolution) - cornerSize.height - designer.getVerticalValue();
PolyECBlock block = getValue(); int w = ub.width.toPixI(resolution) + cornerSize.width + PolyConstants.OPERATION_SIZE
UnitRectangle ub = block.getBounds(); + UNITConstants.DELTA.toPixI(resolution);
int x = ub.x.toPixI(resolution) - cornerSize.width - designer.getHorizontalValue(); int h = ub.height.toPixI(resolution) + cornerSize.height + PolyConstants.OPERATION_SIZE
int y = ub.y.toPixI(resolution) - cornerSize.height - designer.getVerticalValue(); + UNITConstants.DELTA.toPixI(resolution);
int w = ub.width.toPixI(resolution) + cornerSize.width + PolyConstants.OPERATION_SIZE setBounds(x, y, w, h);
+ UNITConstants.DELTA.toPixI(resolution); editComponent.getGrid().setVerticalExtent(
int h = ub.height.toPixI(resolution) + cornerSize.height + PolyConstants.OPERATION_SIZE GridUtils.getExtentValue(0, block.getRowHeightList_DEC(), editComponent.getGrid().getHeight(),
+ UNITConstants.DELTA.toPixI(resolution); resolution));
setBounds(x, y, w, h); editComponent.getGrid().setHorizontalExtent(
editComponent.getGrid().setVerticalExtent( GridUtils.getExtentValue(0, block.getColumnWidthList_DEC(), editComponent.getGrid().getWidth(),
GridUtils.getExtentValue(0, block.getRowHeightList_DEC(), editComponent.getGrid().getHeight(), resolution));
resolution)); }
editComponent.getGrid().setHorizontalExtent(
GridUtils.getExtentValue(0, block.getColumnWidthList_DEC(), editComponent.getGrid().getWidth(), public void setBounds(int x, int y, int width, int height) {
resolution)); int selfheight = height + HEIGHT_MORE;
} super.setBounds(x, y, width, selfheight);
}
public void setBounds(int x, int y, int width, int height) {
int selfheight = height + HEIGHT_MORE; @Override
super.setBounds(x, y, width, selfheight); protected Dimension getAddHeigthPreferredSize() {
} Dimension cornerSize = getCornerSize();
cornerSize.height = PolyConstants.OPERATION_SIZE;
@Override return cornerSize;
protected Dimension getAddHeigthPreferredSize() { }
Dimension cornerSize = getCornerSize();
cornerSize.height = PolyConstants.OPERATION_SIZE; @Override
return cornerSize; protected Dimension getAddWidthPreferredSize() {
} Dimension cornerSize = getCornerSize();
cornerSize.width = PolyConstants.OPERATION_SIZE;
@Override return cornerSize;
protected Dimension getAddWidthPreferredSize() { }
Dimension cornerSize = getCornerSize();
cornerSize.width = PolyConstants.OPERATION_SIZE; @Override
return cornerSize; protected RowOperationMouseHandler createRowOperationMouseHandler() {
} return new RowOperationMouseHandler.ECBlockRowOperationMouseHandler(designer, this);
}
@Override
protected RowOperationMouseHandler createRowOperationMouseHandler() { @Override
return new RowOperationMouseHandler.ECBlockRowOperationMouseHandler(designer, this); protected ColumnOperationMouseHandler createColumnOperationMouseHandler() {
} return new ColumnOperationMouseHandler.ECBlockColumnOperationMouseHandler(designer, this);
}
@Override
protected ColumnOperationMouseHandler createColumnOperationMouseHandler() { @Override
return new ColumnOperationMouseHandler.ECBlockColumnOperationMouseHandler(designer, this); public Dimension getCornerSize() {
} return editComponent.getCornerSize();
}
@Override
public Dimension getCornerSize() { /**
return editComponent.getCornerSize(); * 重置当前的选择状态, 用于更新右侧属性表
} *
* @date 2014-11-24-下午3:48:19
/** */
* 重置当前的选择状态, 用于更新右侧属性表 public void resetSelectionAndChooseState() {
* designer.setChooseType(SelectionType.INNER);
* if (BaseUtils.isAuthorityEditing()) {
* @date 2014-11-24-下午3:48:19 JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
* if (jTemplate.isJWorkBook()) {
*/ //清参数面板
public void resetSelectionAndChooseState() { jTemplate.removeParameterPaneSelection();
designer.setChooseType(SelectionType.INNER); }
if (BaseUtils.isAuthorityEditing()) { designer.noAuthorityEdit();
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); return;
if (jTemplate.isJWorkBook()) { }
//清参数面板 QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor());
jTemplate.removeParameterPaneSelection(); CellElementPropertyPane.getInstance().populate(editComponent);
} Selection Selection = ((JWorkBook) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate())).getEditingElementCasePane().getSelection();
designer.noAuthorityEdit(); if (Selection instanceof FloatSelection) {
return; EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
} JPanel floatPane = new JPanel(new BorderLayout());
QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor()); floatPane.add(ReportFloatPane.getInstance(), BorderLayout.NORTH);
CellElementPropertyPane.getInstance().populate(editComponent); floatPane.add(QuickEditorRegion.getInstance(), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance()); EastRegionContainerPane.getInstance().replaceFloatElementPane(floatPane);
} else {
// 超级链接 EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance());
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate() EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance()); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
hyperlinkGroupPane.populate(editComponent); EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
// 条件属性 }
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(editComponent); EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
}
// 超级链接
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate()
.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(editComponent);
// 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(editComponent);
}
} }

89
designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java

@ -1,39 +1,37 @@
package com.fr.quickeditor.floatquick; package com.fr.quickeditor.floatquick;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.FloatQuickEditor; import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FloatImageQuickEditor extends FloatQuickEditor { public class FloatImageQuickEditor extends FloatQuickEditor {
public FloatImageQuickEditor() { public FloatImageQuickEditor() {
super(); super();
UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); UIButton editbutton = new UIButton(Inter.getLocText("FR-Designer_Edit"));
editbutton.addActionListener(new ActionListener() { editbutton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showEditingDialog(); showEditingDialog();
} }
}); });
editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
editbutton.setMargin(null); editbutton.setMargin(null);
editbutton.setOpaque(false); editbutton.setOpaque(false);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{editbutton} new Component[]{editbutton}
}; };
@ -41,38 +39,39 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p}; double[] rowSize = {p};
JPanel pane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel pane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.add(pane,BorderLayout.CENTER); this.setBorder(BorderFactory.createEmptyBorder(10, 74, 10, 10));
this.add(pane, BorderLayout.CENTER);
} }
private void showEditingDialog() { private void showEditingDialog() {
final SelectImagePane imageEditorPane = new SelectImagePane(); final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(floatElement); imageEditorPane.populate(floatElement);
final Object oldValue = floatElement.getValue(); final Object oldValue = floatElement.getValue();
final Style oldStyle = floatElement.getStyle(); final Style oldStyle = floatElement.getStyle();
imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
CellImage cellImage = imageEditorPane.update(); CellImage cellImage = imageEditorPane.update();
if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) { if (!ComparatorUtils.equals(cellImage.getImage(), oldValue) || !ComparatorUtils.equals(cellImage.getStyle(), oldStyle)) {
floatElement.setValue(cellImage.getImage()); floatElement.setValue(cellImage.getImage());
floatElement.setStyle(cellImage.getStyle()); floatElement.setStyle(cellImage.getStyle());
fireTargetModified(); fireTargetModified();
} }
} }
}).setVisible(true); }).setVisible(true);
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
} }

201
designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

@ -1,102 +1,127 @@
package com.fr.quickeditor.floatquick; package com.fr.quickeditor.floatquick;
import java.awt.*; import com.fr.base.BaseUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.layout.TableLayout; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.ElementCasePane;
import com.fr.quickeditor.FloatQuickEditor; import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FloatStringQuickEditor extends FloatQuickEditor { public class FloatStringQuickEditor extends FloatQuickEditor {
private UITextField stringTextField; private JTextArea stringTextField;
private UIButton formulaButton;
// august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置
private boolean reserveInResult = false; // august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置
private boolean reserveOnWriteOrAnaly = true; private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true;
public FloatStringQuickEditor() {
super(); public FloatStringQuickEditor() {
double p = TableLayout.PREFERRED; super();
double f = TableLayout.FILL; stringTextField = new JTextArea();
double[] cloumnSize = {f}; initTextField();
double[] rowSize = {p}; formulaButton = new UIButton();
stringTextField = new UITextField(); formulaButton.setPreferredSize(new Dimension(25, 23));
Component[][] components = new Component[][]{ formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
new Component[]{stringTextField} formulaButton.addActionListener(getFormulaActionListener);
}; JPanel pane = new JPanel(new BorderLayout(5, 0));
JPanel pane = TableLayoutHelper.createTableLayoutPane(components,rowSize,cloumnSize) ; pane.add(stringTextField, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST);
formulaButton.setVisible(false);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.add(pane,BorderLayout.CENTER); this.add(pane, BorderLayout.NORTH);
} }
@Override private void initTextField() {
protected void refreshDetails() { stringTextField.setFont(new Font("Dialog", Font.PLAIN, 12));
String str = null; stringTextField.setOpaque(true);
Object value = floatElement.getValue(); stringTextField.setLineWrap(true);
if (value == null) { stringTextField.setWrapStyleWord(true);
str = StringUtils.EMPTY; stringTextField.setMargin(new Insets(5, 5, 5, 5));
} else if (value instanceof Formula) { stringTextField.setBorder(BorderFactory.createLineBorder(Color.gray));
Formula formula = (Formula)value; stringTextField.setBackground(Color.white);
str = formula.getContent(); }
reserveInResult = formula.isReserveInResult();
reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); ActionListener getFormulaActionListener = new ActionListener() {
} else { @Override
str = value.toString(); public void actionPerformed(ActionEvent e) {
} ((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing();
showText(str); }
} };
public void showText(String str) { @Override
stringTextField.getDocument().removeDocumentListener(documentListener); protected void refreshDetails() {
stringTextField.setText(str); String str = null;
stringTextField.getDocument().addDocumentListener(documentListener); Object value = floatElement.getValue();
} if (value == null) {
str = StringUtils.EMPTY;
DocumentListener documentListener = new DocumentListener() { } else if (value instanceof Formula) {
//MoMeak: 没拆文本框和公式所以需要这么个玩意
@Override formulaButton.setVisible(true);
public void insertUpdate(DocumentEvent e) { Formula formula = (Formula) value;
changeReportPaneCell(stringTextField.getText().trim()); str = formula.getContent();
} stringTextField.setLineWrap(false);
this.setBorder(BorderFactory.createEmptyBorder(10, 74, 10, 10));
@Override reserveInResult = formula.isReserveInResult();
public void removeUpdate(DocumentEvent e) { reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly();
changeReportPaneCell(stringTextField.getText().trim()); } else {
} str = value.toString();
}
@Override showText(str);
public void changedUpdate(DocumentEvent e) { }
changeReportPaneCell(stringTextField.getText().trim());
} public void showText(String str) {
stringTextField.getDocument().removeDocumentListener(documentListener);
}; stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener);
protected void changeReportPaneCell(String tmpText) { }
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText); DocumentListener documentListener = new DocumentListener() {
textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); @Override
floatElement.setValue(textFormula); public void insertUpdate(DocumentEvent e) {
} else { changeReportPaneCell(stringTextField.getText().trim());
Style style = floatElement.getStyle(); }
if (floatElement != null && style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) {
floatElement.setValue(tmpText); @Override
} else { public void removeUpdate(DocumentEvent e) {
floatElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); changeReportPaneCell(stringTextField.getText().trim());
} }
}
fireTargetModified(); @Override
stringTextField.requestFocus(); public void changedUpdate(DocumentEvent e) {
} changeReportPaneCell(stringTextField.getText().trim());
}
};
protected void changeReportPaneCell(String tmpText) {
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
Formula textFormula = new Formula(tmpText);
textFormula.setReserveInResult(reserveInResult);
textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly);
floatElement.setValue(textFormula);
} else {
Style style = floatElement.getStyle();
if (floatElement != null && style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) {
floatElement.setValue(tmpText);
} else {
floatElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText));
}
}
fireTargetModified();
stringTextField.requestFocus();
}
} }

12
designer_base/src/com/fr/design/locale/designer.properties

@ -2093,3 +2093,15 @@ FR-Designer_Datasource_Other_Attributes=Other_Attributes
FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_table_editing FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_table_editing
FR-Designer_CellElement_Property_Table=CellElement_Property_Table FR-Designer_CellElement_Property_Table=CellElement_Property_Table
FR-Designer_Add_Condition=Add Condition FR-Designer_Add_Condition=Add Condition
FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_T_Insert_Float=Insert_Float
FR-Designer_Add_FloatElement=Add_FloatElement
FR-Designer_Insert_Image=Insert_Image
FR-Designer_Insert-Chart=Insert-Chart
FR-Designer_Insert-Text=Insert-Text
FR-Designer_Insert_Formula=Insert_Formula
FR-Designer_Insert_Chart=
FR-Designer_Insert_Text=
FR-Designer_Double=

12
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2094,3 +2094,15 @@ FR-Designer_Datasource_Other_Attributes=Other_Attributes
FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_table_editing FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_table_editing
FR-Designer_CellElement_Property_Table=CellElement_Property_Table FR-Designer_CellElement_Property_Table=CellElement_Property_Table
FR-Designer_Add_Condition=Add Condition FR-Designer_Add_Condition=Add Condition
FR-Designer_Use_Params_Template=use parameter template
FR-Designer_Label_Name=label name
FR-Designer_T_Insert_Float=Insert_Float
FR-Designer_Add_FloatElement=Add_FloatElement
FR-Designer_Insert_Image=Insert_Image
FR-Designer_Insert_Chart=Insert-Chart
FR-Designer_Insert_Text=Insert-Text
FR-Designer_Insert_Formula=Insert_Formula
FR-Designer_Insert-Chart=
FR-Designer_Insert-Text=
FR-Designer_Double=

33
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -1982,7 +1982,6 @@ FR-Base_UnSignIn=\ \u672A\u30ED\u30B0\u30A4\u30F3
Every=\u6BCE Every=\u6BCE
CellWrite-Preview_Cell_Content=\u30BB\u30EB\u5185\u5BB9 CellWrite-Preview_Cell_Content=\u30BB\u30EB\u5185\u5BB9
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9 FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Permissions=\u6A29\u9650 FR-Designer_Permissions=\u6A29\u9650
FR-Designer_Form_Button=\u30DC\u30BF\u30F3 FR-Designer_Form_Button=\u30DC\u30BF\u30F3
FR-Designer_WF_Name=\u540D FR-Designer_WF_Name=\u540D
@ -2076,3 +2075,35 @@ FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing= FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table= FR-Designer_CellElement_Property_Table=
FR-Designer_Add_Condition= FR-Designer_Add_Condition=
FR-Designer_T_Insert_Float=
FR-Designer_Add_FloatElement=
FR-Designer_Insert_Image=
FR-Designer_Insert_Chart=
FR-Designer_Insert_Text=
FR-Designer_AlphaFine_Enable=
FR-Designer_AlphaFine_EnableAlphaFine=
FR-Designer_AlphaFine_EnableInternet=
FR-Designer_AlphaFine_EnableInternetSearch=
FR-Designer_AlphaFine_Shortcut_Config=
FR-Designer_AlphaFine_SearchRange=
FR-Designer_AlphaFine_Recommend=
FR-Designer-Plugin_Addon=
FR-Designer_Templates=
FR-Designer_Templates_Content=
FR-Designer_AlphaFine_ShowAll=
FR-Designer_AlphaFine_Latest=
FR-Designer_AlphaFine_ShowLess=
FR-Designer_AlphaFine=
FR-Designer-Alphafine_No_Remind=
FR-Designer_AlphaFine_NoResult=
FR-Designer_ConnectionFailed=
FR-Designer_NoResult=
FR-Designer-AlphaFine_SetShortcuts=
FR-Designer_Write_Enhance_Preview=
FR-Designer-StyleAlignment_Style_PartSpacing=
FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_Insert-Chart=
FR-Designer_Insert-Text=
FR-Designer_Insert_Formula=

33
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2074,3 +2074,36 @@ FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing= FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table= FR-Designer_CellElement_Property_Table=
FR-Designer_Add_Condition= FR-Designer_Add_Condition=
FR-Designer_T_Insert_Float=
FR-Designer_Add_FloatElement=
FR-Designer_Insert_Image=
FR-Designer_Insert_Chart=
FR-Designer_Insert_Text=
FR-Designer_Insert_Formula=
FR-Designer_AlphaFine_Enable=
FR-Designer_AlphaFine_EnableAlphaFine=
FR-Designer_AlphaFine_EnableInternet=
FR-Designer_AlphaFine_EnableInternetSearch=
FR-Designer_AlphaFine_Shortcut_Config=
FR-Designer_AlphaFine_SearchRange=
FR-Designer_AlphaFine_Recommend=
FR-Designer-Plugin_Addon=
FR-Designer_Templates=
FR-Designer_Templates_Content=
FR-Designer_AlphaFine_ShowAll=
FR-Designer_AlphaFine_Latest=
FR-Designer_AlphaFine_ShowLess=
FR-Designer_AlphaFine=
FR-Designer-Alphafine_No_Remind=
FR-Designer_AlphaFine_NoResult=
FR-Designer_ConnectionFailed=
FR-Designer_NoResult=
FR-Designer-AlphaFine_SetShortcuts=
FR-Designer_Write_Enhance_Preview=
FR-Designer_Scale_customButton=
FR-Designer-StyleAlignment_Style_PartSpacing=
FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_Insert-Chart=
FR-Designer_Insert-Text=

8
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2093,3 +2093,11 @@ FR-Designer_Datasource_Other_Attributes=\u5176\u4ED6\u5C5E\u6027
FR-Designer_Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u7528\u5355\u5143\u683C\u5C5E\u6027\u8868\u7F16\u8F91 FR-Designer_Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u7528\u5355\u5143\u683C\u5C5E\u6027\u8868\u7F16\u8F91
FR-Designer_CellElement_Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868 FR-Designer_CellElement_Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868
FR-Designer_Add_Condition=\u6DFB\u52A0\u6761\u4EF6 FR-Designer_Add_Condition=\u6DFB\u52A0\u6761\u4EF6
FR-Designer_Use_Params_Template=\u4F7F\u7528\u5E38\u7528\u53C2\u6570\u7EC4\u5408
FR-Designer_Label_Name=\u6807\u7B7E\u540D\u79F0
FR-Designer_T_Insert_Float=\u63D2\u5165\u60AC\u6D6E\u5143\u7D20
FR-Designer_Add_FloatElement=\u6DFB\u52A0\u5143\u7D20
FR-Designer_Insert_Image=\u63D2\u5165\u56FE\u7247
FR-Designer_Insert_Chart=\u63D2\u5165\u56FE\u8868
FR-Designer_Insert_Text=\u63D2\u5165\u666E\u901A\u6587\u672C
FR-Designer_Insert_Formula=\u63D2\u5165\u516C\u5F0F

16
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2092,4 +2092,18 @@ FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes= FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing= FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table= FR-Designer_CellElement_Property_Table=
FR-Designer_Add_Condition= FR-Designer_Add_Condition=
FR-Designer_T_Insert_Float=
FR-Designer_Add_FloatElement=
FR-Designer_Insert_Image=
FR-Designer_Insert_Chart=
FR-Designer_Insert_Text=
FR-Designer_Insert_Formula=
FR-Designer_AlphaFine_EnableInternet=
FR-Designer_Scale_EnlargeOrReduce=
FR-Designer-StyleAlignment_Style_PartSpacing=
FR-Designer_Use_Params_Template=
FR-Designer_Label_Name=
FR-Designer_Insert-Chart=
FR-Designer_Insert-Text=

8
designer_base/src/com/fr/design/parameter/ParameterBridge.java

@ -16,6 +16,12 @@ public interface ParameterBridge {
*/ */
public boolean isDelayDisplayContent(); public boolean isDelayDisplayContent();
/**
* 是否启用参数模板
* @return 显示参数模板界面则返回true否则返回false
*/
public boolean isUseParamsTemplate();
/** /**
* 是否显示参数界面 * 是否显示参数界面
* @return 显示参数界面则返回true否则返回false * @return 显示参数界面则返回true否则返回false
@ -48,4 +54,6 @@ public interface ParameterBridge {
public void setDisplay(boolean showWindow); public void setDisplay(boolean showWindow);
public void setBackground(Background background); public void setBackground(Background background);
public void setUseParamsTemplate(boolean isUse);
} }

1
designer_base/src/com/fr/design/parameter/ParameterDesignerProvider.java

@ -68,5 +68,4 @@ public interface ParameterDesignerProvider {
void removeSelection(); void removeSelection();
ParameterBridge getParaComponent(); ParameterBridge getParaComponent();
} }

294
designer_base/src/com/fr/start/StartServer.java

@ -28,173 +28,173 @@ import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
public class StartServer { public class StartServer {
public static boolean NEED_LOAD_ENV = true; public static boolean NEED_LOAD_ENV = true;
// 原先的jettyHost放在类JettyHost里面,很不方便操作,而且因为存在多个进程的原因, // 原先的jettyHost放在类JettyHost里面,很不方便操作,而且因为存在多个进程的原因,
// 原先的getInstance()方法无多大意义 // 原先的getInstance()方法无多大意义
private static JettyHost jettyHost = null; private static JettyHost jettyHost = null;
static { static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() { GeneralContext.addEnvChangedListener(new EnvChangedListener() {
public void envChanged() { public void envChanged() {
currentEnvChanged(); currentEnvChanged();
} }
}); });
} }
/** /**
* 预览Demo * 预览Demo
* 找默认工作目录不应该按照名字去找而应该按照安装路径因为默认工作目录的名字可能会改变 * 找默认工作目录不应该按照名字去找而应该按照安装路径因为默认工作目录的名字可能会改变
*/ */
public static void browserDemoURL() { public static void browserDemoURL() {
if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用 if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用
String web = GeneralContext.getCurrentAppNameOfEnv(); String web = GeneralContext.getCurrentAppNameOfEnv();
browserURLWithLocalEnv("http://localhost:" + DesignerEnvManager.getEnvManager().getJettyServerPort() + "/" + web + "/" + ConfigManager.getProviderInstance().getServletMapping() browserURLWithLocalEnv("http://localhost:" + DesignerEnvManager.getEnvManager().getJettyServerPort() + "/" + web + "/" + ConfigManager.getProviderInstance().getServletMapping()
+ "?op=fs"); + "?op=fs");
return; return;
} }
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
if (!envManager.isCurrentEnvDefault()) { if (!envManager.isCurrentEnvDefault()) {
InformationPane inf = new InformationPane(envManager.getDefaultEnvName()); InformationPane inf = new InformationPane(envManager.getDefaultEnvName());
inf.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { inf.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
try { try {
SignIn.signIn(DesignerEnvManager.getEnvManager().getDefaultEnv()); SignIn.signIn(DesignerEnvManager.getEnvManager().getDefaultEnv());
TemplateTreePane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage()); FRContext.getLogger().errorWithServerLevel(e.getMessage());
} }
initDemoServerAndBrowser(); initDemoServerAndBrowser();
} }
}).setVisible(true); }).setVisible(true);
} else { } else {
initDemoServerAndBrowser(); initDemoServerAndBrowser();
} }
} }
private static void initDemoServerAndBrowser() { private static void initDemoServerAndBrowser() {
if (jettyHost != null) { if (jettyHost != null) {
if (!jettyHost.isDemoAppLoaded()) { if (!jettyHost.isDemoAppLoaded()) {
jettyHost.exit(); jettyHost.exit();
jettyHost = new JettyHost(DesignerEnvManager.getEnvManager().getJettyServerPort()); jettyHost = new JettyHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
jettyHost.addAndStartInstallHomeWebApp(); jettyHost.addAndStartInstallHomeWebApp();
} }
} else { } else {
jettyHost = new JettyHost(DesignerEnvManager.getEnvManager().getJettyServerPort()); jettyHost = new JettyHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
jettyHost.addAndStartInstallHomeWebApp(); jettyHost.addAndStartInstallHomeWebApp();
} }
try { try {
if (!jettyHost.isStarted()) { if (!jettyHost.isStarted()) {
jettyHost.start(); jettyHost.start();
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage()); FRContext.getLogger().errorWithServerLevel(e.getMessage());
} finally { } finally {
//先访问Demo, 后访问报表, 不需要重置服务器. //先访问Demo, 后访问报表, 不需要重置服务器.
NEED_LOAD_ENV = false; NEED_LOAD_ENV = false;
browser("http://localhost:" + DesignerEnvManager.getEnvManager().getJettyServerPort() + "/" + ProjectConstants.WEBAPP_NAME + "/" + ConfigManager.getProviderInstance().getServletMapping() browser("http://localhost:" + DesignerEnvManager.getEnvManager().getJettyServerPort() + "/" + ProjectConstants.WEBAPP_NAME + "/" + ConfigManager.getProviderInstance().getServletMapping()
+ "?op=fs"); + "?op=fs");
} }
} }
/** /**
* 本地环境浏览url * 本地环境浏览url
* *
* @param url 指定路径 * @param url 指定路径
*/ */
public static void browserURLWithLocalEnv(String url) { public static void browserURLWithLocalEnv(String url) {
try { try {
if (jettyHost != null) { if (jettyHost != null) {
if (NEED_LOAD_ENV) { if (NEED_LOAD_ENV) {
jettyHost.exit(); jettyHost.exit();
jettyHost = new JettyHost(DesignerEnvManager.getEnvManager().getJettyServerPort()); jettyHost = new JettyHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
jettyHost.addAndStartLocalEnvHomeWebApp(); jettyHost.addAndStartLocalEnvHomeWebApp();
} }
} else { } else {
jettyHost = new JettyHost(DesignerEnvManager.getEnvManager().getJettyServerPort()); jettyHost = new JettyHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
jettyHost.addAndStartLocalEnvHomeWebApp(); jettyHost.addAndStartLocalEnvHomeWebApp();
} }
if (!jettyHost.isStarted()) { if (!jettyHost.isStarted()) {
jettyHost.start(); jettyHost.start();
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage()); FRContext.getLogger().errorWithServerLevel(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage()); FRContext.getLogger().errorWithServerLevel(e.getMessage());
} finally { } finally {
NEED_LOAD_ENV = false; NEED_LOAD_ENV = false;
browser(url); browser(url);
} }
} }
public static JettyHost getInstance() { public static JettyHost getInstance() {
// august: 正确的逻辑能保证jettyHost不为null,不然就有bug,不允许这儿加是否等于null判断 // august: 正确的逻辑能保证jettyHost不为null,不然就有bug,不允许这儿加是否等于null判断
return jettyHost; return jettyHost;
} }
/** /**
* 运行环境改变事件 * 运行环境改变事件
*/ */
public static void currentEnvChanged() { public static void currentEnvChanged() {
if (!NEED_LOAD_ENV) { if (!NEED_LOAD_ENV) {
NEED_LOAD_ENV = true; NEED_LOAD_ENV = true;
} }
} }
private static void browser(String uri) { private static void browser(String uri) {
if (StringUtils.isEmpty(uri)) { if (StringUtils.isEmpty(uri)) {
FRContext.getLogger().info("The URL is empty!"); FRContext.getLogger().info("The URL is empty!");
return; return;
} }
try { try {
Desktop.getDesktop().browse(new URI(uri)); Desktop.getDesktop().browse(new URI(uri));
} catch (IOException e) { } catch (IOException e) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
FRContext.getLogger().error("Can not open the browser for URL: " + uri); FRContext.getLogger().error("Can not open the browser for URL: " + uri);
} }
} }
private static class InformationPane extends BasicPane { private static class InformationPane extends BasicPane {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public InformationPane(String message) { public InformationPane(String message) {
this.setLayout(new BorderLayout(10, 10)); this.setLayout(new BorderLayout(10, 10));
this.setBorder(BorderFactory.createEmptyBorder(15, 5, 5, 5)); this.setBorder(BorderFactory.createEmptyBorder(15, 5, 5, 5));
String text; String text;
if (!ComparatorUtils.equals(message, Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}))) { if (!ComparatorUtils.equals(message, Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}))) {
text = new StringBuffer(Inter.getLocText("FR-Designer_Open")) text = new StringBuffer(Inter.getLocText("FR-Designer_Open"))
.append(ProductConstants.APP_NAME) .append(ProductConstants.APP_NAME)
.append(Inter.getLocText("FR-Designer_Utils-OpenDemoEnv")) .append(Inter.getLocText("FR-Designer_Utils-OpenDemoEnv"))
.append(message).append(Inter.getLocText("FR-Designer_Utils-switch")).toString(); .append(message).append(Inter.getLocText("FR-Designer_Utils-switch")).toString();
}else{ } else {
text = new StringBuffer(Inter.getLocText("FR-Designer_Open")) text = new StringBuffer(Inter.getLocText("FR-Designer_Open"))
.append(ProductConstants.APP_NAME) .append(ProductConstants.APP_NAME)
.append(Inter.getLocText("FR-Designer_Utils-NewDemoEnv")) .append(Inter.getLocText("FR-Designer_Utils-NewDemoEnv"))
.append(message).append(Inter.getLocText("FR-Designer_Utils-switch")).toString(); .append(message).append(Inter.getLocText("FR-Designer_Utils-switch")).toString();
} }
UITextArea a = new UITextArea(text); UITextArea a = new UITextArea(text);
a.setFont(new Font("Dialog", Font.PLAIN, 12)); a.setFont(new Font("Dialog", Font.PLAIN, 12));
a.setEditable(false); a.setEditable(false);
a.setBackground(this.getBackground()); a.setBackground(this.getBackground());
a.setLineWrap(true); a.setLineWrap(true);
this.add(a); this.add(a);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Tooltips"); return Inter.getLocText("FR-Designer_Tooltips");
} }
} }
} }

188
designer_form/src/com/fr/design/designer/creator/XLabel.java

@ -3,19 +3,11 @@
*/ */
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.beans.IntrospectionException;
import javax.swing.JComponent;
import javax.swing.SwingConstants;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.widget.editors.FontEditor; import com.fr.design.mainframe.widget.editors.FontEditor;
import com.fr.design.mainframe.widget.editors.ItemCellEditor; import com.fr.design.mainframe.widget.editors.ItemCellEditor;
@ -23,98 +15,114 @@ import com.fr.design.mainframe.widget.editors.WidgetValueEditor;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer; import com.fr.design.mainframe.widget.renderer.FontCellRenderer;
import com.fr.design.mainframe.widget.renderer.LabelHorizontalAlignmentRenderer; import com.fr.design.mainframe.widget.renderer.LabelHorizontalAlignmentRenderer;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
import com.fr.design.form.util.XCreatorConstants; import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.beans.IntrospectionException;
/** /**
* @author richer * @author richer
* @since 6.5.3 * @since 6.5.3
*/ */
public class XLabel extends XWidgetCreator { public class XLabel extends XWidgetCreator {
private int cornerSize = 15;
public XLabel(Label widget, Dimension initSize) { private int cornerSize = 15;
super(widget, initSize);
} public XLabel(Label widget, Dimension initSize) {
super(widget, initSize);
}
/**
* 生成creator对应的控件widget
*
* @return 控件widget
*/
public Label toData() {
return (Label) data;
}
/**
* 返回组件属性值
*
* @return 返回组件属性值
* @throws IntrospectionException 异常
*/
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(),
new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(
WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
XCreator parent = (XCreator) XLabel.this.getParent();
((WParameterLayout) parent.toData()).refreshTagList();
}
}),
new CRPropertyDescriptor("wrap", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("verticalCenter", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_PageSetup-Vertically")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("textalign", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Alignment-Style")).setEditorClass(ItemCellEditor.class)
.setRendererClass(LabelHorizontalAlignmentRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_Font"))
.setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced")});
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Label label = (Label) data;
Dimension size = this.getSize();
//先画背景,再画标题
if (toData().getBackground() != null) {
toData().getBackground().paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()));
}
if (label.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create();
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), label.getWidgetValue()
.toString(), Style.getInstance(label.getFont()).deriveHorizontalAlignment(label.getTextalign())
.deriveVerticalAlignment(label.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP)
.deriveTextStyle(label.isWrap() ? Style.TEXTSTYLE_WRAPTEXT : Style.TEXTSTYLE_SINGLELINE),
ScreenResolution.getScreenResolution());
}
}
@Override
protected JComponent initEditor() {
if (editor == null) {
editor = new UILabel();
}
return editor;
}
/** @Override
* 生成creator对应的控件widget protected void initXCreatorProperties() {
* @return 控件widget super.initXCreatorProperties();
*/ if (toData().getBorder() != Constants.LINE_NONE) {
public Label toData() { this.setBorder(new UIRoundedBorder(toData().getBorder(), toData().getColor(), toData().isCorner() ? cornerSize : 0));
return (Label) data; } else {
} this.setBorder(DEFALUTBORDER);
}
/** }
* 返回组件属性值
* @return 返回组件属性值
* @throws IntrospectionException 异常
*/
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(),
new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"FR-Designer_Widget", "Value"})).setEditorClass(
WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("wrap", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_StyleAlignment-Wrap_Text")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("verticalCenter", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_PageSetup-Vertically")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("textalign", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Alignment-Style")).setEditorClass(ItemCellEditor.class)
.setRendererClass(LabelHorizontalAlignmentRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_Font"))
.setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced") });
}
@Override @Override
public void paintComponent(Graphics g) { protected String getIconName() {
super.paintComponent(g); return "label_16.png";
Label label = (Label) data; }
Dimension size = this.getSize();
//先画背景,再画标题
if (toData().getBackground() != null) {
toData().getBackground().paint(g,new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()));
}
if (label.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create();
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), label.getWidgetValue()
.toString(), Style.getInstance(label.getFont()).deriveHorizontalAlignment(label.getTextalign())
.deriveVerticalAlignment(label.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP)
.deriveTextStyle(label.isWrap() ? Style.TEXTSTYLE_WRAPTEXT : Style.TEXTSTYLE_SINGLELINE),
ScreenResolution.getScreenResolution());
}
}
@Override
protected JComponent initEditor() {
if (editor == null) {
editor = new UILabel();
}
return editor;
}
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
if (toData().getBorder() != Constants.LINE_NONE) {
this.setBorder(new UIRoundedBorder(toData().getBorder(), toData().getColor(), toData().isCorner() ? cornerSize : 0));
} else {
this.setBorder(DEFALUTBORDER);
}
}
@Override
protected String getIconName() {
return "label_16.png";
}
} }

13
designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java

@ -412,6 +412,15 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
return false; return false;
} }
/**
* 是否启用参数模板
* @return 显示参数模板界面则返回true否则返回false
*/
public boolean isUseParamsTemplate() {
return false;
}
/** /**
* 是否显示参数界面 * 是否显示参数界面
* *
@ -485,6 +494,10 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
} }
public void setUseParamsTemplate(boolean isUse) {
}
public void setPosition(int align) { public void setPosition(int align) {
} }

15
designer_form/src/com/fr/design/designer/creator/XWParameterLayout.java

@ -67,6 +67,9 @@ public class XWParameterLayout extends XWAbsoluteLayout {
new CRPropertyDescriptor("position", this.data.getClass()).setEditorClass(WidgetDisplayPosition.class) new CRPropertyDescriptor("position", this.data.getClass()).setEditorClass(WidgetDisplayPosition.class)
.setRendererClass(WidgetDisplayPositionRender.class).setI18NName(Inter.getLocText("FR-Designer_WidgetDisplyPosition")) .setRendererClass(WidgetDisplayPositionRender.class).setI18NName(Inter.getLocText("FR-Designer_WidgetDisplyPosition"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("useParamsTemplate", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("FR-Designer_Use_Params_Template"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
}; };
ParameterWindowEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ParameterWindowEditorProcessor.MARK_STRING); ParameterWindowEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ParameterWindowEditorProcessor.MARK_STRING);
@ -124,6 +127,14 @@ public class XWParameterLayout extends XWAbsoluteLayout {
return toData().isDelayDisplayContent(); return toData().isDelayDisplayContent();
} }
/**
* 是否启用参数模板
* @return 显示参数模板界面则返回true否则返回false
*/
public boolean isUseParamsTemplate() {
return toData().isUseParamsTemplate();
}
/** /**
* 是否显示参数界面 * 是否显示参数界面
* @return 显示参数界面则返回true否则返回false * @return 显示参数界面则返回true否则返回false
@ -152,6 +163,10 @@ public class XWParameterLayout extends XWAbsoluteLayout {
this.toData().setDelayDisplayContent(delayPlaying); this.toData().setDelayDisplayContent(delayPlaying);
} }
public void setUseParamsTemplate(boolean isUse) {
this.toData().setUseParamsTemplate(isUse);
}
public void setPosition(int align){ public void setPosition(int align){
this.toData().setPosition(align); this.toData().setPosition(align);
} }

224
designer_form/src/com/fr/design/designer/creator/XWidgetCreator.java

@ -3,17 +3,17 @@
*/ */
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import java.awt.*;
import java.beans.IntrospectionException;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.beans.IntrospectionException;
/** /**
* @author richer * @author richer
@ -21,8 +21,8 @@ import javax.swing.*;
*/ */
public abstract class XWidgetCreator extends XCreator { public abstract class XWidgetCreator extends XCreator {
protected static final float FULL_OPACITY = 1.0f; protected static final float FULL_OPACITY = 1.0f;
protected static final float HALF_OPACITY = 0.4f; protected static final float HALF_OPACITY = 0.4f;
public XWidgetCreator(Widget widget, Dimension initSize) { public XWidgetCreator(Widget widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
@ -31,35 +31,41 @@ public abstract class XWidgetCreator extends XCreator {
/** /**
* 待说明 * 待说明
* @return 待说明 *
* @return 待说明
* @throws IntrospectionException * @throws IntrospectionException
*/ */
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] { return new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("Form-Widget_Name")), .getLocText("Form-Widget_Name")),
new CRPropertyDescriptor("enabled", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_Enabled")) new CRPropertyDescriptor("enabled", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_Enabled"))
.setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override
public void propertyChange() { public void propertyChange() {
setEnabled(toData().isEnabled()); setEnabled(toData().isEnabled());
} }
}), }),
new CRPropertyDescriptor("visible", this.data.getClass()).setI18NName( new CRPropertyDescriptor("visible", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Widget-Visible")).setPropertyChangeListener(new PropertyChangeAdapter() { Inter.getLocText("FR-Designer_Widget-Visible")).setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override
public void propertyChange() { public void propertyChange() {
makeVisible(toData().isVisible()); makeVisible(toData().isVisible());
} }
}) }; }),
new CRPropertyDescriptor("labelName", this.data.getClass(), "getLabelName", "setLabelName")
.setI18NName(Inter.getLocText("FR-Designer_Label_Name"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "FR-Designer_Advanced")
};
} }
/** /**
* 待说明 * 待说明
* @return 待说明 *
* @return 待说明
*/ */
public Widget toData() { public Widget toData() {
return this.data; return this.data;
@ -80,94 +86,96 @@ public abstract class XWidgetCreator extends XCreator {
} }
protected void makeVisible(boolean visible) { protected void makeVisible(boolean visible) {
} }
public class LimpidButton extends JButton { public class LimpidButton extends JButton {
private String name; private String name;
private String imagePath; private String imagePath;
private float opacity = 0.4f; private float opacity = 0.4f;
public LimpidButton(String name, String imagePath, float opacity) {
this.name = name; public LimpidButton(String name, String imagePath, float opacity) {
this.imagePath = imagePath; this.name = name;
this.opacity = opacity; this.imagePath = imagePath;
this.draw(); this.opacity = opacity;
} this.draw();
}
public void draw() {
try { public void draw() {
ImageIcon imageIcon =(ImageIcon) BaseUtils.readIcon(imagePath); try {
Image img = imageIcon.getImage(); ImageIcon imageIcon = (ImageIcon) BaseUtils.readIcon(imagePath);
MediaTracker mt = new MediaTracker(this); Image img = imageIcon.getImage();
int w = 21; MediaTracker mt = new MediaTracker(this);
int h = 21; int w = 21;
mt.addImage(img, 0); int h = 21;
mt.waitForAll(); mt.addImage(img, 0);
mt.waitForAll();
GraphicsConfiguration gc = new JFrame().getGraphicsConfiguration(); // 本地图形设备
Image image = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);//建立透明画布 GraphicsConfiguration gc = new JFrame().getGraphicsConfiguration(); // 本地图形设备
Graphics2D g = (Graphics2D) image.getGraphics(); //在画布上创建画笔 Image image = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);//建立透明画布
Graphics2D g = (Graphics2D) image.getGraphics(); //在画布上创建画笔
Composite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f); //指定透明度为半透明90%
g.setComposite(alpha); Composite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f); //指定透明度为半透明90%
g.drawImage(img, 0, 0, this); //注意是,将image画到g画笔所在的画布上 g.setComposite(alpha);
g.setColor(Color.black);//设置颜色为黑色 g.drawImage(img, 0, 0, this); //注意是,将image画到g画笔所在的画布上
g.drawString(name, 25, 20);//写字 g.setColor(Color.black);//设置颜色为黑色
g.dispose(); //释放内存 g.drawString(name, 25, 20);//写字
g.dispose(); //释放内存
Composite alpha2 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity);
Image image1 = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT); Composite alpha2 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity);
g = (Graphics2D) image1.getGraphics(); Image image1 = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);
g.setComposite(alpha2); g = (Graphics2D) image1.getGraphics();
g.drawImage(img, 2, 2, this); //改变图像起始位置,产生动态效果 g.setComposite(alpha2);
g.setColor(Color.black); g.drawImage(img, 2, 2, this); //改变图像起始位置,产生动态效果
g.drawString(name, 25, 20); g.setColor(Color.black);
g.dispose(); g.drawString(name, 25, 20);
g.dispose();
this.setIgnoreRepaint(true);
this.setFocusable(false);//设置没有焦点 this.setIgnoreRepaint(true);
this.setBorder(null);//设置不画按钮边框 this.setFocusable(false);//设置没有焦点
this.setContentAreaFilled(false);//设置不画按钮背景 this.setBorder(null);//设置不画按钮边框
this.setIcon(new ImageIcon(image1)); //把刚才生成的半透明image变成ImageIcon,贴到按钮上去 this.setContentAreaFilled(false);//设置不画按钮背景
this.setRolloverIcon(new ImageIcon(image1)); this.setIcon(new ImageIcon(image1)); //把刚才生成的半透明image变成ImageIcon,贴到按钮上去
this.setPressedIcon(new ImageIcon(image));//按下去的图标 this.setRolloverIcon(new ImageIcon(image1));
} catch (Exception e) { this.setPressedIcon(new ImageIcon(image));//按下去的图标
FRContext.getLogger().error(e.getMessage()); } catch (Exception e) {
} FRContext.getLogger().error(e.getMessage());
} }
}
/** /**
* 待说明 * 待说明
* @param visible 待说明 *
* @param visible 待说明
*/ */
public void makeVisible(boolean visible) { public void makeVisible(boolean visible) {
this.opacity = visible ? FULL_OPACITY : HALF_OPACITY; this.opacity = visible ? FULL_OPACITY : HALF_OPACITY;
this.draw(); this.draw();
} }
} }
/** /**
* 渲染Painter * 渲染Painter
*/ */
public void paint(Graphics g) { public void paint(Graphics g) {
//不可见时,按钮.4f透明 //不可见时,按钮.4f透明
AlphaComposite composite = this.data.isVisible() ? (AlphaComposite)((Graphics2D)g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER,HALF_OPACITY); AlphaComposite composite = this.data.isVisible() ? (AlphaComposite) ((Graphics2D) g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER, HALF_OPACITY);
((Graphics2D)g).setComposite(composite); ((Graphics2D) g).setComposite(composite);
super.paint(g); super.paint(g);
} }
/**
* 重命名 /**
* * 重命名
* @param designer 表单设计器 *
* @param creator 当前组件 * @param designer 表单设计器
* * @param creator 当前组件
*/ */
public void ChangeCreatorName(FormDesigner designer,XCreator creator){ public void ChangeCreatorName(FormDesigner designer, XCreator creator) {
String oldName = creator.toData().getWidgetName(); String oldName = creator.toData().getWidgetName();
String value = JOptionPane.showInputDialog(designer, Inter.getLocText("Form-Change_Widget_Name_Discription"), oldName); String value = JOptionPane.showInputDialog(designer, Inter.getLocText("Form-Change_Widget_Name_Discription"), oldName);
if(value != null) { if (value != null) {
designer.renameCreator(creator, value); designer.renameCreator(creator, value);
} }
} }
} }

166
designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java

@ -1,41 +1,12 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.RoundRectangle2D;
import java.util.EventObject;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.GroupRenderer;
import com.fr.design.gui.itable.HeaderRenderer;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.HeaderRenderer;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
@ -43,6 +14,18 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.RoundRectangle2D;
import java.util.EventObject;
/** /**
* MobileParaWidgetTable主要显示参数面板容器的控件列表与MobileWidgetTable的区别就是该表多了UITextField这一列 * MobileParaWidgetTable主要显示参数面板容器的控件列表与MobileWidgetTable的区别就是该表多了UITextField这一列
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -53,9 +36,10 @@ import com.fr.stable.StringUtils;
*/ */
class MobileParaWidgetTable extends JTable { class MobileParaWidgetTable extends JTable {
private final int WIDGET_NAME_COLUMN = 1;
private FormDesigner designer; private FormDesigner designer;
private String[][] cellData ; private String[][] cellData;
private String[] headers = {Inter.getLocText("FR-Utils_Label"), Inter.getLocText("Form-Widget_Name")}; private String[] headers = {Inter.getLocText("Form-Widget_Name")};
private static final int WIDGET_TABLE_ROW_HEIGHT = 22; private static final int WIDGET_TABLE_ROW_HEIGHT = 22;
private static final int UITEXTFIELD_WIDTH = 40; private static final int UITEXTFIELD_WIDTH = 40;
private UILabel moveComponent = new UILabel(); // 作为拖动时候随鼠标移动的那个半透明控件 private UILabel moveComponent = new UILabel(); // 作为拖动时候随鼠标移动的那个半透明控件
@ -75,7 +59,7 @@ class MobileParaWidgetTable extends JTable {
TableColumn tc = this.getColumn(this.getColumnName(0)); TableColumn tc = this.getColumn(this.getColumnName(0));
tc.setPreferredWidth(UITEXTFIELD_WIDTH); tc.setPreferredWidth(UITEXTFIELD_WIDTH);
this.repaint(); this.repaint();
this.setDefaultRenderer(Object.class,new MobileWidgetTableCellRenderer()); this.setDefaultRenderer(Object.class, new MobileWidgetTableCellRenderer());
refreshData(); refreshData();
this.addMouseListener(mouseAdapter); this.addMouseListener(mouseAdapter);
this.addMouseMotionListener(mouseAdapter); this.addMouseMotionListener(mouseAdapter);
@ -112,12 +96,12 @@ class MobileParaWidgetTable extends JTable {
*/ */
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if(!draging){ if (!draging) {
return; return;
} }
draging = false; draging = false;
moveComponent.setVisible(false); moveComponent.setVisible(false);
int toIndex = e.getY() < GAP ? 0 : (int)Math.rint((e.getY() - GAP)/WIDGET_TABLE_ROW_HEIGHT) + 1; int toIndex = e.getY() < GAP ? 0 : (int) Math.rint((e.getY() - GAP) / WIDGET_TABLE_ROW_HEIGHT) + 1;
//当鼠标放开时,将选中的容器调整至新的顺序 //当鼠标放开时,将选中的容器调整至新的顺序
((WParameterLayout) designer.getParaComponent().toData()).adjustOrder(selectedRow, toIndex); ((WParameterLayout) designer.getParaComponent().toData()).adjustOrder(selectedRow, toIndex);
//拿取排序后表格数据,然后重绘表格 //拿取排序后表格数据,然后重绘表格
@ -135,13 +119,13 @@ class MobileParaWidgetTable extends JTable {
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
int overColumn = e.getX() < getColumnModel().getColumn(0).getWidth() ? 0 : 1; // 判断当前鼠标在哪一列 int overColumn = e.getX() < getColumnModel().getColumn(0).getWidth() ? 0 : 1; // 判断当前鼠标在哪一列
int overRow = -1; int overRow = -1;
for (int i = 0;i < getRowCount();i++) { for (int i = 0; i < getRowCount(); i++) {
if (e.getY() > i * WIDGET_TABLE_ROW_HEIGHT && e.getY() <= (i + 1) * WIDGET_TABLE_ROW_HEIGHT) { if (e.getY() > i * WIDGET_TABLE_ROW_HEIGHT && e.getY() <= (i + 1) * WIDGET_TABLE_ROW_HEIGHT) {
overRow = i; //判断当前鼠标在哪一行 overRow = i; //判断当前鼠标在哪一行
} }
} }
//如果鼠标移动到当前选中的行列上面的时候,并且不能在第一列 //如果鼠标移动到当前选中的行列上面的时候,并且不能在第一列
if (overRow == selectedRow && overColumn == selectedColumn && overColumn !=0) { if (overRow == selectedRow && overColumn == selectedColumn && overColumn != 0) {
//把当前选中的那一列行的光标改成(除了第一列)移动样式MOVE_CURSOR //把当前选中的那一列行的光标改成(除了第一列)移动样式MOVE_CURSOR
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
} else { } else {
@ -156,34 +140,31 @@ class MobileParaWidgetTable extends JTable {
*/ */
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
int width = getColumnModel().getColumn(1).getWidth(); int width = getColumnModel().getColumn(0).getWidth();
//如果点击选中的是第二列,就可以拖动 setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
if (selectedColumn == 1){ draging = true;
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); moveComponent.setText(getValueAt(selectedRow, selectedColumn).toString());
draging = true; moveComponent.setLocation(getColumnModel().getColumn(0).getWidth(), e.getY() - GAP);
moveComponent.setText(getValueAt(selectedRow, selectedColumn).toString()); moveComponent.setSize(new Dimension(width, WIDGET_TABLE_ROW_HEIGHT));
moveComponent.setLocation(getColumnModel().getColumn(0).getWidth(), e.getY() - GAP); moveComponent.setVisible(true);
moveComponent.setSize(new Dimension(width, WIDGET_TABLE_ROW_HEIGHT)); moveComponent.setForeground(Color.lightGray);
moveComponent.setVisible(true); moveComponent.setBorder(BorderFactory.createLineBorder(Color.lightGray));
moveComponent.setForeground(Color.lightGray);
moveComponent.setBorder(BorderFactory.createLineBorder(Color.lightGray));
}
} }
/** /**
* 设置鼠标单击时处理的事件单击第二列的控件列表进入控件属性表 * 设置鼠标单击时处理的事件
* @param e * @param e
*/ */
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if(getSelectedRow() != -1 && getSelectedColumn() == 1){ if (getSelectedRow() != -1 && getSelectedColumn() == 0) {
String widgetName = cellData[getSelectedRow()][getSelectedColumn()]; String widgetName = cellData[getSelectedRow()][getSelectedColumn()];
if (StringUtils.isNotEmpty(widgetName)){ if (StringUtils.isNotEmpty(widgetName)) {
int count = getEditingDesigner().getParaComponent().getComponentCount(); int count = getEditingDesigner().getParaComponent().getComponentCount();
for (int i = 0; i < count; i++){ for (int i = 0; i < count; i++) {
XCreator xCreator = (XCreator)getEditingDesigner().getParaComponent().getComponent(i); XCreator xCreator = (XCreator) getEditingDesigner().getParaComponent().getComponent(i);
Widget widget = xCreator.toData(); Widget widget = xCreator.toData();
if (!widget.acceptType(Label.class) && ComparatorUtils.equals(widgetName,widget.getWidgetName())) { if (!widget.acceptType(Label.class) && ComparatorUtils.equals(widgetName, widget.getWidgetName())) {
//设置选中的component,这句代码控制点击之后跳转到相应component属性表 //设置选中的component,这句代码控制点击之后跳转到相应component属性表
getEditingDesigner().getSelectionModel().setSelectedCreator(xCreator); getEditingDesigner().getSelectionModel().setSelectedCreator(xCreator);
} }
@ -204,12 +185,12 @@ class MobileParaWidgetTable extends JTable {
} }
}; };
public MobileParaWidgetTable getInstance(){ public MobileParaWidgetTable getInstance() {
return this; return this;
} }
private FormDesigner getEditingDesigner(){ private FormDesigner getEditingDesigner() {
return designer; return designer;
} }
/** /**
@ -229,8 +210,8 @@ class MobileParaWidgetTable extends JTable {
/** /**
* 重新get排序后的数据 * 重新get排序后的数据
*/ */
public void refreshData(){ public void refreshData() {
cellData = getData(); cellData = getData();
} }
/** /**
@ -238,30 +219,30 @@ class MobileParaWidgetTable extends JTable {
* *
* @return String[][] 二维数组[0][0]widgetTag, [0][1]widgetName * @return String[][] 二维数组[0][0]widgetTag, [0][1]widgetName
*/ */
private String[][] getData(){ private String[][] getData() {
XLayoutContainer paraContainer = designer.getParaComponent(); XLayoutContainer paraContainer = designer.getParaComponent();
if(paraContainer == null || !paraContainer.acceptType(XWParameterLayout.class)){ if (paraContainer == null || !paraContainer.acceptType(XWParameterLayout.class)) {
return new String[0][0]; return new String[0][1];
} }
WParameterLayout para = (WParameterLayout) (paraContainer.toData()); WParameterLayout para = (WParameterLayout) (paraContainer.toData());
return para.getWidgetNameTag(); return para.getWidgetNameTag();
} }
/** /**
* 自定义的tableRender类 * 自定义的tableRender类
*/ */
private class MobileWidgetTableCellRenderer extends DefaultTableCellRenderer{ private class MobileWidgetTableCellRenderer extends DefaultTableCellRenderer {
@Override @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) { boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (column == 0){ if (column == 0) {
UITextField uiTableTextField; UITextField uiTableTextField;
if (getSelectedColumn() == column && getSelectedRow() == row){ if (getSelectedColumn() == column && getSelectedRow() == row) {
uiTableTextField = new UITableTextField(value.toString()); uiTableTextField = new UITableTextField(value.toString());
} else { } else {
uiTableTextField = new UITextField(value.toString()); uiTableTextField = new UITextField(value.toString());
} }
return uiTableTextField; return uiTableTextField;
} }
@ -275,7 +256,8 @@ class MobileParaWidgetTable extends JTable {
*/ */
private class MobileCellEditor extends AbstractCellEditor implements TableCellEditor { private class MobileCellEditor extends AbstractCellEditor implements TableCellEditor {
UITableTextField uiTableTextField; UITableTextField uiTableTextField;
MobileCellEditor(){
MobileCellEditor() {
uiTableTextField = new UITableTextField(); uiTableTextField = new UITableTextField();
uiTableTextField.addFocusListener(new FocusAdapter() { uiTableTextField.addFocusListener(new FocusAdapter() {
@Override @Override
@ -306,7 +288,7 @@ class MobileParaWidgetTable extends JTable {
* cell改变相应的nametag改变 * cell改变相应的nametag改变
*/ */
private void firePropertyChange(){ private void firePropertyChange() {
((WParameterLayout) designer.getParaComponent().toData()).add2NameTagMap(uiTableTextField.getText(), ((WParameterLayout) designer.getParaComponent().toData()).add2NameTagMap(uiTableTextField.getText(),
cellData[getSelectedRow()][1]); cellData[getSelectedRow()][1]);
((WParameterLayout) designer.getParaComponent().toData()).setNameTagModified(cellData[getSelectedRow()][1], ((WParameterLayout) designer.getParaComponent().toData()).setNameTagModified(cellData[getSelectedRow()][1],
@ -314,21 +296,21 @@ class MobileParaWidgetTable extends JTable {
} }
@Override @Override
public Object getCellEditorValue(){ public Object getCellEditorValue() {
return uiTableTextField.getText(); return uiTableTextField.getText();
} }
/** /**
* 双击以编辑, 表示只有双击的情况下才可以编辑 * 双击以编辑, 表示只有双击的情况下才可以编辑
*/ */
@Override @Override
public boolean isCellEditable(EventObject anEvent) { public boolean isCellEditable(EventObject anEvent) {
return !(anEvent instanceof MouseEvent) || ((MouseEvent) anEvent).getClickCount() >= 2; return !(anEvent instanceof MouseEvent) || ((MouseEvent) anEvent).getClickCount() >= 2;
} }
@Override @Override
public Component getTableCellEditorComponent( JTable table,Object value, public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected,int row,int column){ boolean isSelected, int row, int column) {
uiTableTextField.setText(value.toString()); uiTableTextField.setText(value.toString());
return uiTableTextField; return uiTableTextField;
} }
@ -360,7 +342,7 @@ class MobileParaWidgetTable extends JTable {
} }
Object[] rowValue = cellData[row]; Object[] rowValue = cellData[row];
if (column > -1 && column < rowValue.length) { if (column > -1 && column < rowValue.length) {
return cellData[row][column]; return cellData[row][WIDGET_NAME_COLUMN];
} }
return null; return null;
} }
@ -381,23 +363,21 @@ class MobileParaWidgetTable extends JTable {
return; return;
} }
if (aValue == null) { if (aValue == null) {
cellData[row][column] = null; cellData[row][WIDGET_NAME_COLUMN] = null;
return; return;
} }
cellData[row][column] = aValue.toString(); cellData[row][WIDGET_NAME_COLUMN] = aValue.toString();
} }
/** /**
* 是否可编辑 控件标签列可以编辑控件名不可编辑 * 是否可编辑 控件标签列可以编辑控件名不可编辑
* @param row 行号 *
* @param column 列号 * @param row 行号
* @param column 列号
* @return 是否可编辑 * @return 是否可编辑
*/ */
public boolean isCellEditable(int row, int column) { public boolean isCellEditable(int row, int column) {
if(column ==1){ return false;
return false;
}
return true;
} }
} }
@ -406,11 +386,11 @@ class MobileParaWidgetTable extends JTable {
* 继承自JTextField类重写了编辑框的样式 * 继承自JTextField类重写了编辑框的样式
*/ */
private class UITableTextField extends UITextField { private class UITableTextField extends UITextField {
public UITableTextField(){ public UITableTextField() {
super(); super();
} }
public UITableTextField(String string){ public UITableTextField(String string) {
super(string); super(string);
} }

Loading…
Cancel
Save