Browse Source

REPORT-6270 & REPORT-6258 参数面板里的相关bug;tab标签右击时原本的移动功能被覆盖了

master
plough 7 years ago
parent
commit
4390fda202
  1. 1
      designer-base/src/com/fr/design/gui/imenu/UIPopupMenu.java
  2. 3
      designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  3. 21
      designer-form/src/com/fr/design/designer/creator/XCreator.java
  4. 8
      designer-form/src/com/fr/design/designer/creator/XLayoutContainer.java
  5. 5
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  6. 21
      designer-form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  7. 6
      designer-form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  8. 31
      designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  9. 17
      designer-form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  10. 24
      designer-form/src/com/fr/design/mainframe/EditingMouseListener.java
  11. 11
      designer-form/src/com/fr/design/mainframe/FormDesigner.java
  12. 24
      designer-form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  13. 28
      designer-form/src/com/fr/design/parameter/ParameterPropertyPane.java

1
designer-base/src/com/fr/design/gui/imenu/UIPopupMenu.java

@ -10,6 +10,7 @@ import com.fr.design.constants.UIConstants;
public class UIPopupMenu extends JPopupMenu{
private static final float REC = 8f;
private boolean onlyText = false;
public static UIPopupMenu EMPTY = new UIPopupMenu();
public UIPopupMenu() {
super();
setBackground(UIConstants.NORMAL_BACKGROUND);

3
designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -499,7 +499,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private boolean isEnabled = true; // 是否可用
private Set<PropertyMode> visibleModes;
private Set<PropertyMode> enableModes;
private static final int MAX_PARA_HEIGHT = 240;
// 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix
private static final String ICON_BASE_DIR = "/com/fr/design/images/buttonicon/propertiestab/";
@ -621,8 +620,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void replaceHeaderPane(JComponent pane) {
contentArea.remove(headerPane);
int height = Math.min(pane.getPreferredSize().height, MAX_PARA_HEIGHT);
pane.setPreferredSize(new Dimension(pane.getPreferredSize().width, height));
headerPane = pane;
contentArea.add(headerPane, BorderLayout.NORTH);

21
designer-form/src/com/fr/design/designer/creator/XCreator.java

@ -12,16 +12,27 @@ import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.AuthorityPropertyPane;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.NoSupportAuthorityEdit;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.beans.IntrospectionException;
import java.util.ArrayList;
@ -671,9 +682,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* 创建右击弹出菜单
*
*/
public JPopupMenu createPopupMenu(FormDesigner formDesigner) {
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
UpdateAction[] actions = formDesigner.getActions();
JPopupMenu popup = new UIPopupMenu();
UIPopupMenu popup = new UIPopupMenu();
for (int i = 0; i < actions.length; i++) {
if (i == SHORTS_SEPARATOR_POS) {
popup.addSeparator();

8
designer-form/src/com/fr/design/designer/creator/XLayoutContainer.java

@ -560,4 +560,12 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
return false;
}
/**
* 内部组件是否支持叠加顺序的调整
* return boolean
*/
public boolean supportInnerOrderChangeActions() {
return false;
}
}

5
designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -520,4 +520,9 @@ public class XWAbsoluteLayout extends XLayoutContainer {
widget.setBounds(xCreator.getBounds());
}
}
@Override
public boolean supportInnerOrderChangeActions() {
return true;
}
}

21
designer-form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java

@ -1,13 +1,5 @@
package com.fr.design.designer.creator.cardlayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.AdapterBus;
@ -15,6 +7,7 @@ import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.XButton;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
@ -25,6 +18,13 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.Icon;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
public class XCardAddButton extends XButton{
private XWCardTagLayout tagLayout;
@ -112,6 +112,11 @@ public class XCardAddButton extends XButton{
tagLayout.setTabsAndAdjust();
LayoutUtils.layoutRootContainer(designer.getRootComponent());
}
@Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 不要菜单
}
private void initRelateLayout(){
XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent();

6
designer-form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -13,6 +13,7 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
@ -213,6 +214,11 @@ public class XCardSwitchButton extends XButton {
GUICoreUtils.showPopupMenu(jPopupMenu, editingMouseListener.getDesigner(), e.getX(), e.getY());
}
@Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 自己有一个showPopupMenu,不需要使用通用的弹出菜单
}
//删除card,同时修改其他switchbutton和tabfit的index
private void deleteCard(XCardSwitchButton button,int index){
String titleName = button.getContentLabel().getText();

31
designer-form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -3,19 +3,6 @@
*/
package com.fr.design.designer.creator.cardlayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.border.Border;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.designer.beans.AdapterBus;
@ -33,6 +20,7 @@ import com.fr.design.form.layout.FRFlowLayout;
import com.fr.design.form.layout.FRHorizontalLayout;
import com.fr.design.form.layout.FRVerticalLayout;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
@ -45,6 +33,18 @@ import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import javax.swing.border.Border;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @date: 2014-11-25-下午3:11:14
*/
@ -239,6 +239,11 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
}
}
@Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 不要菜单
}
public int[] getDirections() {
return ((XCreator)getParent()).getDirections();
}

17
designer-form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -11,23 +11,29 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.beans.IntrospectionException;
@ -98,6 +104,11 @@ public class XWTabFitLayout extends XWFitLayout {
super(widget, initSize);
}
@Override
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 不要菜单
}
/**
* 得到属性名
* @return 属性名

24
designer-form/src/com/fr/design/mainframe/EditingMouseListener.java

@ -9,11 +9,18 @@ import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.beans.location.Location;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.beans.models.StateModel;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XEditorHolder;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.xpane.ToolTipEditor;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.utils.ComponentUtils;
@ -22,9 +29,16 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPopupMenu;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import javax.swing.event.MouseInputAdapter;
import java.awt.*;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
/**
@ -540,8 +554,8 @@ public class EditingMouseListener extends MouseInputAdapter {
if (creator != null) {
creator.respondClick(this, e);
if (e.getButton() == MouseEvent.BUTTON3) {
JPopupMenu cellPopupMenu = creator.createPopupMenu(designer);
if (cellPopupMenu != null) {
UIPopupMenu cellPopupMenu = creator.createPopupMenu(designer);
if (cellPopupMenu != UIPopupMenu.EMPTY) {
GUICoreUtils.showPopupMenu(cellPopupMenu, designer, e.getX(), e.getY());
}
}

11
designer-form/src/com/fr/design/mainframe/FormDesigner.java

@ -1013,6 +1013,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
*/
@Override
public void valueChanged(TreeSelectionEvent e) {
if (DesignerContext.getDesignerFrame().getSelectedJTemplate() == null) { // 初始化完成前,不响应事件
return;
}
ComponentTree tree = (ComponentTree) e.getSource();
TreePath[] paths = tree.getSelectionPaths();
@ -1139,8 +1142,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 当前选中控件可以上移一层吗?
public boolean isCurrentComponentMovableUp() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator();
Container container = creator.getParent();
if (container == null) {
XLayoutContainer container = (XLayoutContainer) creator.getParent();
if (container == null || !container.supportInnerOrderChangeActions()) {
return false;
}
return creator.isMovable() && container.getComponentZOrder(creator) > 0;
@ -1149,8 +1152,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 当前选中控件可以下移一层吗?
public boolean isCurrentComponentMovableDown() {
XCreator creator = getSelectionModel().getSelection().getSelectedCreator();
Container container = creator.getParent();
if (container == null) {
XLayoutContainer container = (XLayoutContainer) creator.getParent();
if (container == null || !container.supportInnerOrderChangeActions()) {
return false;
}
return creator.isMovable() && container.getComponentZOrder(creator) < container.getComponentCount() - 1;

24
designer-form/src/com/fr/design/mainframe/FormHierarchyTreePane.java

@ -13,15 +13,22 @@ import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.gui.style.BorderPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.parameter.HierarchyTreePane;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.ArrayList;
@ -96,8 +103,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
formDesigner.addDesignerEditListener(new DesignerEditListener() {
@Override
public void fireCreatorModified(DesignerEvent evt) {
componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath());
componentTree.refreshUI();
refreshComponentTree();
}
});
@ -110,6 +116,14 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
}
add(getWidgetPane(), BorderLayout.CENTER);
// 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态
refreshComponentTree();
}
private void refreshComponentTree() {
componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath());
componentTree.refreshUI();
}
private JPanel getWidgetPane() {

28
designer-form/src/com/fr/design/parameter/ParameterPropertyPane.java

@ -4,10 +4,17 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.*;
import javax.swing.*;
import java.awt.*;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -26,6 +33,7 @@ public class ParameterPropertyPane extends JPanel{
private static final int PADDING_SMALL = 5;
private static final int PADDING_MIDDLE = 10;
private static final int PADDING_LARGE = 15;
private static final int ADD_PARA_PANE_MAX_HEIGHT = 95;
public static final ParameterPropertyPane getInstance() {
if (THIS == null) {
@ -86,6 +94,7 @@ public class ParameterPropertyPane extends JPanel{
// 显示或隐藏添加参数面板
public void refreshState(JTemplate jt) {
setAddParaPaneVisible(toolbarPane.hasSelectedLabelItem(), jt);
updateAddParaPaneSize();
}
// 显示或隐藏添加参数面板
@ -93,6 +102,16 @@ public class ParameterPropertyPane extends JPanel{
refreshState(DesignerContext.getDesignerFrame().getSelectedJTemplate());
}
private void updateAddParaPaneSize() {
if (!addParaPane.isVisible()) {
return;
}
addParaPane.setPreferredSize(null);
int height = Math.min(addParaPane.getPreferredSize().height, ADD_PARA_PANE_MAX_HEIGHT);
addParaPane.setPreferredSize(new Dimension(addParaPane.getPreferredSize().width, height));
repaintContainer();
}
public void setAddParaPaneVisible(boolean isVisible, JTemplate jt) {
if (isVisible == addParaPane.isVisible() || formHierarchyTreePaneWrapper == null) {
return;
@ -112,7 +131,6 @@ public class ParameterPropertyPane extends JPanel{
addParaPane.setVisible(false);
this.setPreferredSize(new Dimension(getWidth(), formHierarchyTreePaneWrapper.getPreferredSize().height + UIConstants.GAP_NORMAL));
}
repaintContainer();
}
private void setEditor(FormDesigner editor) {

Loading…
Cancel
Save