|
|
@ -3,18 +3,15 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.fr.grid; |
|
|
|
package com.fr.grid; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
|
|
|
import java.awt.geom.Rectangle2D; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.event.MouseInputListener; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
import com.fr.base.ScreenResolution; |
|
|
|
import com.fr.base.ScreenResolution; |
|
|
|
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.mainframe.ElementCasePane; |
|
|
|
import com.fr.design.mainframe.ElementCasePane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.event.MouseInputListener; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.awt.geom.Rectangle2D; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* GridCorner used to paint and edit grid cornor. |
|
|
|
* GridCorner used to paint and edit grid cornor. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -29,16 +26,16 @@ public class GridCorner extends BaseGridComponent { |
|
|
|
this.addMouseListener(l); |
|
|
|
this.addMouseListener(l); |
|
|
|
this.addMouseMotionListener(l); |
|
|
|
this.addMouseMotionListener(l); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Paints component |
|
|
|
* Paints component |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void paintComponent(Graphics g) { |
|
|
|
public void paintComponent(Graphics g) { |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
|
|
|
|
|
|
|
|
ElementCasePane reportPane = this.getElementCasePane(); |
|
|
|
ElementCasePane reportPane = this.getElementCasePane(); |
|
|
|
float time = (float)reportPane.getResolution()/ ScreenResolution.getScreenResolution(); |
|
|
|
float time = (float) reportPane.getResolution() / ScreenResolution.getScreenResolution(); |
|
|
|
//size
|
|
|
|
//size
|
|
|
|
Dimension size = this.getSize(); |
|
|
|
Dimension size = this.getSize(); |
|
|
|
Rectangle2D rect2D = new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()); |
|
|
|
Rectangle2D rect2D = new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()); |
|
|
@ -50,9 +47,9 @@ public class GridCorner extends BaseGridComponent { |
|
|
|
g2d.setPaint(reportPane.getBackground()); |
|
|
|
g2d.setPaint(reportPane.getBackground()); |
|
|
|
GraphHelper.fill(g2d, rect2D); |
|
|
|
GraphHelper.fill(g2d, rect2D); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
paintArc(g2d, size, time); |
|
|
|
paintArc(g2d, size, time); |
|
|
|
|
|
|
|
|
|
|
|
//画左边的边框线.
|
|
|
|
//画左边的边框线.
|
|
|
|
g2d.setColor(reportPane.getGridColumn().getSeparatorLineColor()); |
|
|
|
g2d.setColor(reportPane.getGridColumn().getSeparatorLineColor()); |
|
|
|
GraphHelper.drawLine(g2d, 0, 0, 0, size.getHeight()); |
|
|
|
GraphHelper.drawLine(g2d, 0, 0, 0, size.getHeight()); |
|
|
@ -66,7 +63,7 @@ public class GridCorner extends BaseGridComponent { |
|
|
|
* Gets the preferred size. |
|
|
|
* Gets the preferred size. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
ElementCasePane reportPane = this.getElementCasePane(); |
|
|
|
ElementCasePane reportPane = this.getElementCasePane(); |
|
|
|
|
|
|
|
|
|
|
|
if (!reportPane.isColumnHeaderVisible() || !reportPane.isRowHeaderVisible()) { |
|
|
|
if (!reportPane.isColumnHeaderVisible() || !reportPane.isRowHeaderVisible()) { |
|
|
@ -74,28 +71,31 @@ public class GridCorner extends BaseGridComponent { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Dimension(reportPane.getGridRow().getPreferredSize().width, |
|
|
|
return new Dimension(reportPane.getGridRow().getPreferredSize().width, |
|
|
|
reportPane.getGridColumn().getPreferredSize().height); |
|
|
|
reportPane.getGridColumn().getPreferredSize().height); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Gets corner background. |
|
|
|
* Gets corner background. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Color getBackground() { |
|
|
|
public Color getBackground() { |
|
|
|
return super.getBackground(); |
|
|
|
return super.getBackground(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void paintArc(Graphics2D g2d, Dimension size, float time) { |
|
|
|
private void paintArc(Graphics2D g2d, Dimension size, float time) { |
|
|
|
g2d.setColor(Color.gray); |
|
|
|
g2d.setColor(UIConstants.LINE_COLOR); |
|
|
|
int width = (int) (size.width - (16 * time)); |
|
|
|
float height = 2 * time; |
|
|
|
int avgWidth = width / 3; |
|
|
|
float width = 2 * time; |
|
|
|
int height = (int) (size.height - (8 * time)); |
|
|
|
float hgap = 4 * time; |
|
|
|
int avgHeight = height / 3; |
|
|
|
float vgap = 3 * time; |
|
|
|
for (int i = 0; i < 3; i ++) { |
|
|
|
|
|
|
|
for (int j = 0; j < 3; j ++) { |
|
|
|
int x = (int) ((size.width - (hgap * 2 + width * 3)) / 2); |
|
|
|
GraphHelper.fillArc(g2d, (8 * time) + (i * avgWidth), (4 * time) + (j * avgHeight), 3, 3, 0, 360); |
|
|
|
int y = (int) (size.height - (vgap * 2 + height * 3)); |
|
|
|
} |
|
|
|
for (int i = 0; i < 3; i++) { |
|
|
|
} |
|
|
|
for (int j = 0; j < 3; j++) { |
|
|
|
|
|
|
|
GraphHelper.fillRect(g2d, x + (i * hgap), y + (j * vgap), width, height); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |