Browse Source

format

master
hzzz 7 years ago
parent
commit
922291d9bc
  1. 6
      designer/src/com/fr/design/cell/bar/DynamicScrollButton.java
  2. 1910
      designer_base/src/com/fr/design/file/MutilTempalteTabPane.java
  3. 162
      designer_base/src/com/fr/design/file/NewTemplatePane.java

6
designer/src/com/fr/design/cell/bar/DynamicScrollButton.java

@ -145,12 +145,6 @@ public class DynamicScrollButton extends BasicArrowButton {
//GradientPaint scrollBarHight = new GradientPaint(0, 0, new Color(1.0f, 1.0f, 1.0f, 0.5f), 0, 7, new Color(1.0f, 1.0f, 1.0f, 0.2f));
g2.setPaint(scrollBarBg);
g2.fillRoundRect(1, 1, 16, 16, 0, 0);
// g2.setPaint(scrollBarHight);
// g2.fillRoundRect(1, 1, 16, 7, 3, 3);
// g2.setColor(a);
// g2.drawRoundRect(1, 1, 15, 15, 3, 3);
// g2.setColor(new Color(212, 212, 216));
// g2.drawRoundRect(2, 2, 13, 13, 3, 3);
break;
}
// dispose of image graphics

1910
designer_base/src/com/fr/design/file/MutilTempalteTabPane.java

File diff suppressed because it is too large Load Diff

162
designer_base/src/com/fr/design/file/NewTemplatePane.java

@ -1 +1,161 @@
package com.fr.design.file; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.Line2D; /** * Author : daisy * Date: 13-8-27 * Time: 下午6:07 */ public abstract class NewTemplatePane extends JComponent implements MouseListener, MouseMotionListener { private static final Icon GRAY_NEW_CPT = BaseUtils.readIcon("/com/fr/design/images/buttonicon/additicon_grey.png"); private static final int PRE_GAP = 0; private static final int HEIGHT = 26; private Graphics2D g2d; private Icon newWorkBookIconMode = null; private int newIconStartX = PRE_GAP; public NewTemplatePane() { newWorkBookIconMode = getNew(); this.setLayout(new BorderLayout(0, 0)); this.addMouseListener(this); this.addMouseMotionListener(this); this.setBorder(null); this.setForeground(new Color(99, 99, 99)); } public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); dim.width = HEIGHT; return dim; } public void paintComponent(Graphics g) { super.paintComponent(g); g2d = (Graphics2D) g; int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2; newWorkBookIconMode.paintIcon(this, g2d, newIconStartX, sheetIconY); // paintUnderLine(g2d); } private void paintUnderLine(Graphics2D g2d) { //画下面的那条线 g2d.setPaint(UIConstants.LINE_COLOR); g2d.draw(new Line2D.Double((float) 0, (float) (getHeight()-1), getWidth(), (float) (getHeight()-1))); } /** *鼠标点击 * @param e 事件 */ public void mouseClicked(MouseEvent e) { if (BaseUtils.isAuthorityEditing()) { newWorkBookIconMode = GRAY_NEW_CPT; } } /** *鼠标按下 * @param e 事件 */ public void mousePressed(MouseEvent e) { int evtX = e.getX(); if (BaseUtils.isAuthorityEditing()) { newWorkBookIconMode = GRAY_NEW_CPT; } if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) { newWorkBookIconMode = getMousePressNew(); newIconStartX = 0; DesignerContext.getDesignerFrame().addAndActivateJTemplate(); } this.repaint(); } /** *鼠标松开 * @param e 事件 */ public void mouseReleased(MouseEvent e) { if (BaseUtils.isAuthorityEditing()) { newWorkBookIconMode = GRAY_NEW_CPT; } } /** *鼠标进入 * @param e 事件 */ public void mouseEntered(MouseEvent e) { if (BaseUtils.isAuthorityEditing()) { newWorkBookIconMode = GRAY_NEW_CPT; } } /** *鼠标离开 * @param e 事件 */ public void mouseExited(MouseEvent e) { newIconStartX = PRE_GAP; if (BaseUtils.isAuthorityEditing()) { newWorkBookIconMode = GRAY_NEW_CPT; } else { newWorkBookIconMode = getNew(); } this.repaint(); } /** *鼠标拖拽 * @param e 事件 */ public void mouseDragged(MouseEvent e) { } /** *鼠标移动 * @param e 事件 */ public void mouseMoved(MouseEvent e) { int evtX = e.getX(); if (BaseUtils.isAuthorityEditing()) { newWorkBookIconMode = GRAY_NEW_CPT; } else if (isOverNewIcon(evtX)) { newIconStartX = 0; newWorkBookIconMode = getMouseOverNew(); } this.repaint(); } private boolean isOverNewIcon(int evtX) { return (evtX >= PRE_GAP && evtX <= PRE_GAP + newWorkBookIconMode.getIconWidth()); } public void setButtonGray(boolean isGray) { newWorkBookIconMode = isGray ? GRAY_NEW_CPT : getNew(); } public abstract Icon getNew(); public abstract Icon getMouseOverNew(); public abstract Icon getMousePressNew(); }
package com.fr.design.file;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Line2D;
/**
* Author : daisy
* Date: 13-8-27
* Time: 下午6:07
*/
public abstract class NewTemplatePane extends JComponent implements MouseListener, MouseMotionListener {
private static final Icon GRAY_NEW_CPT = BaseUtils.readIcon("/com/fr/design/images/buttonicon/additicon_grey.png");
private static final int PRE_GAP = 0;
private static final int HEIGHT = 26;
private Graphics2D g2d;
private Icon newWorkBookIconMode = null;
private int newIconStartX = PRE_GAP;
public NewTemplatePane() {
newWorkBookIconMode = getNew();
this.setLayout(new BorderLayout(0, 0));
this.addMouseListener(this);
this.addMouseMotionListener(this);
this.setBorder(null);
this.setForeground(new Color(99, 99, 99));
}
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = HEIGHT;
return dim;
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
g2d = (Graphics2D) g;
int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2;
newWorkBookIconMode.paintIcon(this, g2d, newIconStartX, sheetIconY);
// paintUnderLine(g2d);
}
private void paintUnderLine(Graphics2D g2d) {
//画下面的那条线
g2d.setPaint(UIConstants.LINE_COLOR);
g2d.draw(new Line2D.Double((float) 0, (float) (getHeight()-1), getWidth(), (float) (getHeight()-1)));
}
/**
*鼠标点击
* @param e 事件
*/
public void mouseClicked(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) {
newWorkBookIconMode = GRAY_NEW_CPT;
}
}
/**
*鼠标按下
* @param e 事件
*/
public void mousePressed(MouseEvent e) {
int evtX = e.getX();
if (BaseUtils.isAuthorityEditing()) {
newWorkBookIconMode = GRAY_NEW_CPT;
}
if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) {
newWorkBookIconMode = getMousePressNew();
newIconStartX = 0;
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
}
this.repaint();
}
/**
*鼠标松开
* @param e 事件
*/
public void mouseReleased(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) {
newWorkBookIconMode = GRAY_NEW_CPT;
}
}
/**
*鼠标进入
* @param e 事件
*/
public void mouseEntered(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) {
newWorkBookIconMode = GRAY_NEW_CPT;
}
}
/**
*鼠标离开
* @param e 事件
*/
public void mouseExited(MouseEvent e) {
newIconStartX = PRE_GAP;
if (BaseUtils.isAuthorityEditing()) {
newWorkBookIconMode = GRAY_NEW_CPT;
} else {
newWorkBookIconMode = getNew();
}
this.repaint();
}
/**
*鼠标拖拽
* @param e 事件
*/
public void mouseDragged(MouseEvent e) {
}
/**
*鼠标移动
* @param e 事件
*/
public void mouseMoved(MouseEvent e) {
int evtX = e.getX();
if (BaseUtils.isAuthorityEditing()) {
newWorkBookIconMode = GRAY_NEW_CPT;
} else if (isOverNewIcon(evtX)) {
newIconStartX = 0;
newWorkBookIconMode = getMouseOverNew();
}
this.repaint();
}
private boolean isOverNewIcon(int evtX) {
return (evtX >= PRE_GAP && evtX <= PRE_GAP + newWorkBookIconMode.getIconWidth());
}
public void setButtonGray(boolean isGray) {
newWorkBookIconMode = isGray ? GRAY_NEW_CPT : getNew();
}
public abstract Icon getNew();
public abstract Icon getMouseOverNew();
public abstract Icon getMousePressNew();
}
Loading…
Cancel
Save