|
|
@ -1,12 +1,14 @@ |
|
|
|
package com.fr.design.mainframe; |
|
|
|
package com.fr.design.mainframe; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.Icon; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.actions.community.NeedAction; |
|
|
|
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.widget.UITreeComboBox; |
|
|
|
import com.fr.design.parameter.HierarchyTreePane; |
|
|
|
import com.fr.design.parameter.HierarchyTreePane; |
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
import com.fr.design.designer.creator.XWParameterLayout; |
|
|
|
import com.fr.design.designer.creator.XWParameterLayout; |
|
|
@ -45,9 +47,11 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree |
|
|
|
public static final int BODY = 1; |
|
|
|
public static final int BODY = 1; |
|
|
|
|
|
|
|
|
|
|
|
private ComponentTree componentTree; |
|
|
|
private ComponentTree componentTree; |
|
|
|
|
|
|
|
private UITreeComboBox treeComboBox; |
|
|
|
|
|
|
|
private JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
|
|
// richer:搜寻树节点的的文本框
|
|
|
|
// richer:搜寻树节点的的文本框
|
|
|
|
private UITextField searchTextField; |
|
|
|
// private UITextField searchTextField;
|
|
|
|
private SearchResultPane searchResult; |
|
|
|
// private SearchResultPane searchResult;
|
|
|
|
|
|
|
|
|
|
|
|
public static FormHierarchyTreePane getInstance() { |
|
|
|
public static FormHierarchyTreePane getInstance() { |
|
|
|
return HOLDER.singleton; |
|
|
|
return HOLDER.singleton; |
|
|
@ -64,7 +68,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private FormHierarchyTreePane() { |
|
|
|
private FormHierarchyTreePane() { |
|
|
|
setLayout(new BorderLayout(0, 6)); |
|
|
|
setLayout(new BorderLayout(0, 0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -86,8 +90,8 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void clearDockingView() { |
|
|
|
public void clearDockingView() { |
|
|
|
this.componentTree = null; |
|
|
|
this.componentTree = null; |
|
|
|
this.searchTextField = null; |
|
|
|
// this.searchTextField = null;
|
|
|
|
this.searchResult = null; |
|
|
|
// this.searchResult = null;
|
|
|
|
add(new JScrollPane(), BorderLayout.CENTER); |
|
|
|
add(new JScrollPane(), BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -109,42 +113,54 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree |
|
|
|
int childCount = treeModel.getChildCount(root); |
|
|
|
int childCount = treeModel.getChildCount(root); |
|
|
|
//按照节点添加para在下的,但这里需要para节点在上,调整一下位置
|
|
|
|
//按照节点添加para在下的,但这里需要para节点在上,调整一下位置
|
|
|
|
if(childCount == NODE_LENGTH){ |
|
|
|
if(childCount == NODE_LENGTH){ |
|
|
|
adjustPosition(treeModel,formDesigner); |
|
|
|
adjustPosition(treeModel, formDesigner); |
|
|
|
} |
|
|
|
|
|
|
|
UIScrollPane scrollPane = new UIScrollPane(componentTree); |
|
|
|
|
|
|
|
scrollPane.setBorder(null); |
|
|
|
|
|
|
|
add(scrollPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
|
|
|
add(searchPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
searchPane.add(new UILabel(Inter.getLocText("FR-Designer_Search") + ":", |
|
|
|
|
|
|
|
SwingConstants.HORIZONTAL), BorderLayout.WEST); |
|
|
|
|
|
|
|
searchTextField = new UITextField(); |
|
|
|
|
|
|
|
searchPane.add(searchTextField, BorderLayout.CENTER); |
|
|
|
|
|
|
|
searchTextField.getDocument().addDocumentListener(new DocumentListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
|
|
|
|
search(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 2, 3, 0)); |
|
|
|
|
|
|
|
add(widgetPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
if(treeComboBox == null) { |
|
|
|
public void removeUpdate(DocumentEvent e) { |
|
|
|
widgetPane.add(new UILabel(Inter.getLocText("FR-Designer-Selected_Widget") + " ", |
|
|
|
search(); |
|
|
|
SwingConstants.HORIZONTAL), BorderLayout.WEST); |
|
|
|
} |
|
|
|
treeComboBox = new UITreeComboBox(componentTree); |
|
|
|
|
|
|
|
widgetPane.add(treeComboBox, BorderLayout.CENTER); |
|
|
|
@Override |
|
|
|
add(widgetPane, BorderLayout.CENTER); |
|
|
|
public void changedUpdate(DocumentEvent e) { |
|
|
|
} |
|
|
|
search(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// UIScrollPane scrollPane = new UIScrollPane(componentTree);
|
|
|
|
private void search() { |
|
|
|
// scrollPane.setBorder(null);
|
|
|
|
String text = searchTextField.getText(); |
|
|
|
// add(scrollPane, BorderLayout.CENTER);
|
|
|
|
if (StringUtils.isEmpty(text)) { |
|
|
|
// JPanel searchPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
|
|
|
|
removeSearchResult(); |
|
|
|
// add(searchPane, BorderLayout.NORTH);
|
|
|
|
} else { |
|
|
|
// searchPane.add(new UILabel(Inter.getLocText("FR-Designer_Search") + ":",
|
|
|
|
populate(componentTree.search(text)); |
|
|
|
// SwingConstants.HORIZONTAL), BorderLayout.WEST);
|
|
|
|
} |
|
|
|
// searchTextField = new UITextField();
|
|
|
|
} |
|
|
|
// searchPane.add(searchTextField, BorderLayout.CENTER);
|
|
|
|
}); |
|
|
|
// searchTextField.getDocument().addDocumentListener(new DocumentListener() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void insertUpdate(DocumentEvent e) {
|
|
|
|
|
|
|
|
// search();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void removeUpdate(DocumentEvent e) {
|
|
|
|
|
|
|
|
// search();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void changedUpdate(DocumentEvent e) {
|
|
|
|
|
|
|
|
// search();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// private void search() {
|
|
|
|
|
|
|
|
// String text = searchTextField.getText();
|
|
|
|
|
|
|
|
// if (StringUtils.isEmpty(text)) {
|
|
|
|
|
|
|
|
// removeSearchResult();
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// populate(componentTree.search(text));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -176,109 +192,109 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除搜索结果 |
|
|
|
* 删除搜索结果 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void removeSearchResult() { |
|
|
|
// public void removeSearchResult() {
|
|
|
|
componentTree.setSelectionPath(null); |
|
|
|
// componentTree.setSelectionPath(null);
|
|
|
|
if (searchResult != null) { |
|
|
|
// if (searchResult != null) {
|
|
|
|
this.remove(searchResult); |
|
|
|
// this.remove(searchResult);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void populate(TreePath[] treepath) { |
|
|
|
// public void populate(TreePath[] treepath) {
|
|
|
|
if (this.searchResult == null) { |
|
|
|
// if (this.searchResult == null) {
|
|
|
|
searchResult = new SearchResultPane(); |
|
|
|
// searchResult = new SearchResultPane();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
if (((BorderLayout) getLayout()).getLayoutComponent(BorderLayout.SOUTH) == null) { |
|
|
|
// if (((BorderLayout) getLayout()).getLayoutComponent(BorderLayout.SOUTH) == null) {
|
|
|
|
add(searchResult, BorderLayout.SOUTH); |
|
|
|
// add(searchResult, BorderLayout.SOUTH);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
searchResult.populate(treepath); |
|
|
|
// searchResult.populate(treepath);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
private class SearchResultPane extends JPanel { |
|
|
|
// private class SearchResultPane extends JPanel {
|
|
|
|
private UILabel resultLabel = new UILabel(); |
|
|
|
// private UILabel resultLabel = new UILabel();
|
|
|
|
private BackAction backAction = new BackAction(); |
|
|
|
// private BackAction backAction = new BackAction();
|
|
|
|
private ForWardAction forwardAction = new ForWardAction(); |
|
|
|
// private ForWardAction forwardAction = new ForWardAction();
|
|
|
|
private TreePath[] tree; |
|
|
|
// private TreePath[] tree;
|
|
|
|
private int number = 0; |
|
|
|
// private int number = 0;
|
|
|
|
|
|
|
|
//
|
|
|
|
SearchResultPane() { |
|
|
|
// SearchResultPane() {
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
// this.setLayout(FRGUIPaneFactory.createBorderLayout());
|
|
|
|
JPanel actionJPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); |
|
|
|
// JPanel actionJPanel = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
|
|
|
|
addButtonToJPanel(actionJPanel, backAction.createToolBarComponent()); |
|
|
|
// addButtonToJPanel(actionJPanel, backAction.createToolBarComponent());
|
|
|
|
addButtonToJPanel(actionJPanel, forwardAction.createToolBarComponent()); |
|
|
|
// addButtonToJPanel(actionJPanel, forwardAction.createToolBarComponent());
|
|
|
|
|
|
|
|
//
|
|
|
|
this.add(actionJPanel, BorderLayout.EAST); |
|
|
|
// this.add(actionJPanel, BorderLayout.EAST);
|
|
|
|
this.add(resultLabel, BorderLayout.WEST); |
|
|
|
// this.add(resultLabel, BorderLayout.WEST);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
private void addButtonToJPanel(JPanel actionLabel, |
|
|
|
// private void addButtonToJPanel(JPanel actionLabel,
|
|
|
|
JComponent toolBarComponent) { |
|
|
|
// JComponent toolBarComponent) {
|
|
|
|
actionLabel.add(toolBarComponent); |
|
|
|
// actionLabel.add(toolBarComponent);
|
|
|
|
if (toolBarComponent instanceof UIButton) { |
|
|
|
// if (toolBarComponent instanceof UIButton) {
|
|
|
|
toolBarComponent.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
|
|
// toolBarComponent.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void populate(TreePath[] search) { |
|
|
|
// public void populate(TreePath[] search) {
|
|
|
|
tree = search; |
|
|
|
// tree = search;
|
|
|
|
resultLabel.setText(Inter.getLocText("FR-Designer_Total") + ":" + tree.length); |
|
|
|
// resultLabel.setText(Inter.getLocText("FR-Designer_Total") + ":" + tree.length);
|
|
|
|
number = 0; |
|
|
|
// number = 0;
|
|
|
|
check(); |
|
|
|
// check();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void next() { |
|
|
|
// public void next() {
|
|
|
|
if (number < tree.length - 1) { |
|
|
|
// if (number < tree.length - 1) {
|
|
|
|
componentTree.setAndScrollSelectionPath(tree[++number]); |
|
|
|
// componentTree.setAndScrollSelectionPath(tree[++number]);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
check(); |
|
|
|
// check();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void last() { |
|
|
|
// public void last() {
|
|
|
|
if (number > 0) { |
|
|
|
// if (number > 0) {
|
|
|
|
componentTree.setAndScrollSelectionPath(tree[--number]); |
|
|
|
// componentTree.setAndScrollSelectionPath(tree[--number]);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
check(); |
|
|
|
// check();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void check() { |
|
|
|
// public void check() {
|
|
|
|
if (tree.length < 1) { |
|
|
|
// if (tree.length < 1) {
|
|
|
|
backAction.setEnabled(false); |
|
|
|
// backAction.setEnabled(false);
|
|
|
|
forwardAction.setEnabled(false); |
|
|
|
// forwardAction.setEnabled(false);
|
|
|
|
} else { |
|
|
|
// } else {
|
|
|
|
backAction.setEnabled(number > 0); |
|
|
|
// backAction.setEnabled(number > 0);
|
|
|
|
forwardAction.setEnabled(number < tree.length - 1); |
|
|
|
// forwardAction.setEnabled(number < tree.length - 1);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
private class BackAction extends UpdateAction { |
|
|
|
// private class BackAction extends UpdateAction {
|
|
|
|
|
|
|
|
//
|
|
|
|
public BackAction() { |
|
|
|
// public BackAction() {
|
|
|
|
this.setName(Inter.getLocText("Form-Hierarchy_Tree_Last")); |
|
|
|
// this.setName(Inter.getLocText("Form-Hierarchy_Tree_Last"));
|
|
|
|
this.setSmallIcon(BaseUtils |
|
|
|
// this.setSmallIcon(BaseUtils
|
|
|
|
.readIcon("com/fr/design/images/m_help/back.png")); |
|
|
|
// .readIcon("com/fr/design/images/m_help/back.png"));
|
|
|
|
this.setEnabled(false); |
|
|
|
// this.setEnabled(false);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
// public void actionPerformed(ActionEvent e) {
|
|
|
|
searchResult.last(); |
|
|
|
// searchResult.last();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
private class ForWardAction extends UpdateAction { |
|
|
|
// private class ForWardAction extends UpdateAction {
|
|
|
|
|
|
|
|
//
|
|
|
|
public ForWardAction() { |
|
|
|
// public ForWardAction() {
|
|
|
|
this.setName(Inter.getLocText("Form-Hierarchy_Tree_Next")); |
|
|
|
// this.setName(Inter.getLocText("Form-Hierarchy_Tree_Next"));
|
|
|
|
this.setSmallIcon(BaseUtils |
|
|
|
// this.setSmallIcon(BaseUtils
|
|
|
|
.readIcon("com/fr/design/images/m_help/forward.png")); |
|
|
|
// .readIcon("com/fr/design/images/m_help/forward.png"));
|
|
|
|
this.setEnabled(false); |
|
|
|
// this.setEnabled(false);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
// public void actionPerformed(ActionEvent e) {
|
|
|
|
searchResult.next(); |
|
|
|
// searchResult.next();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
/** |
|
|
|
/** |
|
|
|