Browse Source

Merge pull request #868 in BA/design from ~XIAOXIA/design:9.0 to 9.0

* commit 'fc3fbcbd37c9f912a76f7a3f599c510908475358':
  rt
  RT
  rt
  rt
  rt
  rt
master
superman 8 years ago
parent
commit
5d9372e4ff
  1. 8
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  2. 6
      designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java
  3. 6
      designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java
  4. 5
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  5. 35
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineTextField.java
  6. 21
      designer/src/com/fr/design/mainframe/alphafine/previewPane/PluginPreviewPane.java
  7. 21
      designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java
  8. 9
      designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java

8
designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java

@ -39,12 +39,20 @@ public class AlphaFineConstants {
public static final Dimension CLOSE_BUTTON_SIZE = new Dimension(40, 40); public static final Dimension CLOSE_BUTTON_SIZE = new Dimension(40, 40);
public static final Color WHITE = new Color(0xf9f9f9);
public static final Color GRAY = new Color(0xd2d2d2); public static final Color GRAY = new Color(0xd2d2d2);
public static final Color LIGHT_GRAY = new Color(0xcccccc);
public static final Color BLUE = new Color(0x3394f0); public static final Color BLUE = new Color(0x3394f0);
public static final Color BLACK = new Color(0x222222); public static final Color BLACK = new Color(0x222222);
public static final Color DARK_GRAY = new Color(0x666666);
public static final Color RED = new Color(0xf46c4c);
public static final Font SMALL_FONT = new Font("Song_TypeFace",0,10); public static final Font SMALL_FONT = new Font("Song_TypeFace",0,10);
public static final Font MEDIUM_FONT = new Font("Song_TypeFace",0,12); public static final Font MEDIUM_FONT = new Font("Song_TypeFace",0,12);

6
designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/ContentCellRender.java

@ -27,7 +27,7 @@ public class ContentCellRender implements ListCellRenderer<Object> {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(Color.white); panel.setBackground(Color.white);
if (isSelected) { if (isSelected) {
panel.setBackground(new Color(0x3394f0)); panel.setBackground(AlphaFineConstants.BLUE);
} }
panel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); panel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0));
AlphaCellModel model = (AlphaCellModel) value; AlphaCellModel model = (AlphaCellModel) value;
@ -35,12 +35,12 @@ public class ContentCellRender implements ListCellRenderer<Object> {
String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getCellType() + ".png"; String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getCellType() + ".png";
name.setIcon(new ImageIcon(getClass().getResource(iconUrl))); name.setIcon(new ImageIcon(getClass().getResource(iconUrl)));
name.setFont(AlphaFineConstants.MEDIUM_FONT); name.setFont(AlphaFineConstants.MEDIUM_FONT);
name.setForeground(new Color(0x222222)); name.setForeground(AlphaFineConstants.BLACK);
name.setVerticalTextPosition(SwingConstants.CENTER); name.setVerticalTextPosition(SwingConstants.CENTER);
name.setHorizontalTextPosition(SwingConstants.RIGHT); name.setHorizontalTextPosition(SwingConstants.RIGHT);
if (model.getDescription() != null) { if (model.getDescription() != null) {
content.setText("-" + model.getDescription()); content.setText("-" + model.getDescription());
content.setForeground(new Color(0xcccccc)); content.setForeground(AlphaFineConstants.LIGHT_GRAY);
panel.add(content, BorderLayout.CENTER); panel.add(content, BorderLayout.CENTER);
} }
panel.add(name, BorderLayout.WEST); panel.add(name, BorderLayout.WEST);

6
designer/src/com/fr/design/mainframe/alphafine/cell/cellRender/TitleCellRender.java

@ -21,14 +21,14 @@ public class TitleCellRender implements ListCellRenderer<Object> {
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
MoreModel moreModel = (MoreModel)value; MoreModel moreModel = (MoreModel)value;
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(new Color(0xf9f9f9)); panel.setBackground(AlphaFineConstants.WHITE);
panel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); panel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0));
name.setText(moreModel.getName()); name.setText(moreModel.getName());
name.setFont(AlphaFineConstants.SMALL_FONT); name.setFont(AlphaFineConstants.SMALL_FONT);
more.setFont(AlphaFineConstants.SMALL_FONT); more.setFont(AlphaFineConstants.SMALL_FONT);
more.setText(moreModel.getContent()); more.setText(moreModel.getContent());
name.setForeground(new Color(0x666666)); name.setForeground(AlphaFineConstants.DARK_GRAY);
more.setForeground(new Color(0x666666)); more.setForeground(AlphaFineConstants.DARK_GRAY);
panel.add(name, BorderLayout.WEST); panel.add(name, BorderLayout.WEST);
if (moreModel.isNeedMore()) { if (moreModel.isNeedMore()) {
this.more.setBorder(BorderFactory.createEmptyBorder(0,0,0,10)); this.more.setBorder(BorderFactory.createEmptyBorder(0,0,0,10));

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);

35
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,24 @@ public class AlphaTextField extends UITextField {
this.image = image; this.image = image;
} }
/**
* 添加键盘监听器
* @param component
*/
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);
}
}
}
});
}
} }

21
designer/src/com/fr/design/mainframe/alphafine/previewPane/PluginPreviewPane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine.previewPane; package com.fr.design.mainframe.alphafine.previewPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -26,7 +27,7 @@ public class PluginPreviewPane extends JPanel {
nameLabel.setHorizontalAlignment(SwingConstants.CENTER); nameLabel.setHorizontalAlignment(SwingConstants.CENTER);
JPanel line = new JPanel(); JPanel line = new JPanel();
line.setPreferredSize(new Dimension(200,1)); line.setPreferredSize(new Dimension(200,1));
line.setBackground(new Color(0xd2d2d2)); line.setBackground(AlphaFineConstants.GRAY);
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(Color.white); panel.setBackground(Color.white);
JPanel bottomPane = new JPanel(new BorderLayout()); JPanel bottomPane = new JPanel(new BorderLayout());
@ -36,26 +37,26 @@ public class PluginPreviewPane extends JPanel {
UILabel versionLabel = new UILabel("V" + version); UILabel versionLabel = new UILabel("V" + version);
versionLabel.setHorizontalAlignment(SwingConstants.CENTER); versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
versionLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); versionLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
versionLabel.setForeground(new Color(0x666666)); versionLabel.setForeground(AlphaFineConstants.DARK_GRAY);
versionLabel.setFont(new Font("Song_TypeFace",0,12)); versionLabel.setFont(AlphaFineConstants.MEDIUM_FONT);
panel.add(versionLabel, BorderLayout.CENTER); panel.add(versionLabel, BorderLayout.CENTER);
UILabel jartimeLabel = new UILabel(jartime.substring(0, 10)); UILabel jartimeLabel = new UILabel(jartime.substring(0, 10));
jartimeLabel.setForeground(new Color(0x222222)); jartimeLabel.setForeground(AlphaFineConstants.BLACK);
jartimeLabel.setFont(new Font("Song_TypeFace",0,12)); jartimeLabel.setFont(AlphaFineConstants.MEDIUM_FONT);
bottomPane.add(jartimeLabel, BorderLayout.EAST); bottomPane.add(jartimeLabel, BorderLayout.EAST);
} }
nameLabel.setFont(new Font("Song_TypeFace",0,18)); nameLabel.setFont(AlphaFineConstants.LARGE_FONT);
nameLabel.setBackground(new Color(0x3394f0)); nameLabel.setBackground(AlphaFineConstants.BLUE);
nameLabel.setBorder(BorderFactory.createEmptyBorder(20,20,10,20)); nameLabel.setBorder(BorderFactory.createEmptyBorder(20,20,10,20));
line.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0)); line.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0));
String price0 = price == 0 ? Inter.getLocText("FR-Designer-Collect_Information_free") : String.valueOf(price); String price0 = price == 0 ? Inter.getLocText("FR-Designer-Collect_Information_free") : String.valueOf(price);
UILabel priceLabel = new UILabel(price0); UILabel priceLabel = new UILabel(price0);
priceLabel.setForeground(new Color(0xf46c4c)); priceLabel.setForeground(AlphaFineConstants.RED);
priceLabel.setFont(new Font("Song_TypeFace",0,10)); priceLabel.setFont(AlphaFineConstants.SMALL_FONT);
bottomPane.add(priceLabel, BorderLayout.WEST); bottomPane.add(priceLabel, BorderLayout.WEST);
panel.add(nameLabel, BorderLayout.NORTH); panel.add(nameLabel, BorderLayout.NORTH);
panel.add(line, BorderLayout.SOUTH); panel.add(line, BorderLayout.SOUTH);
nameLabel.setForeground(new Color(0x3394f0)); nameLabel.setForeground(AlphaFineConstants.BLUE);
add(imageLabel, BorderLayout.NORTH); add(imageLabel, BorderLayout.NORTH);
add(panel, BorderLayout.CENTER); add(panel, BorderLayout.CENTER);
add(bottomPane, BorderLayout.SOUTH); add(bottomPane, BorderLayout.SOUTH);

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

@ -1,6 +1,7 @@
package com.fr.design.actions.help.AlphaFine; package com.fr.design.actions.help.AlphaFine;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
@ -11,6 +12,7 @@ import javax.swing.*;
* Created by XiaXiang on 2017/4/5. * Created by XiaXiang on 2017/4/5.
*/ */
public class AlphafineConfigManager implements XMLable { public class AlphafineConfigManager implements XMLable {
/** /**
* 是否开启alphafine * 是否开启alphafine
*/ */
@ -19,12 +21,12 @@ public class AlphafineConfigManager implements XMLable {
/** /**
* 是否联网搜索 * 是否联网搜索
*/ */
private boolean isSearchOnLine; private boolean isSearchOnLine = true;
/** /**
* 快捷键设置 * 快捷键设置
*/ */
private String shortcuts = "meta + F"; private String shortcuts;
/** /**
* 搜索范围 * 搜索范围
@ -43,7 +45,7 @@ public class AlphafineConfigManager implements XMLable {
/** /**
* 帮助文档 * 帮助文档
*/ */
private boolean isContainDocument; private boolean isContainDocument = true;
/** /**
* 模板 * 模板
@ -58,7 +60,7 @@ public class AlphafineConfigManager implements XMLable {
/** /**
* 应用中心 * 应用中心
*/ */
private boolean isContainPlugin; private boolean isContainPlugin = true;
/** /**
* 快捷键 * 快捷键
@ -122,9 +124,20 @@ public class AlphafineConfigManager implements XMLable {
} }
public String getShortcuts() { public String getShortcuts() {
if (StringUtils.isBlank(shortcuts)) {
return getDefaultShortCuts();
}
return shortcuts; return shortcuts;
} }
/**
* 返回默认快捷键
* @return
*/
private String getDefaultShortCuts() {
return OperatingSystem.isMacOS()? "meta + F" : "ctrl + F";
}
public void setShortcuts(String shortcuts) { public void setShortcuts(String shortcuts) {
this.shortcuts = shortcuts; this.shortcuts = shortcuts;
this.shortCutKeyStore = convert2KeyStroke(this.shortcuts); this.shortCutKeyStore = convert2KeyStroke(this.shortcuts);

9
designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java

@ -45,6 +45,11 @@ public class AlphafineConfigPane extends BasicPane {
private static final String DISPLAY_EQUALS = "+"; private static final String DISPLAY_EQUALS = "+";
private static final String MINUS = "MINUS"; private static final String MINUS = "MINUS";
private static final String DISPLAY_MINUS = "-"; private static final String DISPLAY_MINUS = "-";
private static final String COMMAND = "META";
private static final String SMALL_COMMAND = "meta";
private static final String DISPLAY_COMMAND = "\u2318";
private static final double COLUMN_GAP = 180; private static final double COLUMN_GAP = 180;
private static final double ROW_GAP = 25; private static final double ROW_GAP = 25;
private KeyStroke shortCutKeyStore = null; private KeyStroke shortCutKeyStore = null;
@ -160,7 +165,7 @@ public class AlphafineConfigPane extends BasicPane {
this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.isContainConcludeCheckbox.setSelected(alphafineConfigManager.isContainConclude() && alphafineConfigManager.isSearchOnLine()); this.isContainConcludeCheckbox.setSelected(alphafineConfigManager.isContainConclude() && alphafineConfigManager.isSearchOnLine());
this.isContainConcludeCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainConcludeCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.shortcutsField.setText(alphafineConfigManager.getShortcuts()); this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts()));
shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts()); shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts());
} }
@ -191,7 +196,7 @@ public class AlphafineConfigPane extends BasicPane {
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH)
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET)
.replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) .replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE)
.replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS); .replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND);
} }

Loading…
Cancel
Save