Browse Source

REPORT-3163 合作开发9.0设计器=>pmd

master
plough 7 years ago
parent
commit
1d06cbfe19
  1. 124
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

124
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -8,14 +8,18 @@ import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.third.fr.pdf.kernel.utils.CompareTool;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.util.*; import java.util.*;
import java.util.List;
public class EastRegionContainerPane extends UIEastResizableContainer { public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS; private static EastRegionContainerPane THIS;
@ -446,7 +450,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public JComponent generateContentPane() { public JComponent generateContentPane() {
JComponent contentPane = new JPanel(); JComponent contentPane = new JPanel();
JButton testBtn = new JButton(name); UIButton testBtn = new UIButton(name);
testBtn.addActionListener(new ActionListener() { testBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -616,50 +620,42 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private static final int MAX_X_SHIFT = 50; private static final int MAX_X_SHIFT = 50;
private static final int MAX_Y_SHIFT = 50; private static final int MAX_Y_SHIFT = 50;
private static final String NO_BUTTON = "NoButton"; private static final String NO_BUTTON = "NoButton";
private static final String UP_BUTTON = "UpButton"; private static final String UP_BUTTON = "UpButton";
private static final String DOWN_BUTTON = "DownButton"; private static final String DOWN_BUTTON = "DownButton";
public PopupToolPane(PropertyItem propertyItem) { private MouseListener mouseListener = new MouseAdapter() {
this(propertyItem, NO_BUTTON); @Override
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getDefaultCursor());
if (mouseDownCompCoords == null) {
setBackground(originColor);
} }
model = UIConstants.MODEL_NORMAL;
public PopupToolPane(PropertyItem propertyItem, String buttonType) { repaint();
super();
this.propertyItem = propertyItem;
this.title = propertyItem.getTitle();
this.contentPane = propertyItem.getContentPane();
originColor = getBackground();
setLayout(new BorderLayout());
UILabel label = new UILabel(title);
label.setForeground(new Color(69, 135, 255));
add(label, BorderLayout.WEST);
setBorder(new EmptyBorder(5, 10, 0, 0));
initToolButton(buttonType);
} }
@Override
public void setParentDialog(JDialog parentDialog) { public void mouseClicked(MouseEvent e) {
this.parentDialog = parentDialog; if (e.getX() >= ARROW_RANGE_START) {
isMovable = true; onPop();
} }
private void initToolButton(final String buttonType) {
this.buttonType = buttonType;
if (buttonType.equals(NO_BUTTON)) {
return;
} }
@Override
if (buttonType.equals(DOWN_BUTTON)) { public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
} else if (buttonType.equals(UP_BUTTON)) { if (!getBounds().contains(e.getPoint())) {
setBackground(originColor);
} else { }
throw new IllegalArgumentException("unknown button type: " + buttonType); }
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < ARROW_RANGE_START) {
mouseDownCompCoords = e.getPoint();
}
} }
};
addMouseMotionListener(new MouseMotionListener() { private MouseMotionListener mouseMotionListener = new MouseMotionListener() {
@Override @Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) { if (e.getX() >= ARROW_RANGE_START) {
@ -674,7 +670,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
repaint(); repaint();
} }
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (isMovable && mouseDownCompCoords != null) { if (isMovable && mouseDownCompCoords != null) {
@ -701,40 +696,43 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
parentDialog.setLocation(x, y); parentDialog.setLocation(x, y);
} }
} }
}); };
addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getDefaultCursor());
if (mouseDownCompCoords == null) {
setBackground(originColor);
}
model = UIConstants.MODEL_NORMAL;
repaint();
}
@Override public PopupToolPane(PropertyItem propertyItem) {
public void mouseClicked(MouseEvent e) { this(propertyItem, NO_BUTTON);
if (e.getX() >= ARROW_RANGE_START) {
onPop();
}
} }
@Override public PopupToolPane(PropertyItem propertyItem, String buttonType) {
public void mouseReleased(MouseEvent e) { super();
mouseDownCompCoords = null; this.propertyItem = propertyItem;
if (!getBounds().contains(e.getPoint())) { this.title = propertyItem.getTitle();
setBackground(originColor); this.contentPane = propertyItem.getContentPane();
originColor = getBackground();
setLayout(new BorderLayout());
UILabel label = new UILabel(title);
label.setForeground(new Color(69, 135, 255));
add(label, BorderLayout.WEST);
setBorder(new EmptyBorder(5, 10, 0, 0));
initToolButton(buttonType);
} }
public void setParentDialog(JDialog parentDialog) {
this.parentDialog = parentDialog;
isMovable = true;
} }
@Override
public void mousePressed(MouseEvent e) { private void initToolButton(final String buttonType) {
if (e.getX() < ARROW_RANGE_START) { this.buttonType = buttonType;
mouseDownCompCoords = e.getPoint(); if (StringUtils.isEmpty(buttonType) || buttonType.equals(NO_BUTTON)) {
return;
} }
// validate
if (!buttonType.equals(UP_BUTTON) || !buttonType.equals(DOWN_BUTTON)) {
throw new IllegalArgumentException("unknown button type: " + buttonType);
} }
addMouseMotionListener(mouseMotionListener);
}); addMouseListener(mouseListener);
} }
// 触发弹入、弹出 // 触发弹入、弹出

Loading…
Cancel
Save