Browse Source

bug fix pmd alphafine

master
XiaXiang 8 years ago
parent
commit
03a6db5813
  1. 7
      designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java
  2. 5
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

7
designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java

@ -14,7 +14,8 @@ import java.awt.*;
* Created by XiaXiang on 2017/4/20.
*/
public class ContentCellRender implements ListCellRenderer<Object> {
private static final int OFFSET = 30;
private static final int LABEL_OFFSET = 45;
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
@ -46,8 +47,8 @@ public class ContentCellRender implements ListCellRenderer<Object> {
detailLabel.setForeground(AlphaFineConstants.LIGHT_GRAY);
panel.add(detailLabel, BorderLayout.CENTER);
int width = (int) (titleLabel.getPreferredSize().getWidth() + detailLabel.getPreferredSize().getWidth());
if ( width > AlphaFineConstants.LEFT_WIDTH - 30) {
int nameWidth = (int) (AlphaFineConstants.LEFT_WIDTH - detailLabel.getPreferredSize().getWidth() - 45);
if ( width > AlphaFineConstants.LEFT_WIDTH - OFFSET) {
int nameWidth = (int) (AlphaFineConstants.LEFT_WIDTH - detailLabel.getPreferredSize().getWidth() - LABEL_OFFSET);
titleLabel.setPreferredSize(new Dimension(nameWidth, AlphaFineConstants.CELL_HEIGHT));
}
}

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

@ -219,12 +219,15 @@ public class AlphaFineDialog extends UIDialog {
*/
private void doSearch(String text) {
if (StringUtils.isBlank(text) || text.equals("AlphaFine") || text.contains("'")) {
if (StringUtils.isBlank(text) || isNeedSearch(text)) {
removeSearchResult();
} else {
showSearchResult();
}
}
boolean isNeedSearch(String text) {
return ComparatorUtils.equals("AlphaFine", text) || text.contains("'");
}
/**

Loading…
Cancel
Save