Browse Source

单元格血缘关系, 自定义gridui接口

master
neil 8 years ago
parent
commit
06145b11a9
  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_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.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;
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);
}
/**

49
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(),

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_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;

Loading…
Cancel
Save