From 06145b11a9127c9bc37b94b64e5d034a6c5e8696 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 28 Jun 2016 10:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E8=A1=80=E7=BC=98?= =?UTF-8?q?=E5=85=B3=E7=B3=BB,=20=E8=87=AA=E5=AE=9A=E4=B9=89gridui?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/grid/DefaultGridUIProcessor.java | 17 +++++++ designer/src/com/fr/grid/Grid.java | 26 +++++----- designer/src/com/fr/grid/GridUI.java | 49 +++++-------------- .../com/fr/design/fun/GridUIProcessor.java | 23 +++++++++ .../fun/impl/AbstractGridUIProcessor.java | 15 ++++++ .../mobile/ElementCasePropertyTable.java | 2 +- 6 files changed, 82 insertions(+), 50 deletions(-) create mode 100644 designer/src/com/fr/grid/DefaultGridUIProcessor.java create mode 100644 designer_base/src/com/fr/design/fun/GridUIProcessor.java create mode 100644 designer_base/src/com/fr/design/fun/impl/AbstractGridUIProcessor.java diff --git a/designer/src/com/fr/grid/DefaultGridUIProcessor.java b/designer/src/com/fr/grid/DefaultGridUIProcessor.java new file mode 100644 index 0000000000..65b6aa4569 --- /dev/null +++ b/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); + } + +} diff --git a/designer/src/com/fr/grid/Grid.java b/designer/src/com/fr/grid/Grid.java index ec9ee49413..a259cf63b0 100644 --- a/designer/src/com/fr/grid/Grid.java +++ b/designer/src/com/fr/grid/Grid.java @@ -3,20 +3,11 @@ */ 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.design.cell.editor.CellEditor; -import com.fr.design.cell.editor.FloatEditor; -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.ExtraDesignClassManager; +import com.fr.design.cell.editor.*; import com.fr.design.constants.UIConstants; +import com.fr.design.fun.GridUIProcessor; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.mainframe.ElementCasePane; 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.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. * @@ -144,7 +142,9 @@ public class Grid extends BaseGridComponent { * */ 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); } /** diff --git a/designer/src/com/fr/grid/GridUI.java b/designer/src/com/fr/grid/GridUI.java index e3d2a5efce..526f0f074b 100644 --- a/designer/src/com/fr/grid/GridUI.java +++ b/designer/src/com/fr/grid/GridUI.java @@ -1,38 +1,6 @@ package com.fr.grid; -import java.awt.AlphaComposite; -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.*; import com.fr.base.background.ColorBackground; import com.fr.base.background.ImageBackground; 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.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 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); paintBorder(g2d, tmpCellElement, report); - paintFatherLeft(g2d); + paintFatherLeft(g2d, selectedCellElement, report); } 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) { 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: 标记格子的边框 formulaCellArea = new Area(new Rectangle2D.Double(this.tmpRectangle.getX(), this.tmpRectangle.getY(), this.tmpRectangle.getWidth(), diff --git a/designer_base/src/com/fr/design/fun/GridUIProcessor.java b/designer_base/src/com/fr/design/fun/GridUIProcessor.java new file mode 100644 index 0000000000..d900d7cb51 --- /dev/null +++ b/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); +} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractGridUIProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractGridUIProcessor.java new file mode 100644 index 0000000000..b772d7b644 --- /dev/null +++ b/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; + } +} diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java index c846d48f50..0519684594 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java +++ b/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.xtable.ReportAppPropertyGroupModel; 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.RefinedDoubleEditor; import com.fr.form.ui.ElementCaseEditor;