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. 17
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  5. 10
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  6. 17
      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);
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);
} else {
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);
} else {
switchPane(SEARCH_PANE);
searchPane.requestFocus();
}
}

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

@ -34,16 +34,16 @@ public class AlphaFineHelper {
public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed"));
private static AlphaFineFrame alphaFineDialog;
private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com";
private AlphaFineHelper() {
}
/**
* 根据国际化调整配置
*/
public static void switchConfig4Locale() {
AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (!GeneralContext.isChineseEnv()) {
manager.setSearchOnLine(false);
@ -54,6 +54,15 @@ public class AlphaFineHelper {
}
}
/**
* 隐藏搜索面板
*/
public static void hideAlphaFineDialog() {
if (alphaFineDialog != null && alphaFineDialog.isVisible()) {
alphaFineDialog.setVisible(false);
}
}
/**
* 弹出alphafine搜索面板
*/

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

@ -161,9 +161,15 @@ public class AlphaFineDialog extends UIDialog {
return event -> {
if (event instanceof KeyEvent) {
KeyEvent e = (KeyEvent) event;
if (KeyEvent.VK_ESCAPE == e.getKeyCode() && AlphaFinePane.getAlphaFinePane().isVisible()) {
AlphaFineHelper.hideAlphaFineDialog();
return;
}
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e);
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();
}
@ -637,7 +643,7 @@ public class AlphaFineDialog extends UIDialog {
bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportWorkBookAsImageData(fileName);
} catch (Exception ignored) {
// 兼容下老版本
bytes = new LocalExportOperator().exportWorkBookAsImageData(fileName);
bytes = new LocalExportOperator().exportWorkBookAsImageData(fileName);
}
return TemplateExportOperator.byteDataToImage(bytes);
}

17
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区内容区
* */
*/
private JPanel createShowPane() {
JPanel showPane = new JPanel(new BorderLayout());
@ -439,7 +439,7 @@ public class AlphaFineFrame extends JFrame {
// 一键已读
readLabel = new UILabel(ONE_CLICK_READ);
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.setForeground(UIConstants.FLESH_BLUE);
readLabel.addMouseListener(new MouseAdapter() {
@ -624,7 +624,7 @@ public class AlphaFineFrame extends JFrame {
/**
* 根据用户自定义的顺序排序
* */
*/
private void sortList(List<SelectedLabel> list) {
AlphaFineConfigManager alphaFineConfigManager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
String[] tabOrder = alphaFineConfigManager.getTabOrder();
@ -751,7 +751,7 @@ public class AlphaFineFrame extends JFrame {
return;
}
fireSearch();
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
if (alphaFineToolTipList.getSelectedIndex() == alphaFineToolTipList.getModel().getSize() - 1) {
alphaFineToolTipList.setSelectedIndex(0);
}
@ -786,7 +786,7 @@ public class AlphaFineFrame extends JFrame {
/**
* 控制搜索tip框弹出收起
* 不断地刷新tab页并防止tab页显示错误
* */
*/
private void startSearchTextFieldTimer() {
Timer timer = new Timer(TIMER_DELAY, e -> {
// 坑 isShowing返回false 即使textField有内容 getText返回的也是空
@ -901,14 +901,13 @@ public class AlphaFineFrame extends JFrame {
return new SearchTextBean(getStoreText(searchText), new String[]{getStoreText(searchText)});
} else if (searchText.startsWith(DS_MARK)) {
return new SearchTextBean(getStoreText(searchText), new String[]{DS_NAME + getStoreText(searchText)});
} else {
} else {
return new SearchTextBean(searchText, segmentationResult == null ? new String[]{} : segmentationResult);
}
}
/**
* 仅搜索依赖网络的搜索项
*
*/
private void reSearch() {
String text = preProcessSearchText(this.searchTextField.getText().toLowerCase());
@ -925,7 +924,7 @@ public class AlphaFineFrame extends JFrame {
/**
* 所有tab页搜索通用的加载panel
* */
*/
private void initSearchLoadingPane() {
if (searchLoadingPane == null) {
searchLoadingPane = new SearchLoadingPane();
@ -1008,6 +1007,8 @@ public class AlphaFineFrame extends JFrame {
QuestionWindow.getInstance().setVisible(!b);
if (!b) {
AlphaFineHelper.resetAlphaFineDialog();
} else {
searchTextField.requestFocus();
}
}

Loading…
Cancel
Save