Browse Source

Merge pull request #170 in BA/design from ~NEIL/design:dev to dev

* commit '5d629a5b9c6874806375d762664c29df4f24bbd4':
  1
  单元格血缘关系, 自定义gridui接口
  表单设计器获取数据集参数
  11
  模板web属性打不开.
master
superman 8 years ago
parent
commit
3df85dfbc7
  1. 17
      designer/src/com/fr/grid/DefaultGridUIProcessor.java
  2. 26
      designer/src/com/fr/grid/Grid.java
  3. 49
      designer/src/com/fr/grid/GridUI.java
  4. 23
      designer_base/src/com/fr/design/fun/GridUIProcessor.java
  5. 15
      designer_base/src/com/fr/design/fun/impl/AbstractGridUIProcessor.java
  6. 2
      designer_chart/src/com/fr/design/module/ChartDesignerModule.java
  7. 2
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java
  8. 19
      designer_form/src/com/fr/design/mainframe/FormModelAdapter.java

17
designer/src/com/fr/grid/DefaultGridUIProcessor.java

@ -0,0 +1,17 @@
package com.fr.grid;
import com.fr.design.fun.impl.AbstractGridUIProcessor;
import javax.swing.plaf.ComponentUI;
/**
* Created by Administrator on 2016/6/28/0028.
*/
public class DefaultGridUIProcessor extends AbstractGridUIProcessor{
@Override
public ComponentUI appearanceForGrid(int resolution) {
return new GridUI(resolution);
}
}

26
designer/src/com/fr/grid/Grid.java

@ -3,20 +3,11 @@
*/ */
package com.fr.grid; package com.fr.grid;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.util.Hashtable;
import java.util.Iterator;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.design.cell.editor.CellEditor; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.cell.editor.FloatEditor; import com.fr.design.cell.editor.*;
import com.fr.design.cell.editor.FormulaCellEditor;
import com.fr.design.cell.editor.GeneralCellEditor;
import com.fr.design.cell.editor.GeneralFloatEditor;
import com.fr.design.cell.editor.TextCellEditor;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.fun.GridUIProcessor;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -40,6 +31,13 @@ import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import java.util.Hashtable;
import java.util.Iterator;
/** /**
* Grid used to paint and edit grid. * Grid used to paint and edit grid.
* *
@ -144,7 +142,9 @@ public class Grid extends BaseGridComponent {
* *
*/ */
public void updateUI() { public void updateUI() {
this.setUI(new GridUI(resolution)); GridUIProcessor localGridUIProcessor = ExtraDesignClassManager.getInstance().getSingle(GridUIProcessor.MARK_STRING, new DefaultGridUIProcessor());
ComponentUI localComponentUI = localGridUIProcessor.appearanceForGrid(this.resolution);
setUI(localComponentUI);
} }
/** /**

49
designer/src/com/fr/grid/GridUI.java

@ -1,38 +1,6 @@
package com.fr.grid; package com.fr.grid;
import java.awt.AlphaComposite; import com.fr.base.*;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.Area;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.Line2D.Double;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext;
import com.fr.base.Formula;
import com.fr.base.GraphHelper;
import com.fr.base.Margin;
import com.fr.base.PaperSize;
import com.fr.base.Utils;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageBackground; import com.fr.base.background.ImageBackground;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -70,6 +38,15 @@ import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.third.antlr.ANTLRException; import com.fr.third.antlr.ANTLRException;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.geom.*;
import java.awt.geom.Line2D.Double;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class GridUI extends ComponentUI { public class GridUI extends ComponentUI {
public static int INVALID_INTEGER = Integer.MIN_VALUE;// 作为不合法的数值. public static int INVALID_INTEGER = Integer.MIN_VALUE;// 作为不合法的数值.
@ -438,7 +415,7 @@ public class GridUI extends ComponentUI {
paintDetailedCellElements(g2d, cells, tmpCellElement, reportPane, selectedCellElement, hideWidth, hideHeight, oldClip, report); paintDetailedCellElements(g2d, cells, tmpCellElement, reportPane, selectedCellElement, hideWidth, hideHeight, oldClip, report);
paintBorder(g2d, tmpCellElement, report); paintBorder(g2d, tmpCellElement, report);
paintFatherLeft(g2d); paintFatherLeft(g2d, selectedCellElement, report);
} }
private void paintDetailedCellElements(Graphics2D g2d, Iterator cells, TemplateCellElement tmpCellElement, ElementCasePane reportPane, private void paintDetailedCellElements(Graphics2D g2d, Iterator cells, TemplateCellElement tmpCellElement, ElementCasePane reportPane,
@ -565,7 +542,7 @@ public class GridUI extends ComponentUI {
} }
} }
private void paintFatherLeft(Graphics2D g2d) { protected void paintFatherLeft(Graphics2D g2d, CellElement selectedCellElement, TemplateElementCase report) {
// 画左父格子. // 画左父格子.
if (validate(this.left_col_row_rect) && this.left_col_row_rect.getHeight() > 5) { if (validate(this.left_col_row_rect) && this.left_col_row_rect.getHeight() > 5) {
g2d.setPaint(Color.BLUE); g2d.setPaint(Color.BLUE);
@ -827,7 +804,7 @@ public class GridUI extends ComponentUI {
} }
} }
private void paintFormulaCellArea(Graphics2D g2d, Area formulaCellArea, int i) { protected void paintFormulaCellArea(Graphics2D g2d, Area formulaCellArea, int i) {
// denny: 标记格子的边框 // denny: 标记格子的边框
formulaCellArea = new Area(new Rectangle2D.Double(this.tmpRectangle.getX(), formulaCellArea = new Area(new Rectangle2D.Double(this.tmpRectangle.getX(),
this.tmpRectangle.getY(), this.tmpRectangle.getWidth(), this.tmpRectangle.getY(), this.tmpRectangle.getWidth(),

23
designer_base/src/com/fr/design/fun/GridUIProcessor.java

@ -0,0 +1,23 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Immutable;
import javax.swing.plaf.ComponentUI;
/**
* 自定义单元格ui接口
*
* @return
*/
public interface GridUIProcessor extends Immutable {
String MARK_STRING = "GridUIProcessor";
int CURRENT_LEVEL = 1;
/**
* 自定义gridui, 用于实现一些自定义的格子绘制.
*
* @return 自定义gridui
*/
ComponentUI appearanceForGrid(int paramInt);
}

15
designer_base/src/com/fr/design/fun/impl/AbstractGridUIProcessor.java

@ -0,0 +1,15 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.GridUIProcessor;
import com.fr.stable.fun.mark.API;
@API(level = GridUIProcessor.CURRENT_LEVEL)
public abstract class AbstractGridUIProcessor implements GridUIProcessor {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

2
designer_chart/src/com/fr/design/module/ChartDesignerModule.java

@ -1 +1 @@
package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartAndWidgetPropertyPane; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.PluginReadListener; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); GeneralContext.addPluginReadListener(new PluginReadListener() { @Override public void success() { DesignModuleFactory.registerExtraWidgetOptions(options4Show()); } }); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartAndWidgetPropertyPane(ChartAndWidgetPropertyPane.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App<?>[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } } package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartAndWidgetPropertyPane; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.PluginReadListener; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); GeneralContext.addPluginReadListener(new PluginReadListener() { @Override public void success() { DesignModuleFactory.registerExtraWidgetOptions(options4Show()); } }); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartAndWidgetPropertyPane(ChartAndWidgetPropertyPane.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App<?>[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if(rowChart == null) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } }

2
designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java

@ -10,7 +10,7 @@ import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.gui.itable.PropertyGroup; import com.fr.design.gui.itable.PropertyGroup;
import com.fr.design.gui.xtable.ReportAppPropertyGroupModel; import com.fr.design.gui.xtable.ReportAppPropertyGroupModel;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor;
import com.fr.design.mainframe.widget.editors.RefinedDoubleEditor; import com.fr.design.mainframe.widget.editors.RefinedDoubleEditor;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;

19
designer_form/src/com/fr/design/mainframe/FormModelAdapter.java

@ -1,20 +1,16 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.util.ArrayList; import com.fr.base.Parameter;
import java.util.List;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.WidgetGatherAdapter; import com.fr.form.main.WidgetGatherAdapter;
import com.fr.form.ui.ChartEditorProvider; import com.fr.form.ui.*;
import com.fr.form.ui.DataControl;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.stable.js.WidgetName; import com.fr.stable.js.WidgetName;
import java.util.ArrayList;
import java.util.List;
public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm> { public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm> {
public FormModelAdapter(BaseJForm jForm) { public FormModelAdapter(BaseJForm jForm) {
@ -100,4 +96,9 @@ public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm> {
return linkAbleList.toArray(new Widget[linkAbleList.size()]); return linkAbleList.toArray(new Widget[linkAbleList.size()]);
} }
@Override
public Parameter[] getParameters() {
return this.getBook().getParameters();
}
} }
Loading…
Cancel
Save