Browse Source

Pull request #13744: REPORT-116390【NewUI】搜索面板自动聚焦输入

Merge in DESIGN/design from ~VITO/c-design:newui to newui

* commit '08a14918835ebf4660dab90636b2b69739b8c167':
  REPORT-116390【NewUI】搜索面板自动聚焦输入
newui
vito-刘恒霖 9 months ago
parent
commit
c5b15e0f20
  1. 6
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/FineSearchPane.java
  2. 1
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TreeSearchToolbarPane.java
  3. 1
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateTreeSearchToolbarPane.java
  4. 9
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  5. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  6. 13
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java

6
designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/FineSearchPane.java

@ -147,4 +147,10 @@ public class FineSearchPane extends JPanel implements HoverAware {
searchTextField.setEnabled(enabled); searchTextField.setEnabled(enabled);
clearButton.setEnabled(enabled); clearButton.setEnabled(enabled);
} }
@Override
public void requestFocus() {
super.requestFocus();
searchTextField.requestFocus();
}
} }

1
designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TreeSearchToolbarPane.java

@ -149,6 +149,7 @@ public class TreeSearchToolbarPane extends JPanel implements TreeSearchStatusCha
switchPane(TOOLBAR_PANE); switchPane(TOOLBAR_PANE);
} else { } else {
switchPane(SEARCH_PANE); switchPane(SEARCH_PANE);
searchPane.requestFocus();
} }
} }
} }

1
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateTreeSearchToolbarPane.java

@ -156,6 +156,7 @@ public class TemplateTreeSearchToolbarPane extends JPanel implements TreeSearchS
switchPane(TOOLBAR_PANE); switchPane(TOOLBAR_PANE);
} else { } else {
switchPane(SEARCH_PANE); switchPane(SEARCH_PANE);
searchPane.requestFocus();
} }
} }

9
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -54,6 +54,15 @@ public class AlphaFineHelper {
} }
} }
/**
* 隐藏搜索面板
*/
public static void hideAlphaFineDialog() {
if (alphaFineDialog != null && alphaFineDialog.isVisible()) {
alphaFineDialog.setVisible(false);
}
}
/** /**
* 弹出alphafine搜索面板 * 弹出alphafine搜索面板
*/ */

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -161,9 +161,15 @@ public class AlphaFineDialog extends UIDialog {
return event -> { return event -> {
if (event instanceof KeyEvent) { if (event instanceof KeyEvent) {
KeyEvent e = (KeyEvent) event; KeyEvent e = (KeyEvent) event;
if (KeyEvent.VK_ESCAPE == e.getKeyCode() && AlphaFinePane.getAlphaFinePane().isVisible()) {
AlphaFineHelper.hideAlphaFineDialog();
return;
}
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e); KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e);
KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore(); KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore();
if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFineConfigManager.isALPHALicAvailable() && AlphaFinePane.getAlphaFinePane().isVisible()) { if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString())
&& AlphaFineConfigManager.isALPHALicAvailable()
&& AlphaFinePane.getAlphaFinePane().isVisible()) {
doClickAction(); doClickAction();
} }

13
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineFrame.java

@ -411,7 +411,7 @@ public class AlphaFineFrame extends JFrame {
/** /**
* showPane,内容展示区分为三个小区tab区label区内容区 * showPane,内容展示区分为三个小区tab区label区内容区
* */ */
private JPanel createShowPane() { private JPanel createShowPane() {
JPanel showPane = new JPanel(new BorderLayout()); JPanel showPane = new JPanel(new BorderLayout());
@ -439,7 +439,7 @@ public class AlphaFineFrame extends JFrame {
// 一键已读 // 一键已读
readLabel = new UILabel(ONE_CLICK_READ); readLabel = new UILabel(ONE_CLICK_READ);
readLabel.setHorizontalAlignment(SwingConstants.RIGHT); readLabel.setHorizontalAlignment(SwingConstants.RIGHT);
readLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));; readLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
readLabel.setPreferredSize(new Dimension(100, 30)); readLabel.setPreferredSize(new Dimension(100, 30));
readLabel.setForeground(UIConstants.FLESH_BLUE); readLabel.setForeground(UIConstants.FLESH_BLUE);
readLabel.addMouseListener(new MouseAdapter() { readLabel.addMouseListener(new MouseAdapter() {
@ -624,7 +624,7 @@ public class AlphaFineFrame extends JFrame {
/** /**
* 根据用户自定义的顺序排序 * 根据用户自定义的顺序排序
* */ */
private void sortList(List<SelectedLabel> list) { private void sortList(List<SelectedLabel> list) {
AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager(); AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
String[] tabOrder = alphaFineConfigManager.getTabOrder(); String[] tabOrder = alphaFineConfigManager.getTabOrder();
@ -786,7 +786,7 @@ public class AlphaFineFrame extends JFrame {
/** /**
* 控制搜索tip框弹出收起 * 控制搜索tip框弹出收起
* 不断地刷新tab页并防止tab页显示错误 * 不断地刷新tab页并防止tab页显示错误
* */ */
private void startSearchTextFieldTimer() { private void startSearchTextFieldTimer() {
Timer timer = new Timer(TIMER_DELAY, e -> { Timer timer = new Timer(TIMER_DELAY, e -> {
// 坑 isShowing返回false 即使textField有内容 getText返回的也是空 // 坑 isShowing返回false 即使textField有内容 getText返回的也是空
@ -908,7 +908,6 @@ public class AlphaFineFrame extends JFrame {
/** /**
* 仅搜索依赖网络的搜索项 * 仅搜索依赖网络的搜索项
*
*/ */
private void reSearch() { private void reSearch() {
String text = preProcessSearchText(this.searchTextField.getText().toLowerCase()); String text = preProcessSearchText(this.searchTextField.getText().toLowerCase());
@ -925,7 +924,7 @@ public class AlphaFineFrame extends JFrame {
/** /**
* 所有tab页搜索通用的加载panel * 所有tab页搜索通用的加载panel
* */ */
private void initSearchLoadingPane() { private void initSearchLoadingPane() {
if (searchLoadingPane == null) { if (searchLoadingPane == null) {
searchLoadingPane = new SearchLoadingPane(); searchLoadingPane = new SearchLoadingPane();
@ -1008,6 +1007,8 @@ public class AlphaFineFrame extends JFrame {
QuestionWindow.getInstance().setVisible(!b); QuestionWindow.getInstance().setVisible(!b);
if (!b) { if (!b) {
AlphaFineHelper.resetAlphaFineDialog(); AlphaFineHelper.resetAlphaFineDialog();
} else {
searchTextField.requestFocus();
} }
} }

Loading…
Cancel
Save