Browse Source

REPORT-4634 组件叠加体验优化=>1、2 初步框架

master
plough 7 years ago
parent
commit
a98c5002ed
  1. 17
      designer_form/src/com/fr/design/mainframe/ComponentTree.java
  2. 2
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  3. 15
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java

17
designer_form/src/com/fr/design/mainframe/ComponentTree.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.Component; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.DropMode; import javax.swing.DropMode;
@ -12,6 +12,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeCellRenderer;
import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.designer.treeview.ComponentTreeModel;
import com.fr.design.gui.itree.UITreeUI;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
public class ComponentTree extends JTree { public class ComponentTree extends JTree {
@ -31,6 +32,7 @@ public class ComponentTree extends JTree {
this.refreshTreeRoot(); this.refreshTreeRoot();
addTreeSelectionListener(designer); addTreeSelectionListener(designer);
setEditable(true); setEditable(true);
setUI(new UITreeUI());
} }
public FormDesigner getDesigner() { public FormDesigner getDesigner() {
@ -48,7 +50,12 @@ public class ComponentTree extends JTree {
this.setModel(model); this.setModel(model);
} }
public void setSelectionPath(TreePath path) {
// 不管点击哪一项,都要先退出编辑状态(图表、报表块、绝对布局、tab块)
// getSelectionModel().setSelectionPath(path);
designer.stopEditing();
super.setSelectionPath(path);
}
/** /**
@ -58,11 +65,7 @@ public class ComponentTree extends JTree {
*/ */
@Override @Override
public boolean isPathEditable(TreePath path) { public boolean isPathEditable(TreePath path) {
Object object = path.getLastPathComponent(); return false;
if (object == designer.getRootComponent()) {
return false;
}
return super.isPathEditable(path);
} }
/** /**

2
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -1236,6 +1236,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
@Override @Override
public void stopEditing() { public void stopEditing() {
// do nothing // do nothing
editingMouseListener.stopEditing();
// editingMouseListener.processTopLayoutMouseClick()
} }
/** /**

15
designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java

@ -13,6 +13,7 @@ import com.fr.design.designer.beans.actions.FormUndoableAction;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.mainframe.widget.UITreeComboBox; import com.fr.design.mainframe.widget.UITreeComboBox;
@ -43,7 +44,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
private ShortCut4JControlPane[] shorts; private ShortCut4JControlPane[] shorts;
private ComponentTree componentTree; private ComponentTree componentTree;
private UITreeComboBox treeComboBox; // private UITreeComboBox treeComboBox;
private ChangeNameAction changeVarNameAction; private ChangeNameAction changeVarNameAction;
public static FormHierarchyTreePane getInstance() { public static FormHierarchyTreePane getInstance() {
@ -96,9 +97,9 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
if(this.componentTree != null) { if(this.componentTree != null) {
this.componentTree.removeAll(); this.componentTree.removeAll();
} }
if(this.treeComboBox != null) { // if(this.treeComboBox != null) {
this.treeComboBox.removeAll(); // this.treeComboBox.removeAll();
} // }
if (formDesigner == null) { if (formDesigner == null) {
clearDockingView(); clearDockingView();
return; return;
@ -129,8 +130,10 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
headPane.add(getToolBarPane(), BorderLayout.EAST); headPane.add(getToolBarPane(), BorderLayout.EAST);
widgetPane.add(headPane, BorderLayout.CENTER); widgetPane.add(headPane, BorderLayout.CENTER);
treeComboBox = new UITreeComboBox(componentTree); UIScrollPane scrollPane = new UIScrollPane(componentTree);
widgetPane.add(treeComboBox, BorderLayout.SOUTH); scrollPane.setPreferredSize(new Dimension(210, 170));
// treeComboBox = new UITreeComboBox(componentTree);
widgetPane.add(scrollPane, BorderLayout.SOUTH);
return widgetPane; return widgetPane;
} }

Loading…
Cancel
Save