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.layout.VerticalFlowLayout;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
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.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS;
@ -446,7 +450,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public JComponent generateContentPane() {
JComponent contentPane = new JPanel();
JButton testBtn = new JButton(name);
UIButton testBtn = new UIButton(name);
testBtn.addActionListener(new ActionListener() {
@Override
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_Y_SHIFT = 50;
private static final String NO_BUTTON = "NoButton";
private static final String UP_BUTTON = "UpButton";
private static final String DOWN_BUTTON = "DownButton";
public PopupToolPane(PropertyItem propertyItem) {
this(propertyItem, NO_BUTTON);
private MouseListener mouseListener = new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getDefaultCursor());
if (mouseDownCompCoords == null) {
setBackground(originColor);
}
public PopupToolPane(PropertyItem propertyItem, String buttonType) {
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);
model = UIConstants.MODEL_NORMAL;
repaint();
}
public void setParentDialog(JDialog parentDialog) {
this.parentDialog = parentDialog;
isMovable = true;
@Override
public void mouseClicked(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
onPop();
}
private void initToolButton(final String buttonType) {
this.buttonType = buttonType;
if (buttonType.equals(NO_BUTTON)) {
return;
}
if (buttonType.equals(DOWN_BUTTON)) {
} else if (buttonType.equals(UP_BUTTON)) {
} else {
throw new IllegalArgumentException("unknown button type: " + buttonType);
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
if (!getBounds().contains(e.getPoint())) {
setBackground(originColor);
}
}
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < ARROW_RANGE_START) {
mouseDownCompCoords = e.getPoint();
}
}
};
addMouseMotionListener(new MouseMotionListener() {
private MouseMotionListener mouseMotionListener = new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
@ -674,7 +670,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
repaint();
}
@Override
public void mouseDragged(MouseEvent e) {
if (isMovable && mouseDownCompCoords != null) {
@ -701,40 +696,43 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
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 void mouseClicked(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
onPop();
}
public PopupToolPane(PropertyItem propertyItem) {
this(propertyItem, NO_BUTTON);
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
if (!getBounds().contains(e.getPoint())) {
setBackground(originColor);
public PopupToolPane(PropertyItem propertyItem, String buttonType) {
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);
}
public void setParentDialog(JDialog parentDialog) {
this.parentDialog = parentDialog;
isMovable = true;
}
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < ARROW_RANGE_START) {
mouseDownCompCoords = e.getPoint();
private void initToolButton(final String buttonType) {
this.buttonType = buttonType;
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