|
|
@ -5,6 +5,8 @@ import com.fr.design.DesignModelAdapter; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.data.datapane.TableDataTreePane; |
|
|
|
import com.fr.design.data.datapane.TableDataTreePane; |
|
|
|
import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; |
|
|
|
import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; |
|
|
|
|
|
|
|
import com.fr.design.data.datapane.management.search.event.TreeSearchStatusChangeEvent; |
|
|
|
|
|
|
|
import com.fr.design.data.datapane.management.search.event.TreeSearchStatusChangeListener; |
|
|
|
import com.fr.design.data.datapane.management.search.searcher.TreeSearchStatus; |
|
|
|
import com.fr.design.data.datapane.management.search.searcher.TreeSearchStatus; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
@ -32,7 +34,7 @@ import java.awt.event.MouseEvent; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author Yvan |
|
|
|
* @author Yvan |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class TreeSearchToolbarPane extends Panel { |
|
|
|
public class TreeSearchToolbarPane extends Panel implements TreeSearchStatusChangeListener { |
|
|
|
|
|
|
|
|
|
|
|
public static final String TOOLBAR_PANE = "toolbarPane"; |
|
|
|
public static final String TOOLBAR_PANE = "toolbarPane"; |
|
|
|
|
|
|
|
|
|
|
@ -85,6 +87,7 @@ public class TreeSearchToolbarPane extends Panel { |
|
|
|
initContentPane(); |
|
|
|
initContentPane(); |
|
|
|
add(contentPane, BorderLayout.CENTER); |
|
|
|
add(contentPane, BorderLayout.CENTER); |
|
|
|
setPreferredSize(new Dimension(240, 30)); |
|
|
|
setPreferredSize(new Dimension(240, 30)); |
|
|
|
|
|
|
|
TableDataTreeSearchManager.getInstance().registerTreeSearchStatusChangeListener(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initContentPane() { |
|
|
|
private void initContentPane() { |
|
|
@ -147,7 +150,7 @@ public class TreeSearchToolbarPane extends Panel { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
searchTextField.setText(StringUtils.EMPTY); |
|
|
|
searchTextField.setText(StringUtils.EMPTY); |
|
|
|
TableDataTreeSearchManager.getInstance().switchBackToolBar(); |
|
|
|
TableDataTreeSearchManager.getInstance().outOfSearchMode(); |
|
|
|
switchPane(TOOLBAR_PANE); |
|
|
|
switchPane(TOOLBAR_PANE); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -158,12 +161,10 @@ public class TreeSearchToolbarPane extends Panel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void dealWithTextChange() { |
|
|
|
private void dealWithTextChange() { |
|
|
|
// 判断搜索是否正在进行
|
|
|
|
if (StringUtils.isEmpty(searchTextField.getText()) && TableDataTreeSearchManager.getInstance().isInSearchMode()) { |
|
|
|
if (StringUtils.isEmpty(searchTextField.getText()) && TableDataTreeSearchManager.getInstance().getTreeSearchStatus() != TreeSearchStatus.SEARCH_NOT_BEGIN) { |
|
|
|
// 如果是搜索模式下,看作是用户删除输入框文字,仅复原TableDataTreePane
|
|
|
|
TableDataTreeSearchManager.getInstance().setTreeSearchStatus(TreeSearchStatus.SEARCH_NOT_BEGIN); |
|
|
|
TableDataTreeSearchManager.getInstance().restoreTreePane(); |
|
|
|
DesignModelAdapter<?, ?> currentModelAdapter = DesignModelAdapter.getCurrentModelAdapter(); |
|
|
|
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView(); |
|
|
|
TableDataTreePane tableDataTreePane = (TableDataTreePane) TableDataTreePane.getInstance(currentModelAdapter); |
|
|
|
|
|
|
|
tableDataTreePane.refreshDockingView(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -189,4 +190,15 @@ public class TreeSearchToolbarPane extends Panel { |
|
|
|
public void setPlaceHolder(String placeHolder) { |
|
|
|
public void setPlaceHolder(String placeHolder) { |
|
|
|
this.searchTextField.setPlaceholder(placeHolder); |
|
|
|
this.searchTextField.setPlaceholder(placeHolder); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据搜索状态变化,来调整自身面板的显示 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param event |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void updateTreeSearchChange(TreeSearchStatusChangeEvent event) { |
|
|
|
|
|
|
|
TreeSearchStatus treeSearchStatus = event.getTreeSearchStatus(); |
|
|
|
|
|
|
|
switchPane(treeSearchStatus == TreeSearchStatus.NOT_IN_SEARCH_MODE ? TOOLBAR_PANE : SEARCH_PANE); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|