|
|
|
@ -84,6 +84,9 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30; |
|
|
|
|
// 弹出对话框高度
|
|
|
|
|
private static final int POPUP_MIN_HEIGHT = 145; |
|
|
|
|
private static final int POPUP_MAX_HEIGHT = 950; |
|
|
|
|
private static final int POPUP_MAX_WIDTH = 950; |
|
|
|
|
private static final int POPUP_MIN_WIDTH = 100; |
|
|
|
|
private static final int POPUP_DEFAULT_HEIGHT = 600; |
|
|
|
|
public static final String KEY_CELL_ELEMENT = "cellElement"; |
|
|
|
|
public static final String KEY_CELL_ATTR = "cellAttr"; |
|
|
|
@ -138,7 +141,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
if (FRContext.isChineseEnv()) { |
|
|
|
|
return UIEastResizableContainer.MIN_CONTAINER_WIDTH; |
|
|
|
|
} |
|
|
|
|
return UIEastResizableContainer.MAX_CONTAINER_WIDTH; |
|
|
|
|
return UIEastResizableContainer.INIT_CONTAINER_WIDTH; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -411,6 +414,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
|
|
|
|
|
leftPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); |
|
|
|
|
replaceLeftPane(leftPane); |
|
|
|
|
|
|
|
|
|
ResizeListener resizeListener = new ResizeListener(); |
|
|
|
|
leftPane.addMouseListener(resizeListener); |
|
|
|
|
leftPane.addMouseMotionListener(resizeListener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void switchMode(PropertyMode mode) { |
|
|
|
@ -1102,11 +1109,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
@Override |
|
|
|
|
public void setVisible(boolean visible) { |
|
|
|
|
super.setVisible(visible); |
|
|
|
|
if (visible == true) { |
|
|
|
|
if (visible) { |
|
|
|
|
setPreferredSize(new Dimension(getParent().getWidth() - TAB_WIDTH, POPUP_DEFAULT_HEIGHT)); |
|
|
|
|
replaceContentPane(propertyItem.getContentArea()); |
|
|
|
|
} else { |
|
|
|
|
propertyItem.reAddContentArea(); |
|
|
|
|
} |
|
|
|
|
propertyItem.getContentArea().revalidate(); |
|
|
|
|
propertyItem.getContentArea().repaint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void menuSelectionChanged(boolean isIncluded) { |
|
|
|
@ -1189,7 +1199,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
|
if (e.getX() >= ARROW_RANGE_START) { |
|
|
|
|
if (getButtonBounds().contains(e.getPoint())) { |
|
|
|
|
onPop(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1204,8 +1214,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
if (e.getX() < ARROW_RANGE_START) { |
|
|
|
|
mouseDownCompCoords = e.getPoint(); |
|
|
|
|
if (isMovable) { |
|
|
|
|
mouseDownCompCoords = new Point(e.getX(), e.getY()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -1213,7 +1223,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
private MouseMotionListener mouseMotionListener = new MouseMotionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void mouseMoved(MouseEvent e) { |
|
|
|
|
if (e.getX() >= ARROW_RANGE_START) { |
|
|
|
|
Rectangle buttonBounds = getButtonBounds(); |
|
|
|
|
if (buttonBounds.contains(e.getPoint())) { |
|
|
|
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
|
|
} else if (isMovable) { |
|
|
|
|
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); |
|
|
|
@ -1321,7 +1332,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
} else { |
|
|
|
|
button = UIConstants.POP_BUTTON_UP; |
|
|
|
|
} |
|
|
|
|
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, (ARROW_RANGE_START + 8), 4, null)); |
|
|
|
|
int buttonX = getWidth() - button.getWidth(null) - 10; |
|
|
|
|
int buttonY = 4; |
|
|
|
|
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, buttonX, buttonY, null)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Rectangle getButtonBounds() { |
|
|
|
|
int buttonWidth = UIConstants.POP_BUTTON_UP.getWidth(null); |
|
|
|
|
int buttonHeight = UIConstants.POP_BUTTON_UP.getHeight(null); |
|
|
|
|
int buttonX = getWidth() - buttonWidth - 10; |
|
|
|
|
int buttonY = 4; |
|
|
|
|
return new Rectangle(buttonX, buttonY, buttonWidth, buttonHeight); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1330,6 +1351,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
private static final int RESIZE_RANGE = 8; |
|
|
|
|
private Cursor originCursor; |
|
|
|
|
private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); |
|
|
|
|
private Cursor eastResizeCursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); |
|
|
|
|
private Point mouseDownCompCoords; |
|
|
|
|
private JPanel contentWrapper; |
|
|
|
|
|
|
|
|
@ -1402,17 +1424,29 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
addMouseMotionListener(new MouseMotionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void mouseDragged(MouseEvent e) { |
|
|
|
|
if (mouseDownCompCoords != null) { |
|
|
|
|
Rectangle bounds = getBounds(); |
|
|
|
|
Point currCoords = e.getLocationOnScreen(); |
|
|
|
|
bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height; |
|
|
|
|
// 校正位置
|
|
|
|
|
if (bounds.height < POPUP_MIN_HEIGHT) { |
|
|
|
|
bounds.height = POPUP_MIN_HEIGHT; |
|
|
|
|
} |
|
|
|
|
mouseDownCompCoords.y = currCoords.y; |
|
|
|
|
setBounds(bounds); |
|
|
|
|
} |
|
|
|
|
if (mouseDownCompCoords == null) return; |
|
|
|
|
|
|
|
|
|
Rectangle bounds = getBounds(); |
|
|
|
|
Point currCoords = e.getLocationOnScreen(); |
|
|
|
|
|
|
|
|
|
bounds.height = adjustSize(bounds.height, currCoords.y - mouseDownCompCoords.y, |
|
|
|
|
POPUP_MIN_HEIGHT, POPUP_MAX_HEIGHT, southResizeCursor); |
|
|
|
|
|
|
|
|
|
bounds.width = adjustSize(bounds.width, currCoords.x - mouseDownCompCoords.x, |
|
|
|
|
POPUP_MIN_WIDTH, POPUP_MAX_WIDTH, eastResizeCursor); |
|
|
|
|
|
|
|
|
|
mouseDownCompCoords = currCoords; |
|
|
|
|
setBounds(bounds); |
|
|
|
|
|
|
|
|
|
contentWrapper.revalidate(); |
|
|
|
|
contentWrapper.repaint(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int adjustSize(int currentSize, int delta, int minSize, int maxSize, Cursor resizeCursor) { |
|
|
|
|
return getCursor().equals(resizeCursor) |
|
|
|
|
? Math.max(minSize, Math.min(maxSize, currentSize + delta)) |
|
|
|
|
: currentSize; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -1420,13 +1454,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
if (originCursor == null) { // 记录最初的光标
|
|
|
|
|
originCursor = getCursor(); |
|
|
|
|
} |
|
|
|
|
if (e.getY() > getHeight() - RESIZE_RANGE) { |
|
|
|
|
setCursor(southResizeCursor); |
|
|
|
|
} else { |
|
|
|
|
// 还原
|
|
|
|
|
if (mouseDownCompCoords == null && getCursor().equals(southResizeCursor)) { |
|
|
|
|
setCursor(originCursor); |
|
|
|
|
} |
|
|
|
|
Cursor newCursor = originCursor; |
|
|
|
|
if (e.getY() >= getHeight() - RESIZE_RANGE) { |
|
|
|
|
newCursor = southResizeCursor; |
|
|
|
|
} else if (e.getX() >= getWidth() - RESIZE_RANGE) { |
|
|
|
|
newCursor = eastResizeCursor; |
|
|
|
|
} |
|
|
|
|
if (!getCursor().equals(newCursor)) { |
|
|
|
|
setCursor(newCursor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
repaint(); |
|
|
|
@ -1435,7 +1470,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
addMouseListener(new MouseAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
if (getCursor().equals(southResizeCursor)) { |
|
|
|
|
if (getCursor().equals(southResizeCursor) || getCursor().equals(eastResizeCursor)) { |
|
|
|
|
mouseDownCompCoords = e.getLocationOnScreen(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|