xiaoxia 8 years ago
parent
commit
c473346c92
  1. 5
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 31
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java
  3. 2
      designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java

5
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -50,7 +50,7 @@ import java.util.concurrent.ExecutionException;
* Created by XiaXiang on 2017/3/21. * Created by XiaXiang on 2017/3/21.
*/ */
public class AlphaFineDialog extends UIDialog { public class AlphaFineDialog extends UIDialog {
private AlphaTextField searchTextField; private AlphaFineTextField searchTextField;
private UIButton closeButton; private UIButton closeButton;
private JPanel searchResultPane; private JPanel searchResultPane;
private Point pressedPoint; private Point pressedPoint;
@ -68,10 +68,11 @@ public class AlphaFineDialog extends UIDialog {
} }
private void initComponents() { private void initComponents() {
searchTextField = new AlphaTextField("AlphaFine"); searchTextField = new AlphaFineTextField("AlphaFine");
searchTextField.setFont(AlphaFineConstants.GREATER_FONT); searchTextField.setFont(AlphaFineConstants.GREATER_FONT);
searchTextField.setBackground(Color.white); searchTextField.setBackground(Color.white);
searchTextField.setBorderPainted(false); searchTextField.setBorderPainted(false);
searchTextField.initKeyListener(this);
JPanel topPane = new JPanel(new BorderLayout()); JPanel topPane = new JPanel(new BorderLayout());
UILabel iconLabel = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png"))); UILabel iconLabel = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png")));
iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE); iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE);

31
designer/src/com/fr/design/mainframe/alphafine/component/AlphaTextField.java → designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java

@ -1,27 +1,30 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils;
import com.fr.report.web.button.Image; import com.fr.report.web.button.Image;
import com.fr.stable.StringUtils;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseAdapter; import java.awt.event.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter; import static java.awt.event.KeyEvent.VK_ESCAPE;
/** /**
* Created by XiaXiang on 2017/3/21. * Created by XiaXiang on 2017/3/21.
*/ */
public class AlphaTextField extends UITextField { public class AlphaFineTextField extends UITextField {
private String placeHolder; private String placeHolder;
private Image image; private Image image;
public AlphaTextField(String placeHolder) { public AlphaFineTextField(String placeHolder) {
this.placeHolder = placeHolder; this.placeHolder = placeHolder;
} }
public AlphaTextField() {
public AlphaFineTextField() {
this.placeHolder = null; this.placeHolder = null;
} }
@ -59,4 +62,20 @@ public class AlphaTextField extends UITextField {
this.image = image; this.image = image;
} }
public void initKeyListener(Component component) {
addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == VK_ESCAPE) {
if (StringUtils.isBlank(getText()) || ComparatorUtils.equals(getText(), placeHolder)) {
component.setVisible(false);
} else {
setText(null);
}
}
}
});
}
} }

2
designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java

@ -24,7 +24,7 @@ public class AlphafineConfigManager implements XMLable {
/** /**
* 快捷键设置 * 快捷键设置
*/ */
private String shortcuts = "meta + F"; private String shortcuts = OperatingSystem.isMacOS()? "meta + F" : "ctr + F";
/** /**
* 搜索范围 * 搜索范围

Loading…
Cancel
Save