|
|
|
@ -18,12 +18,12 @@ import com.fr.design.menu.ShortCut;
|
|
|
|
|
import com.fr.design.menu.ToolBarDef; |
|
|
|
|
import com.fr.design.parameter.HierarchyTreePane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.Action; |
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.Icon; |
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
@ -92,7 +92,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
|
|
|
|
|
public void refreshDockingView() { |
|
|
|
|
FormDesigner formDesigner = this.getEditingFormDesigner(); |
|
|
|
|
removeAll(); |
|
|
|
|
if(this.componentTree != null) { |
|
|
|
|
if (this.componentTree != null) { |
|
|
|
|
this.componentTree.removeAll(); |
|
|
|
|
} |
|
|
|
|
if (formDesigner == null) { |
|
|
|
@ -103,15 +103,20 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
|
|
|
|
|
formDesigner.addDesignerEditListener(new DesignerEditListener() { |
|
|
|
|
@Override |
|
|
|
|
public void fireCreatorModified(DesignerEvent evt) { |
|
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
refreshComponentTree(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
ComponentTreeModel treeModel = (ComponentTreeModel) componentTree.getModel(); |
|
|
|
|
XCreator root = (XCreator)treeModel.getRoot(); |
|
|
|
|
XCreator root = (XCreator) treeModel.getRoot(); |
|
|
|
|
int childCount = treeModel.getChildCount(root); |
|
|
|
|
//按照节点添加para在下的,但这里需要para节点在上,调整一下位置
|
|
|
|
|
if(childCount == NODE_LENGTH){ |
|
|
|
|
if (childCount == NODE_LENGTH) { |
|
|
|
|
adjustPosition(treeModel, formDesigner); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -142,7 +147,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
|
|
|
|
|
|
|
|
|
|
private JPanel getToolBarPane() { |
|
|
|
|
UIToolbar toolBar = ToolBarDef.createJToolBar(); |
|
|
|
|
toolBar.setUI(new UIToolBarUI(){ |
|
|
|
|
toolBar.setUI(new UIToolBarUI() { |
|
|
|
|
@Override |
|
|
|
|
public void paint(Graphics g, JComponent c) { |
|
|
|
|
Graphics2D g2 = (Graphics2D) g; |
|
|
|
@ -171,7 +176,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
|
|
|
|
|
FormDesigner designer = getEditingFormDesigner(); |
|
|
|
|
|
|
|
|
|
for (Action action : designer.getActions()) { |
|
|
|
|
shortCutList.add(new WidgetEnableShortCut((UndoableAction)action)); |
|
|
|
|
shortCutList.add(new WidgetEnableShortCut((UndoableAction) action)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return shortCutList.toArray(new ShortCut4JControlPane[shortCutList.size()]); |
|
|
|
@ -183,10 +188,10 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
|
|
|
|
|
* @param treeModel |
|
|
|
|
* @param formDesigner |
|
|
|
|
*/ |
|
|
|
|
private void adjustPosition(ComponentTreeModel treeModel,FormDesigner formDesigner){ |
|
|
|
|
XCreator root = (XCreator)treeModel.getRoot(); |
|
|
|
|
XCreator firstChild = (XCreator)treeModel.getChild(root,PARA); |
|
|
|
|
if(firstChild.acceptType(XWParameterLayout.class)){ |
|
|
|
|
private void adjustPosition(ComponentTreeModel treeModel, FormDesigner formDesigner) { |
|
|
|
|
XCreator root = (XCreator) treeModel.getRoot(); |
|
|
|
|
XCreator firstChild = (XCreator) treeModel.getChild(root, PARA); |
|
|
|
|
if (firstChild.acceptType(XWParameterLayout.class)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 绝对布局作为body的时候
|
|
|
|
@ -195,9 +200,9 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
|
|
|
|
|
else if (firstChild.acceptType(XWAbsoluteBodyLayout.class) && firstChild.getBackupParent() != null) { |
|
|
|
|
firstChild = firstChild.getBackupParent(); |
|
|
|
|
} |
|
|
|
|
root.add(firstChild,BODY); |
|
|
|
|
root.add(firstChild, BODY); |
|
|
|
|
treeModel.setRoot(root); |
|
|
|
|
componentTree = new ComponentTree(formDesigner,treeModel); |
|
|
|
|
componentTree = new ComponentTree(formDesigner, treeModel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|