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