Browse Source

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

* commit 'aac41bc58af93470b3a20b4cd04d2f5ef96b9c56':
  设置加载动画
  加载结束后,结束loading动画
  加载动画是,消除文字位移
  支持gif动画,之前改错了
  左侧面板刷新有延迟
  默认选中猜您需要
  先去掉圆角,另外优化了关闭按钮的显示效果
  alphafine 搜索框关闭按钮视觉修改
master
superman 7 years ago
parent
commit
133b31baf0
  1. 7
      designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java
  2. 9
      designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java
  3. 8
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  4. 40
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  5. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/loading.gif
  6. 5
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  7. 7
      designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java
  8. 5
      designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java
  9. 7
      designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java
  10. 4
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  11. 2
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java
  12. 2
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

7
designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java

@ -109,4 +109,11 @@ public abstract class AlphaCellModel implements Comparable {
} }
return this.getName().compareTo(cellModel.getName()); return this.getName().compareTo(cellModel.getName());
} }
/**
* 恢复正常状态
*/
public void resetState() {
}
} }

9
designer/src/com/fr/design/mainframe/alphafine/cell/model/MoreModel.java

@ -16,11 +16,11 @@ public class MoreModel extends AlphaCellModel {
super(name, content, CellType.MORE); super(name, content, CellType.MORE);
this.needMore = needMore; this.needMore = needMore;
this.contentType = type; this.contentType = type;
setLoading(true);
} }
public MoreModel(String name) { public MoreModel(String name) {
super(name, null, CellType.MORE); this(name, true);
this.needMore = false;
} }
public MoreModel(String name, boolean isLoading) { public MoreModel(String name, boolean isLoading) {
@ -51,6 +51,11 @@ public class MoreModel extends AlphaCellModel {
} }
@Override
public void resetState() {
setLoading(false);
}
public boolean isLoading() { public boolean isLoading() {
return isLoading; return isLoading;
} }

8
designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java

@ -12,6 +12,7 @@ import java.awt.*;
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
*/ */
public class TitleCellRender implements ListCellRenderer<Object> { public class TitleCellRender implements ListCellRenderer<Object> {
private static final int LOAD_OFFSET = 28;
@Override @Override
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) {
@ -23,9 +24,9 @@ public class TitleCellRender implements ListCellRenderer<Object> {
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
titleLabel.setText(moreModel.getName()); titleLabel.setText(moreModel.getName());
titleLabel.setFont(AlphaFineConstants.SMALL_FONT); titleLabel.setFont(AlphaFineConstants.SMALL_FONT);
titleLabel.setForeground(AlphaFineConstants.DARK_GRAY);
showMoreLabel.setFont(AlphaFineConstants.SMALL_FONT); showMoreLabel.setFont(AlphaFineConstants.SMALL_FONT);
showMoreLabel.setText(moreModel.getContent()); showMoreLabel.setText(moreModel.getContent());
titleLabel.setForeground(AlphaFineConstants.DARK_GRAY);
showMoreLabel.setForeground(AlphaFineConstants.DARK_GRAY); showMoreLabel.setForeground(AlphaFineConstants.DARK_GRAY);
panel.add(titleLabel, BorderLayout.WEST); panel.add(titleLabel, BorderLayout.WEST);
if (moreModel.isNeedMore()) { if (moreModel.isNeedMore()) {
@ -33,11 +34,12 @@ public class TitleCellRender implements ListCellRenderer<Object> {
panel.add(showMoreLabel, BorderLayout.EAST); panel.add(showMoreLabel, BorderLayout.EAST);
} }
if (moreModel.isLoading()) { if (moreModel.isLoading()) {
ImageIcon imageIcon = (ImageIcon) IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/loading.gif"); ImageIcon imageIcon = new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/loading.gif"));
//设置cell的加载动画 //设置cell的加载动画
imageIcon.setImageObserver(list); imageIcon.setImageObserver(list);
UILabel loadingLabel = new UILabel(imageIcon); UILabel loadingLabel = new UILabel(imageIcon);
panel.add(loadingLabel, BorderLayout.SOUTH); loadingLabel.setBorder(BorderFactory.createEmptyBorder(LOAD_OFFSET,0,0,0));
panel.add(loadingLabel, 0);
} }
panel.setPreferredSize(new Dimension(list.getFixedCellWidth(), AlphaFineConstants.CELL_TITLE_HEIGHT)); panel.setPreferredSize(new Dimension(list.getFixedCellWidth(), AlphaFineConstants.CELL_TITLE_HEIGHT));
return panel; return panel;

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

@ -14,7 +14,6 @@ import com.fr.design.mainframe.alphafine.cell.model.FileModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.PluginModel; import com.fr.design.mainframe.alphafine.cell.model.PluginModel;
import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender;
import com.fr.design.mainframe.alphafine.listener.ComponentHandler;
import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.alphafine.preview.ActionPreviewPane; import com.fr.design.mainframe.alphafine.preview.ActionPreviewPane;
@ -144,21 +143,18 @@ public class AlphaFineDialog extends UIDialog {
super.paintComponent(g); super.paintComponent(g);
} }
}; };
closeButton.setContentAreaFilled(false);
closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE); closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE);
closeButton.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png"))); closeButton.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png")));
closeButton.set4ToolbarButton(); closeButton.set4ToolbarButton();
closeButton.setBorderPainted(false);
closeButton.setRolloverEnabled(false);
closeButton.addActionListener(new ActionListener() { closeButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
dispose(); dispose();
} }
}); });
UILabel borderLabel = new UILabel();
borderLabel.setBackground(AlphaFineConstants.GRAY);
borderLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1));
topPane.add(closeButton, BorderLayout.EAST); topPane.add(closeButton, BorderLayout.EAST);
topPane.add(borderLabel, BorderLayout.SOUTH);
add(topPane, BorderLayout.CENTER); add(topPane, BorderLayout.CENTER);
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() { searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override @Override
@ -184,7 +180,7 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void initProperties() { private void initProperties() {
setUndecorated(true); setUndecorated(true);
addComponentListener(new ComponentHandler()); //addComponentListener(new ComponentHandler());
setSize(AlphaFineConstants.FIELD_SIZE); setSize(AlphaFineConstants.FIELD_SIZE);
centerWindow(this); centerWindow(this);
@ -306,6 +302,10 @@ public class AlphaFineDialog extends UIDialog {
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
searchResultPane.add(rightSearchResultPane, BorderLayout.EAST); searchResultPane.add(rightSearchResultPane, BorderLayout.EAST);
UILabel splitLabel = new UILabel();
splitLabel.setBackground(AlphaFineConstants.GRAY);
splitLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1));
searchResultPane.add(splitLabel, BorderLayout.NORTH);
add(searchResultPane, BorderLayout.SOUTH); add(searchResultPane, BorderLayout.SOUTH);
setSize(AlphaFineConstants.FULL_SIZE); setSize(AlphaFineConstants.FULL_SIZE);
} }
@ -324,10 +324,24 @@ public class AlphaFineDialog extends UIDialog {
rebuildList(searchTextField.getText().toLowerCase()); rebuildList(searchTextField.getText().toLowerCase());
return null; return null;
} }
@Override
protected void done() {
if (!isCancelled()) {
fireStopLoading();
}
}
}; };
this.searchWorker.execute(); this.searchWorker.execute();
} }
/**
* 停止加载状态
*/
private void fireStopLoading() {
searchListModel.resetState();
}
/** /**
* 重新构建搜索结果列表 * 重新构建搜索结果列表
* 先根据输入判断是不是隐藏的搜索功能 * 先根据输入判断是不是隐藏的搜索功能
@ -370,8 +384,8 @@ public class AlphaFineDialog extends UIDialog {
searchListModel.removeAllElements(); searchListModel.removeAllElements();
searchListModel.resetSelectedState(); searchListModel.resetSelectedState();
rightSearchResultPane.removeAll(); rightSearchResultPane.removeAll();
rightSearchResultPane.validate(); validate();
rightSearchResultPane.repaint(); repaint();
} }
/** /**
@ -978,7 +992,7 @@ public class AlphaFineDialog extends UIDialog {
public AlphaCellModel remove(int index) { public AlphaCellModel remove(int index) {
AlphaCellModel object = myDelegate.get(index); AlphaCellModel object = myDelegate.get(index);
myDelegate.remove(object); myDelegate.remove(object);
fireIntervalRemoved(this, index, index); fireContentsChanged(this, index, index);
return object; return object;
} }
@ -1006,6 +1020,12 @@ public class AlphaFineDialog extends UIDialog {
private void setValidSelected(boolean selected) { private void setValidSelected(boolean selected) {
isValidSelected = selected; isValidSelected = selected;
} }
public void resetState() {
for (int i = 0; i< getSize(); i++) {
getElementAt(i).resetState();
}
}
} }
} }

BIN
designer/src/com/fr/design/mainframe/alphafine/images/loading.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

5
designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java

@ -21,7 +21,6 @@ import java.util.List;
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
*/ */
public class ActionSearchManager implements AlphaFineSearchProcessor { public class ActionSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Set"));
private static ActionSearchManager actionSearchManager = null; private static ActionSearchManager actionSearchManager = null;
private SearchResult filterModelList; private SearchResult filterModelList;
private SearchResult lessModelList; private SearchResult lessModelList;
@ -58,7 +57,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) { if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL); lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Set")));
return lessModelList; return lessModelList;
} }
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) {
@ -78,7 +77,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
} }
if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Set")));
if (result.size() == 0) { if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else { } else {

7
designer/src/com/fr/design/mainframe/alphafine/search/manager/DocumentSearchManager.java

@ -19,7 +19,6 @@ import com.fr.stable.StringUtils;
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
*/ */
public class DocumentSearchManager implements AlphaFineSearchProcessor { public class DocumentSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP"));
private static DocumentSearchManager documentSearchManager = null; private static DocumentSearchManager documentSearchManager = null;
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult moreModelList; private SearchResult moreModelList;
@ -51,7 +50,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) { if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL); lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
return lessModelList; return lessModelList;
} }
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
@ -78,7 +77,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
} }
} }
if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
if (searchResult.size() == 0) { if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else { } else {
@ -105,7 +104,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
*/ */
private SearchResult getNoConnectList() { private SearchResult getNoConnectList() {
SearchResult result = new SearchResult(); SearchResult result = new SearchResult();
result.add(0, TITLE_MODEL); result.add(0, new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL); result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result; return result;
} }

5
designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java

@ -31,7 +31,6 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
private static final String DS_NAME = "dsname=\""; private static final String DS_NAME = "dsname=\"";
private static final String FRM_PREFIX = "k:frm "; private static final String FRM_PREFIX = "k:frm ";
private static final String CPT_PREFIX = "k:cpt "; private static final String CPT_PREFIX = "k:cpt ";
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Templates"));
private static FileSearchManager fileSearchManager = null; private static FileSearchManager fileSearchManager = null;
private SearchResult filterModelList; private SearchResult filterModelList;
private SearchResult lessModelList; private SearchResult lessModelList;
@ -77,7 +76,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
searchText = searchText.substring(MARK_LENGTH, searchText.length()); searchText = searchText.substring(MARK_LENGTH, searchText.length());
} }
if (StringUtils.isBlank(searchText) || ComparatorUtils.equals(searchText, DS_NAME)) { if (StringUtils.isBlank(searchText) || ComparatorUtils.equals(searchText, DS_NAME)) {
lessModelList.add(TITLE_MODEL); lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Templates")));
return lessModelList; return lessModelList;
} }
@ -102,7 +101,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
} }
if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) { if (result.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates")));
if (result.size() == 0) { if (result.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else { } else {

7
designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java

@ -23,7 +23,6 @@ import java.net.URLEncoder;
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
*/ */
public class PluginSearchManager implements AlphaFineSearchProcessor { public class PluginSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon"));
private static PluginSearchManager pluginSearchManager = null; private static PluginSearchManager pluginSearchManager = null;
private SearchResult lessModelList; private SearchResult lessModelList;
private SearchResult moreModelList; private SearchResult moreModelList;
@ -84,7 +83,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
this.lessModelList = new SearchResult(); this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult(); this.moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) { if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL); lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
return lessModelList; return lessModelList;
} }
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
@ -111,7 +110,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
} }
} }
if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) { if (searchResult.size() < AlphaFineConstants.SHOW_SIZE + 1) {
lessModelList.add(0, TITLE_MODEL); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
if (searchResult.size() == 0) { if (searchResult.size() == 0) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL); lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else { } else {
@ -134,7 +133,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
private SearchResult getNoConnectList() { private SearchResult getNoConnectList() {
SearchResult result = new SearchResult(); SearchResult result = new SearchResult();
result.add(0, TITLE_MODEL); result.add(0, new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL); result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result; return result;
} }

4
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -272,11 +272,11 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
@Override @Override
public SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
this.modelList = new SearchResult(); this.modelList = new SearchResult();
recentModelList = getRecentModelList(searchText); recentModelList = getRecentModelList(searchText);
if (recentModelList != null && recentModelList.size() > 0) { if (recentModelList != null && recentModelList.size() > 0) {
modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest"), false)); modelList.add(new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Latest")));
} }
modelList.addAll(recentModelList); modelList.addAll(recentModelList);
return modelList; return modelList;

2
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java

@ -93,7 +93,7 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
private SearchResult getNoConnectList() { private SearchResult getNoConnectList() {
SearchResult result = new SearchResult(); SearchResult result = new SearchResult();
result.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend"), false)); result.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Recommend")));
result.add(AlphaFineHelper.NO_CONNECTION_MODEL); result.add(AlphaFineHelper.NO_CONNECTION_MODEL);
return result; return result;
} }

2
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -35,7 +35,7 @@ public class AlphaFineConfigManager implements XMLable {
/** /**
* 猜您需要 * 猜您需要
*/ */
private boolean isContainRecommend; private boolean isContainRecommend = true;
/** /**
* 设置 * 设置

Loading…
Cancel
Save