Browse Source

REPORT-6558 & REPORT-6443 & REPORT-6645 组件叠加优化交互验收;控件树消失问题=>减少对其他地方的影响;参数面板里的bug2

master
plough 7 years ago
parent
commit
1e05a18b4c
  1. 9
      designer-base/src/com/fr/design/actions/UpdateAction.java
  2. 13
      designer-base/src/com/fr/design/event/DesignerOpenedListener.java
  3. 19
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  4. 1
      designer-base/src/com/fr/start/BaseDesigner.java
  5. 3
      designer-form/src/com/fr/design/designer/beans/actions/CopyAction.java
  6. 3
      designer-form/src/com/fr/design/designer/beans/actions/CutAction.java
  7. 11
      designer-form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java
  8. 17
      designer-form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java
  9. 12
      designer-form/src/com/fr/design/designer/beans/actions/MoveDownAction.java
  10. 21
      designer-form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java
  11. 21
      designer-form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java
  12. 14
      designer-form/src/com/fr/design/designer/beans/actions/MoveUpAction.java
  13. 20
      designer-form/src/com/fr/design/designer/beans/actions/behavior/ComponentEnable.java
  14. 19
      designer-form/src/com/fr/design/designer/beans/actions/behavior/MovableDownEnable.java
  15. 19
      designer-form/src/com/fr/design/designer/beans/actions/behavior/MovableUpEnable.java
  16. 8
      designer-form/src/com/fr/design/designer/beans/actions/behavior/UpdateBehavior.java
  17. 5
      designer-form/src/com/fr/design/mainframe/ComponentTree.java
  18. 70
      designer-form/src/com/fr/design/mainframe/FormDesigner.java
  19. 5
      designer-form/src/com/fr/design/mainframe/JForm.java
  20. 6
      designer-form/src/com/fr/design/parameter/ParameterPropertyPane.java

9
designer-base/src/com/fr/design/actions/UpdateAction.java

@ -293,13 +293,20 @@ public abstract class UpdateAction extends ShortCut implements Action {
button.setEnabled(this.isEnabled()); button.setEnabled(this.isEnabled());
//peter:产生tooltip //peter:产生tooltip
button.setToolTipText(ActionFactory.createButtonToolTipText(this)); button.setToolTipText(getToolTipText());
object = button; object = button;
} }
return (JComponent) object; return (JComponent) object;
} }
/**
* 重写此方法可以自定义 action 的提示文字
*/
protected String getToolTipText() {
return ActionFactory.createButtonToolTipText(this);
}
/** /**
* Equals * Equals
*/ */

13
designer-base/src/com/fr/design/event/DesignerOpenedListener.java

@ -0,0 +1,13 @@
package com.fr.design.event;
import java.util.EventListener;
/**
* Created by plough on 2018/1/19.
*/
public interface DesignerOpenedListener extends EventListener {
/**
* Invoked when the target of the listener has changed the rpt content.
*/
public void designerOpened();
}

19
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -16,6 +16,7 @@ import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -95,6 +96,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private static final Integer TOP_LAYER = new Integer((200)); private static final Integer TOP_LAYER = new Integer((200));
private static java.util.List<App<?>> appList = new java.util.ArrayList<App<?>>(); private static java.util.List<App<?>> appList = new java.util.ArrayList<App<?>>();
private List<DesignerOpenedListener> designerOpenedListenerList = new ArrayList<>();
private ToolBarMenuDock ad; private ToolBarMenuDock ad;
private DesktopCardPane centerTemplateCardPane; private DesktopCardPane centerTemplateCardPane;
@ -287,6 +290,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
/**
* 注册"设计器初始化完成"的监听
*/
public void addDesignerOpenedListener(DesignerOpenedListener listener) {
designerOpenedListenerList.add(listener);
}
/**
* 触发"设计器初始化完成"事件
*/
public void fireDesignerOpened() {
for (DesignerOpenedListener listener : designerOpenedListenerList) {
listener.designerOpened();
}
}
protected DesktopCardPane getCenterTemplateCardPane() { protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane; return centerTemplateCardPane;
} }

1
designer-base/src/com/fr/start/BaseDesigner.java

@ -93,6 +93,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
+ DesignerEnvManager.getEnvManager().getLastOpenFile()); + DesignerEnvManager.getEnvManager().getLastOpenFile());
} }
isException = openFile(df, isException, file); isException = openFile(df, isException, file);
df.fireDesignerOpened();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (!isException) { if (!isException) {

3
designer-form/src/com/fr/design/designer/beans/actions/CopyAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -18,6 +19,7 @@ public class CopyAction extends FormWidgetEditAction {
this.setMnemonic('C'); this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
setUpdateBehavior(new ComponentEnable());
} }
@Override @Override
@ -28,5 +30,4 @@ public class CopyAction extends FormWidgetEditAction {
} }
return false; return false;
} }
} }

3
designer-form/src/com/fr/design/designer/beans/actions/CutAction.java

@ -6,6 +6,7 @@ import java.awt.event.KeyEvent;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
@ -19,6 +20,7 @@ public class CutAction extends FormWidgetEditAction {
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
this.setUpdateBehavior(new ComponentEnable());
} }
@Override @Override
@ -29,5 +31,4 @@ public class CutAction extends FormWidgetEditAction {
} }
return editPane.cut(); return editPane.cut();
} }
} }

11
designer-form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java

@ -8,6 +8,7 @@ import java.awt.event.KeyEvent;
import javax.swing.*; import javax.swing.*;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.ComponentEnable;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
@ -27,6 +28,13 @@ public class FormDeleteAction extends FormWidgetEditAction {
// Richie:删除菜单图标 // Richie:删除菜单图标
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0));
this.setUpdateBehavior(new ComponentEnable());
}
@Override
protected String getToolTipText() {
String originText = super.getToolTipText();
return originText.replace(KeyEvent.getKeyText(KeyEvent.VK_BACK_SPACE), KeyEvent.getKeyText(KeyEvent.VK_DELETE));
} }
@Override @Override
@ -48,11 +56,8 @@ public class FormDeleteAction extends FormWidgetEditAction {
if (designer == null) { if (designer == null) {
return false; return false;
} }
FormSelection selection = designer.getSelectionModel().getSelection();
XCreator creator = selection.getSelectedCreator();
designer.getSelectionModel().deleteSelection(); designer.getSelectionModel().deleteSelection();
creator.deleteRelatedComponent(creator, designer);
return false; return false;
} }
} }

17
designer-form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java

@ -1,23 +1,32 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.designer.beans.actions.behavior.UpdateBehavior;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
import com.fr.stable.ReportFunctionProcessor; import com.fr.stable.ReportFunctionProcessor;
import com.fr.stable.fun.FunctionProcessor; import com.fr.stable.fun.FunctionProcessor;
import javax.swing.JButton; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
public abstract class FormWidgetEditAction extends TemplateComponentAction<FormDesigner> { public abstract class FormWidgetEditAction extends TemplateComponentAction<FormDesigner> {
private UpdateBehavior updateBehavior = new UpdateBehavior<FormWidgetEditAction>() {
@Override
public void doUpdate(FormWidgetEditAction action) {
action.setEnabled(true);
}
};
protected FormWidgetEditAction(FormDesigner t) { protected FormWidgetEditAction(FormDesigner t) {
super(t); super(t);
} }
@Override @Override
public void update() { public void update() {
this.setEnabled(true); updateBehavior.doUpdate(this);
} }
@Override @Override
@ -36,4 +45,8 @@ public abstract class FormWidgetEditAction extends TemplateComponentAction<FormD
} }
} }
public void setUpdateBehavior(UpdateBehavior updateBehavior) {
this.updateBehavior = updateBehavior;
}
} }

12
designer-form/src/com/fr/design/designer/beans/actions/MoveDownAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.MovableDownEnable;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -28,6 +29,7 @@ public class MoveDownAction extends FormWidgetEditAction {
this.setMnemonic('B'); this.setMnemonic('B');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER));
this.setUpdateBehavior(new MovableDownEnable());
} }
@Override @Override
@ -47,14 +49,4 @@ public class MoveDownAction extends FormWidgetEditAction {
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED); designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true; return true;
} }
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableDown());
}
} }

21
designer-form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.MovableDownEnable;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -27,7 +28,14 @@ public class MoveToBottomAction extends FormWidgetEditAction {
this.setName(Inter.getLocText("FR-Designer_Move_To_Bottom")); this.setName(Inter.getLocText("FR-Designer_Move_To_Bottom"));
this.setMnemonic('K'); this.setMnemonic('K');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_bottom.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_bottom.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER + InputEvent.ALT_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, DEFAULT_MODIFIER + InputEvent.SHIFT_MASK));
this.setUpdateBehavior(new MovableDownEnable());
}
@Override
protected String getToolTipText() {
String originText = super.getToolTipText();
return originText.replace(KeyEvent.getKeyText(KeyEvent.VK_OPEN_BRACKET), "[");
} }
@Override @Override
@ -47,15 +55,4 @@ public class MoveToBottomAction extends FormWidgetEditAction {
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED); designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true; return true;
} }
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableDown());
}
} }

21
designer-form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.MovableUpEnable;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -27,7 +28,14 @@ public class MoveToTopAction extends FormWidgetEditAction {
this.setName(Inter.getLocText("FR-Designer_Move_To_Top")); this.setName(Inter.getLocText("FR-Designer_Move_To_Top"));
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_top.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/to_top.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER + InputEvent.ALT_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER + InputEvent.SHIFT_MASK));
this.setUpdateBehavior(new MovableUpEnable());
}
@Override
protected String getToolTipText() {
String originText = super.getToolTipText();
return originText.replace(KeyEvent.getKeyText(KeyEvent.VK_CLOSE_BRACKET), "]");
} }
@Override @Override
@ -46,15 +54,4 @@ public class MoveToTopAction extends FormWidgetEditAction {
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED); designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true; return true;
} }
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableUp());
}
} }

14
designer-form/src/com/fr/design/designer/beans/actions/MoveUpAction.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.actions; package com.fr.design.designer.beans.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.behavior.MovableUpEnable;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -27,6 +28,7 @@ public class MoveUpAction extends FormWidgetEditAction {
this.setMnemonic('F'); this.setMnemonic('F');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, DEFAULT_MODIFIER));
this.setUpdateBehavior(new MovableUpEnable());
} }
@Override @Override
@ -43,18 +45,8 @@ public class MoveUpAction extends FormWidgetEditAction {
return false; return false;
} }
container.setComponentZOrder(creator, targetIndex); container.setComponentZOrder(creator, targetIndex);
designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED); designer.getEditListenerTable().fireCreatorModified(creator, DesignerEvent.CREATOR_SELECTED);
return true; return true;
} }
@Override
public void update() {
FormDesigner designer = getEditingComponent();
if (designer == null) {
this.setEnabled(false);
return;
}
this.setEnabled(designer.isCurrentComponentMovableUp());
}
} }

20
designer-form/src/com/fr/design/designer/beans/actions/behavior/ComponentEnable.java

@ -0,0 +1,20 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
/**
* 只对控件有效对底层布局form/body无效
* Created by plough on 2018/1/19.
*/
public class ComponentEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(!designer.isRootSelected());
}
}

19
designer-form/src/com/fr/design/designer/beans/actions/behavior/MovableDownEnable.java

@ -0,0 +1,19 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
/**
* Created by plough on 2018/1/19.
*/
public class MovableDownEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(designer.isCurrentComponentMovableDown());
}
}

19
designer-form/src/com/fr/design/designer/beans/actions/behavior/MovableUpEnable.java

@ -0,0 +1,19 @@
package com.fr.design.designer.beans.actions.behavior;
import com.fr.design.designer.beans.actions.FormWidgetEditAction;
import com.fr.design.mainframe.FormDesigner;
/**
* Created by plough on 2018/1/19.
*/
public class MovableUpEnable implements UpdateBehavior<FormWidgetEditAction> {
@Override
public void doUpdate(FormWidgetEditAction action) {
FormDesigner designer = action.getEditingComponent();
if (designer == null) {
action.setEnabled(false);
return;
}
action.setEnabled(designer.isCurrentComponentMovableUp());
}
}

8
designer-form/src/com/fr/design/designer/beans/actions/behavior/UpdateBehavior.java

@ -0,0 +1,8 @@
package com.fr.design.designer.beans.actions.behavior;
/**
* Created by plough on 2018/1/19.
*/
public interface UpdateBehavior<T> {
public void doUpdate(T t);
}

5
designer-form/src/com/fr/design/mainframe/ComponentTree.java

@ -121,6 +121,11 @@ public class ComponentTree extends JTree {
scrollPathToVisible(treepath[0]); scrollPathToVisible(treepath[0]);
} }
@Override
public void paint(Graphics g) {
super.paint(g);
designer.getSelectionModel(); // 否则参数一个一个加会导致参数面板和body结构出问题
}
/** /**
* 刷新 * 刷新

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

@ -8,7 +8,14 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.Painter;
import com.fr.design.designer.beans.actions.*; import com.fr.design.designer.beans.actions.CopyAction;
import com.fr.design.designer.beans.actions.CutAction;
import com.fr.design.designer.beans.actions.FormDeleteAction;
import com.fr.design.designer.beans.actions.MoveDownAction;
import com.fr.design.designer.beans.actions.MoveToBottomAction;
import com.fr.design.designer.beans.actions.MoveToTopAction;
import com.fr.design.designer.beans.actions.MoveUpAction;
import com.fr.design.designer.beans.actions.PasteAction;
import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter;
import com.fr.design.designer.beans.events.CreatorEventListenerTable; import com.fr.design.designer.beans.events.CreatorEventListenerTable;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEditListener;
@ -19,8 +26,16 @@ import com.fr.design.designer.beans.location.RootResizeDirection;
import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.beans.models.StateModel; 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.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
@ -43,18 +58,29 @@ import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import javax.swing.*; import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.TransferHandler;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener; import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
@ -350,11 +376,11 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
parameterArray = null; parameterArray = null;
refreshParameter();
//parameter多的时候,不刷新会出现控件边界交叉 //parameter多的时候,不刷新会出现控件边界交叉
refreshRoot(); refreshRoot();
//不知道为什么添加完参数后控件树只有一个label,这儿刷新一下控件树好了 // 最后刷新"添加参数面板"和控件树
EastRegionContainerPane.getInstance().refreshDownPane(); refreshParameter();
} }
private void addParaPaneTooltips() { private void addParaPaneTooltips() {
@ -679,6 +705,13 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
}); });
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() {
@Override
public void designerOpened() {
setToolbarButtons();
}
});
} }
/** /**
@ -1040,8 +1073,21 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
showAuthorityEditPane(); showAuthorityEditPane();
} }
//先选中再检查 //先选中再检查
setToolbarButtons(paths.length == 1 && tree.getSelectionPath().getParentPath() == null); setToolbarButtons();
}
}
/**
* 是否选中了自适应布局或底层form
*/
public boolean isRootSelected() {
ComponentTree tree = FormHierarchyTreePane.getInstance().getComponentTree();
TreePath[] paths = tree.getSelectionPaths();
if (paths == null) {
return true;
} }
boolean isForm = paths.length == 1 && tree.getSelectionPath().getParentPath() == null;
return isForm || isRoot(getSelectionModel().getSelection().getSelectedCreator());
} }
/** /**
@ -1074,9 +1120,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
protected void setToolbarButtons(boolean flag) { protected void setToolbarButtons() {
//自适应布局和底层都不能删除 //自适应布局和底层都不能删除
DesignerContext.getDesignerFrame().checkCombineUp(!(isRoot(getSelectionModel().getSelection().getSelectedCreator()) || flag), NAME_ARRAY_LIST); DesignerContext.getDesignerFrame().checkCombineUp(!isRootSelected(), NAME_ARRAY_LIST);
} }
private void invalidateLayout() { private void invalidateLayout() {

5
designer-form/src/com/fr/design/mainframe/JForm.java

@ -259,15 +259,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
private XComponent lastAffectedCreator; private XComponent lastAffectedCreator;
@Override @Override
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(DesignerEvent evt) {
if (formDesign.getArea() == null || !formDesign.getArea().isValid()) {
return;
}
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) {
setPropertyPaneChange(formDesign.getRootComponent()); setPropertyPaneChange(formDesign.getRootComponent());
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED) { } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED) {
// 在 delete 之前,会先 select 父组件。这里直接传入 lastAffectedCreator 就好了 // 在 delete 之前,会先 select 父组件。这里直接传入 lastAffectedCreator 就好了
setPropertyPaneChange(lastAffectedCreator); setPropertyPaneChange(lastAffectedCreator);
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED) { } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
lastAffectedCreator = evt.getAffectedCreator(); lastAffectedCreator = evt.getAffectedCreator();
setPropertyPaneChange(lastAffectedCreator); setPropertyPaneChange(lastAffectedCreator);
} }

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

@ -113,7 +113,7 @@ public class ParameterPropertyPane extends JPanel{
} }
public void setAddParaPaneVisible(boolean isVisible, JTemplate jt) { public void setAddParaPaneVisible(boolean isVisible, JTemplate jt) {
if (isVisible == addParaPane.isVisible() || formHierarchyTreePaneWrapper == null) { if (formHierarchyTreePaneWrapper == null) {
return; return;
} }
// 表单中,只有添加并选中参数面板时,才显示 // 表单中,只有添加并选中参数面板时,才显示
@ -129,7 +129,9 @@ public class ParameterPropertyPane extends JPanel{
this.setPreferredSize(null); this.setPreferredSize(null);
} else { } else {
addParaPane.setVisible(false); addParaPane.setVisible(false);
this.setPreferredSize(new Dimension(getWidth(), formHierarchyTreePaneWrapper.getPreferredSize().height + UIConstants.GAP_NORMAL)); if (formHierarchyTreePaneWrapper.getPreferredSize().height > 0) {
this.setPreferredSize(new Dimension(getWidth(), formHierarchyTreePaneWrapper.getPreferredSize().height + UIConstants.GAP_NORMAL));
}
} }
} }

Loading…
Cancel
Save