|
|
|
@ -28,12 +28,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
private JPanel leftPane; |
|
|
|
|
private JPanel rightPane; |
|
|
|
|
private FixedPopupPane currentPopupPane; |
|
|
|
|
private static final int CONTAINER_WIDTH = 290; |
|
|
|
|
private static final int TAB_WIDTH = 40; |
|
|
|
|
private static final int CONTAINER_WIDTH = 288; |
|
|
|
|
private static final int TAB_WIDTH = 38; |
|
|
|
|
private static final int TAB_BUTTON_WIDTH = 32; |
|
|
|
|
private static final int TAB_BUTTON_HEIGHT = 28; |
|
|
|
|
private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH; |
|
|
|
|
private static final int POPUP_TOOLPANE_HEIGHT = 25; |
|
|
|
|
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 = 480; |
|
|
|
|
private static final int POPUP_DEFAULT_HEIGHT = 360; |
|
|
|
|
private static final String KEY_CELL_ELEMENT = "cellElement"; |
|
|
|
|
private static final String KEY_CELL_ATTR = "cellAttr"; |
|
|
|
|
private static final String KEY_FLOAT_ELEMENT = "floatElement"; |
|
|
|
@ -43,7 +48,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
private static final String KEY_WIDGET_LIB = "widgetLib"; |
|
|
|
|
private static final String KEY_AUTHORITY_EDITION = "authorityEdition"; |
|
|
|
|
private static final String KEY_CONFIGURED_ROLES = "editedRoles"; |
|
|
|
|
private static final String DEFAULT_PANE = "defaultPane"; // "无可用配置项"面板
|
|
|
|
|
private static final String DEFAULT_PANE = "defaultPane"; |
|
|
|
|
private static final String DEFAULT_AUTHORITY_PANE = "defaultAuthorityPane"; |
|
|
|
|
|
|
|
|
|
private JPanel defaultPane; // "无可用配置项"面板
|
|
|
|
|
private JPanel defaultAuthorityPane; // "该元素不支持权限编辑"
|
|
|
|
|
|
|
|
|
|
public enum PropertyMode { |
|
|
|
|
REPORT, // 报表
|
|
|
|
@ -78,6 +87,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
super(); |
|
|
|
|
// setVerticalDragEnabled(false);
|
|
|
|
|
initPropertyItemList(); |
|
|
|
|
defaultPane = getDefaultPane(Inter.getLocText("FR-Designer_No_Settings_Available")); |
|
|
|
|
defaultAuthorityPane = getDefaultPane(Inter.getLocText("FR-Designer_Not_Support_Authority_Edit")); |
|
|
|
|
switchMode(PropertyMode.REPORT); |
|
|
|
|
// initContentPane();
|
|
|
|
|
// super(leftPane, rightPane);
|
|
|
|
@ -135,9 +146,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// "无可用配置项"面板
|
|
|
|
|
private JPanel getDefaultPane() { |
|
|
|
|
private JPanel getDefaultPane(String prompt) { |
|
|
|
|
JPanel defaultPane = new JPanel(); |
|
|
|
|
UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available")); |
|
|
|
|
UILabel label = new UILabel(prompt); |
|
|
|
|
label.setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
|
defaultPane.setLayout(new BorderLayout()); |
|
|
|
|
defaultPane.add(label, BorderLayout.CENTER); |
|
|
|
|
return defaultPane; |
|
|
|
@ -160,7 +172,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
} |
|
|
|
|
rightPane.add(item.getName(), item.getPropertyPanel()); |
|
|
|
|
} |
|
|
|
|
rightPane.add(DEFAULT_PANE, getDefaultPane()); |
|
|
|
|
rightPane.add(DEFAULT_PANE, defaultPane); |
|
|
|
|
rightPane.add(DEFAULT_AUTHORITY_PANE, defaultAuthorityPane); |
|
|
|
|
|
|
|
|
|
replaceRightPane(rightPane); |
|
|
|
|
refreshRightPane(); |
|
|
|
@ -177,8 +190,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
leftPane.add(item.getButton()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
|
|
|
|
|
leftPane.setBackground(new Color(226, 226, 226)); |
|
|
|
|
leftPane.setBackground(UIConstants.PROPERTY_PANE_BACKGROUND); |
|
|
|
|
replaceLeftPane(leftPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -358,16 +370,24 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
*/ |
|
|
|
|
public void refreshRightPane() { |
|
|
|
|
boolean hasAvailableTab = false; |
|
|
|
|
boolean hasEnabledTab = false; |
|
|
|
|
for (String name : propertyItemMap.keySet()) { |
|
|
|
|
PropertyItem propertyItem = propertyItemMap.get(name); |
|
|
|
|
if (propertyItem.isVisible() && !propertyItem.isPoppedOut() && propertyItem.isEnabled()) { |
|
|
|
|
propertyCard.show(rightPane, name); // 显示第一个可用tab
|
|
|
|
|
hasAvailableTab = true; |
|
|
|
|
break; |
|
|
|
|
if (propertyItem.isVisible() && propertyItem.isEnabled()) { |
|
|
|
|
hasEnabledTab = true; |
|
|
|
|
if (!propertyItem.isPoppedOut()) { |
|
|
|
|
propertyCard.show(rightPane, name); // 显示第一个可用tab
|
|
|
|
|
hasAvailableTab = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!hasAvailableTab) { |
|
|
|
|
propertyCard.show(rightPane, DEFAULT_PANE); |
|
|
|
|
if (!hasEnabledTab && BaseUtils.isAuthorityEditing()) { |
|
|
|
|
propertyCard.show(rightPane, DEFAULT_AUTHORITY_PANE); |
|
|
|
|
} else { |
|
|
|
|
propertyCard.show(rightPane, DEFAULT_PANE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if (this.getRightPane() instanceof DockingView) {
|
|
|
|
@ -431,7 +451,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
private static final String ICON_SUFFIX_SELECTED = "_selected.png"; |
|
|
|
|
private String btnIconName; |
|
|
|
|
private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一
|
|
|
|
|
private final Color selectedBtnBackground = new Color(240, 240, 240); |
|
|
|
|
private final Color selectedBtnBackground = new Color(0xF5F5F7); |
|
|
|
|
private Color originBtnBackground; |
|
|
|
|
|
|
|
|
|
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) { |
|
|
|
@ -577,7 +597,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
private void initButton() { |
|
|
|
|
button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) { |
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_WIDTH); |
|
|
|
|
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void paintComponent(Graphics g) { |
|
|
|
@ -666,36 +686,25 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
|
|
|
|
|
private class FixedPopupPane extends JPopupMenu { |
|
|
|
|
private JComponent contentPane; |
|
|
|
|
// private PopupToolPane popupToolPane;
|
|
|
|
|
private int fixedHeight; |
|
|
|
|
FixedPopupPane(PropertyItem propertyItem) { |
|
|
|
|
contentPane = propertyItem.getContentPane(); |
|
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
|
// popupToolPane = ;
|
|
|
|
|
this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH); |
|
|
|
|
this.add(contentPane, BorderLayout.CENTER); |
|
|
|
|
this.setOpaque(false); |
|
|
|
|
fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height; |
|
|
|
|
updateSize(); |
|
|
|
|
setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, POPUP_DEFAULT_HEIGHT)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void menuSelectionChanged(boolean isIncluded) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateSize() { |
|
|
|
|
int newHeight = fixedHeight + contentPane.getPreferredSize().height; |
|
|
|
|
this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public JComponent getContentPane() { |
|
|
|
|
return contentPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void replaceContentPane(JComponent pane) { |
|
|
|
|
// remove(pane);
|
|
|
|
|
this.remove(this.contentPane); |
|
|
|
|
this.add(this.contentPane = pane); |
|
|
|
|
updateSize(); |
|
|
|
|
refreshContainer(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -708,9 +717,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
|
|
|
|
|
// 弹出属性面板的工具条
|
|
|
|
|
private class PopupToolPane extends JPanel { |
|
|
|
|
private int model = UIConstants.MODEL_NORMAL; |
|
|
|
|
private String title; |
|
|
|
|
private JComponent contentPane; |
|
|
|
|
private PropertyItem propertyItem; |
|
|
|
|
private String buttonType; |
|
|
|
|
private JDialog parentDialog; // 如果不在对话框中,值为null
|
|
|
|
@ -733,7 +740,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
if (mouseDownCompCoords == null) { |
|
|
|
|
setBackground(originColor); |
|
|
|
|
} |
|
|
|
|
model = UIConstants.MODEL_NORMAL; |
|
|
|
|
repaint(); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
@ -762,13 +768,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
public void mouseMoved(MouseEvent e) { |
|
|
|
|
if (e.getX() >= ARROW_RANGE_START) { |
|
|
|
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
|
|
model = UIConstants.MODEL_PRESS; |
|
|
|
|
} else if (isMovable) { |
|
|
|
|
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); |
|
|
|
|
setBackground(Color.pink); |
|
|
|
|
} else { |
|
|
|
|
setCursor(Cursor.getDefaultCursor()); |
|
|
|
|
model = UIConstants.MODEL_NORMAL; |
|
|
|
|
} |
|
|
|
|
repaint(); |
|
|
|
|
} |
|
|
|
@ -808,13 +812,12 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
super(); |
|
|
|
|
this.propertyItem = propertyItem; |
|
|
|
|
this.title = propertyItem.getTitle(); |
|
|
|
|
this.contentPane = propertyItem.getContentPane(); |
|
|
|
|
originColor = getBackground(); |
|
|
|
|
originColor = Color.white; |
|
|
|
|
setBackground(originColor); |
|
|
|
|
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)); |
|
|
|
|
setBorder(new EmptyBorder(5, 10, 5, 0)); |
|
|
|
|
|
|
|
|
|
initToolButton(buttonType); |
|
|
|
|
} |
|
|
|
@ -857,27 +860,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
Image button; |
|
|
|
|
g.setColor(new Color(69, 135, 255)); |
|
|
|
|
g.setFont(FRFont.getInstance().applySize(14)); |
|
|
|
|
// g.drawString(title, 5, 20);
|
|
|
|
|
// g.drawImage(UIConstants.DRAG_BAR, 0, 0, CONTENT_WIDTH, POPUP_TOOLPANE_HEIGHT, null);
|
|
|
|
|
|
|
|
|
|
if (buttonType.equals(NO_BUTTON)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (buttonType.equals(DOWN_BUTTON)) { |
|
|
|
|
if (model == UIConstants.MODEL_NORMAL) { |
|
|
|
|
button = UIConstants.DRAG_LEFT_NORMAL; |
|
|
|
|
} else { |
|
|
|
|
button = UIConstants.DRAG_LEFT_PRESS; |
|
|
|
|
} |
|
|
|
|
button = UIConstants.POP_BUTTON_DOWN; |
|
|
|
|
} else { |
|
|
|
|
if (model == UIConstants.MODEL_NORMAL) { |
|
|
|
|
button = UIConstants.DRAG_RIGHT_NORMAL; |
|
|
|
|
} else { |
|
|
|
|
button = UIConstants.DRAG_RIGHT_PRESS; |
|
|
|
|
} |
|
|
|
|
button = UIConstants.POP_BUTTON_UP; |
|
|
|
|
} |
|
|
|
|
// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
|
|
|
|
|
g.drawImage(button, ARROW_RANGE_START + 12, 7, 5, 5, null); |
|
|
|
|
g.drawImage(button, ARROW_RANGE_START + 8, 4, 16, 16, null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -887,7 +878,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
private Cursor originCursor; |
|
|
|
|
private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); |
|
|
|
|
private Point mouseDownCompCoords; |
|
|
|
|
private int minHeight; // 对话框最小高度
|
|
|
|
|
|
|
|
|
|
private JComponent contentPane; |
|
|
|
|
private PropertyItem propertyItem; |
|
|
|
|
public PopupDialog(PropertyItem propertyItem) { |
|
|
|
@ -900,8 +891,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
contentPane = propertyItem.getContentPane(); |
|
|
|
|
container.add(popupToolPane, BorderLayout.NORTH); |
|
|
|
|
container.add(contentPane, BorderLayout.CENTER); |
|
|
|
|
minHeight = container.getPreferredSize().height; |
|
|
|
|
setSize(CONTENT_WIDTH, minHeight); |
|
|
|
|
setSize(CONTENT_WIDTH, POPUP_DEFAULT_HEIGHT); |
|
|
|
|
// validate();
|
|
|
|
|
adjustLocation(); |
|
|
|
|
|
|
|
|
@ -941,8 +931,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
|
|
|
|
|
Point currCoords = e.getLocationOnScreen(); |
|
|
|
|
bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height; |
|
|
|
|
// 校正位置
|
|
|
|
|
if (bounds.height < minHeight) { |
|
|
|
|
bounds.height = minHeight; |
|
|
|
|
if (bounds.height < POPUP_MIN_HEIGHT) { |
|
|
|
|
bounds.height = POPUP_MIN_HEIGHT; |
|
|
|
|
} |
|
|
|
|
if (bounds.height > POPUP_MAX_HEIGHT) { |
|
|
|
|
bounds.height = POPUP_MAX_HEIGHT; |
|
|
|
|
} |
|
|
|
|
mouseDownCompCoords.y = currCoords.y; |
|
|
|
|
setBounds(bounds); |
|
|
|
|