|
|
@ -162,19 +162,15 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static AWTEventListener listener() { |
|
|
|
public static AWTEventListener listener() { |
|
|
|
return new AWTEventListener() { |
|
|
|
return event -> { |
|
|
|
|
|
|
|
if (event instanceof KeyEvent) { |
|
|
|
@Override |
|
|
|
KeyEvent e = (KeyEvent) event; |
|
|
|
public void eventDispatched(AWTEvent event) { |
|
|
|
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e); |
|
|
|
if (event instanceof KeyEvent) { |
|
|
|
KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore(); |
|
|
|
KeyEvent e = (KeyEvent) event; |
|
|
|
if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFineConfigManager.isALPHALicAvailable() && AlphaFinePane.getAlphaFinePane().isVisible()) { |
|
|
|
KeyStroke keyStroke = (KeyStroke) KeyStroke.getAWTKeyStrokeForEvent(e); |
|
|
|
doClickAction(); |
|
|
|
KeyStroke storeKeyStroke = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getShortCutKeyStore(); |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(keyStroke.toString(), storeKeyStroke.toString()) && AlphaFineConfigManager.isALPHALicAvailable() && AlphaFinePane.getAlphaFinePane().isVisible()) { |
|
|
|
|
|
|
|
doClickAction(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
@ -300,7 +296,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
if (winSize.width > screenSize.width) { |
|
|
|
if (winSize.width > screenSize.width) { |
|
|
|
winSize.width = screenSize.width; |
|
|
|
winSize.width = screenSize.width; |
|
|
|
} |
|
|
|
} |
|
|
|
//这里设置位置:水平居中,竖直偏上
|
|
|
|
//这里设置位置:水平居中,竖直偏上
|
|
|
|
win.setLocation((screenSize.width - winSize.width) / 2, (screenSize.height - winSize.height) / AlphaFineConstants.SHOW_SIZE); |
|
|
|
win.setLocation((screenSize.width - winSize.width) / 2, (screenSize.height - winSize.height) / AlphaFineConstants.SHOW_SIZE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -513,7 +509,8 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private String getStoreText(String searchText) { |
|
|
|
private String getStoreText(String searchText) { |
|
|
|
setStoreText(searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1, searchText.length())); |
|
|
|
//这里也需要先做一个去除不需要空格的处理
|
|
|
|
|
|
|
|
setStoreText((searchText.substring(searchText.indexOf(StringUtils.BLANK) + 1)).replaceAll(StringUtils.BLANK, StringUtils.EMPTY)); |
|
|
|
return storeText; |
|
|
|
return storeText; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -616,9 +613,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
rightSearchResultPane.removeAll(); |
|
|
|
rightSearchResultPane.removeAll(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
rightSearchResultPane.add(new FilePreviewPane(get())); |
|
|
|
rightSearchResultPane.add(new FilePreviewPane(get())); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
} catch (InterruptedException | ExecutionException e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} catch (ExecutionException e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
validate(); |
|
|
|
validate(); |
|
|
@ -651,9 +646,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
rightSearchResultPane.add(new FilePreviewPane(get())); |
|
|
|
rightSearchResultPane.add(new FilePreviewPane(get())); |
|
|
|
validate(); |
|
|
|
validate(); |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
} catch (InterruptedException | ExecutionException e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} catch (ExecutionException e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -876,7 +869,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
searchText = searchText.toLowerCase(); |
|
|
|
searchText = searchText.toLowerCase(); |
|
|
|
Pattern p = Pattern.compile(AlphaFineConstants.SPECIAL_CHARACTER_REGEX); |
|
|
|
Pattern p = Pattern.compile(AlphaFineConstants.SPECIAL_CHARACTER_REGEX); |
|
|
|
Matcher m = p.matcher(searchText); |
|
|
|
Matcher m = p.matcher(searchText); |
|
|
|
searchText = m.replaceAll("").trim().replaceAll(" ", ""); |
|
|
|
searchText = m.replaceAll(StringUtils.EMPTY).trim().replaceAll(StringUtils.BLANK, StringUtils.EMPTY); |
|
|
|
if (searchText.length() == 0) { |
|
|
|
if (searchText.length() == 0) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -897,22 +890,19 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
* 当鼠标在搜索界面边界外点击时触发 |
|
|
|
* 当鼠标在搜索界面边界外点击时触发 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void initAWTEventListener() { |
|
|
|
private void initAWTEventListener() { |
|
|
|
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { |
|
|
|
Toolkit.getDefaultToolkit().addAWTEventListener(event -> { |
|
|
|
@Override |
|
|
|
if (!AlphaFineDialog.this.isVisible()) { |
|
|
|
public void eventDispatched(AWTEvent event) { |
|
|
|
return; |
|
|
|
if (!AlphaFineDialog.this.isVisible()) { |
|
|
|
} |
|
|
|
return; |
|
|
|
if (event instanceof MouseEvent) { |
|
|
|
} |
|
|
|
MouseEvent k = (MouseEvent) event; |
|
|
|
if (event instanceof MouseEvent) { |
|
|
|
if (SwingUtilities.isLeftMouseButton(k)) { |
|
|
|
MouseEvent k = (MouseEvent) event; |
|
|
|
Point p = k.getLocationOnScreen(); |
|
|
|
if (SwingUtilities.isLeftMouseButton(k)) { |
|
|
|
Rectangle dialogRectangle = AlphaFineDialog.this.getBounds(); |
|
|
|
Point p = k.getLocationOnScreen(); |
|
|
|
Rectangle paneRectangle = new Rectangle(AlphaFinePane.getAlphaFinePane().getLocationOnScreen(), AlphaFinePane.getAlphaFinePane().getSize()); |
|
|
|
Rectangle dialogRectangle = AlphaFineDialog.this.getBounds(); |
|
|
|
if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !forceOpen) { |
|
|
|
Rectangle paneRectangle = new Rectangle(AlphaFinePane.getAlphaFinePane().getLocationOnScreen(), AlphaFinePane.getAlphaFinePane().getSize()); |
|
|
|
AlphaFineDialog.this.dispose(); |
|
|
|
if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !forceOpen) { |
|
|
|
forceOpen = false; |
|
|
|
AlphaFineDialog.this.dispose(); |
|
|
|
|
|
|
|
forceOpen = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -921,7 +911,7 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void checkValid() throws Exception { |
|
|
|
public void checkValid() throws Exception { |
|
|
|
//不处理
|
|
|
|
//不处理
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -944,14 +934,11 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
if (cellModel instanceof BottomModel) { |
|
|
|
if (cellModel instanceof BottomModel) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
Thread sendThread = new Thread(new Runnable() { |
|
|
|
Thread sendThread = new Thread(() -> { |
|
|
|
@Override |
|
|
|
if (StringUtils.isNotEmpty(storeText)) { |
|
|
|
public void run() { |
|
|
|
RecentSearchManager searchManager = RecentSearchManager.getInstance(); |
|
|
|
if (StringUtils.isNotEmpty(storeText)) { |
|
|
|
searchManager.addModel(storeText, cellModel); |
|
|
|
RecentSearchManager searchManager = RecentSearchManager.getInstance(); |
|
|
|
sendDataToServer(storeText, cellModel); |
|
|
|
searchManager.addModel(storeText, cellModel); |
|
|
|
|
|
|
|
sendDataToServer(storeText, cellModel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
sendThread.start(); |
|
|
|
sendThread.start(); |
|
|
@ -1178,12 +1165,9 @@ public class AlphaFineDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
addListSelectionListener(new ListSelectionListener() { |
|
|
|
addListSelectionListener(e -> { |
|
|
|
@Override |
|
|
|
if (!e.getValueIsAdjusting() && getSelectedValue() != null) { |
|
|
|
public void valueChanged(ListSelectionEvent e) { |
|
|
|
showResult(getSelectedValue()); |
|
|
|
if (!e.getValueIsAdjusting() && getSelectedValue() != null) { |
|
|
|
|
|
|
|
showResult(getSelectedValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|