kerry 7 years ago
parent
commit
1cf80b2507
  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());
}
/**
* 恢复正常状态
*/
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);
this.needMore = needMore;
this.contentType = type;
setLoading(true);
}
public MoreModel(String name) {
super(name, null, CellType.MORE);
this.needMore = false;
this(name, true);
}
public MoreModel(String name, boolean isLoading) {
@ -51,6 +51,11 @@ public class MoreModel extends AlphaCellModel {
}
@Override
public void resetState() {
setLoading(false);
}
public boolean 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.
*/
public class TitleCellRender implements ListCellRenderer<Object> {
private static final int LOAD_OFFSET = 28;
@Override
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));
titleLabel.setText(moreModel.getName());
titleLabel.setFont(AlphaFineConstants.SMALL_FONT);
titleLabel.setForeground(AlphaFineConstants.DARK_GRAY);
showMoreLabel.setFont(AlphaFineConstants.SMALL_FONT);
showMoreLabel.setText(moreModel.getContent());
titleLabel.setForeground(AlphaFineConstants.DARK_GRAY);
showMoreLabel.setForeground(AlphaFineConstants.DARK_GRAY);
panel.add(titleLabel, BorderLayout.WEST);
if (moreModel.isNeedMore()) {
@ -33,11 +34,12 @@ public class TitleCellRender implements ListCellRenderer<Object> {
panel.add(showMoreLabel, BorderLayout.EAST);
}
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的加载动画
imageIcon.setImageObserver(list);
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));
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.PluginModel;
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.model.SearchResult;
import com.fr.design.mainframe.alphafine.preview.ActionPreviewPane;
@ -144,21 +143,18 @@ public class AlphaFineDialog extends UIDialog {
super.paintComponent(g);
}
};
closeButton.setContentAreaFilled(false);
closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE);
closeButton.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png")));
closeButton.set4ToolbarButton();
closeButton.setBorderPainted(false);
closeButton.setRolloverEnabled(false);
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
UILabel borderLabel = new UILabel();
borderLabel.setBackground(AlphaFineConstants.GRAY);
borderLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1));
topPane.add(closeButton, BorderLayout.EAST);
topPane.add(borderLabel, BorderLayout.SOUTH);
add(topPane, BorderLayout.CENTER);
searchTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
@ -184,7 +180,7 @@ public class AlphaFineDialog extends UIDialog {
*/
private void initProperties() {
setUndecorated(true);
addComponentListener(new ComponentHandler());
//addComponentListener(new ComponentHandler());
setSize(AlphaFineConstants.FIELD_SIZE);
centerWindow(this);
@ -306,6 +302,10 @@ public class AlphaFineDialog extends UIDialog {
searchResultPane.add(leftSearchResultPane, BorderLayout.WEST);
rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT));
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);
setSize(AlphaFineConstants.FULL_SIZE);
}
@ -324,10 +324,24 @@ public class AlphaFineDialog extends UIDialog {
rebuildList(searchTextField.getText().toLowerCase());
return null;
}
@Override
protected void done() {
if (!isCancelled()) {
fireStopLoading();
}
}
};
this.searchWorker.execute();
}
/**
* 停止加载状态
*/
private void fireStopLoading() {
searchListModel.resetState();
}
/**
* 重新构建搜索结果列表
* 先根据输入判断是不是隐藏的搜索功能
@ -370,8 +384,8 @@ public class AlphaFineDialog extends UIDialog {
searchListModel.removeAllElements();
searchListModel.resetSelectedState();
rightSearchResultPane.removeAll();
rightSearchResultPane.validate();
rightSearchResultPane.repaint();
validate();
repaint();
}
/**
@ -978,7 +992,7 @@ public class AlphaFineDialog extends UIDialog {
public AlphaCellModel remove(int index) {
AlphaCellModel object = myDelegate.get(index);
myDelegate.remove(object);
fireIntervalRemoved(this, index, index);
fireContentsChanged(this, index, index);
return object;
}
@ -1006,6 +1020,12 @@ public class AlphaFineDialog extends UIDialog {
private void setValidSelected(boolean 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.
*/
public class ActionSearchManager implements AlphaFineSearchProcessor {
private static final MoreModel TITLE_MODEL = new MoreModel(Inter.getLocText("FR-Designer_Set"));
private static ActionSearchManager actionSearchManager = null;
private SearchResult filterModelList;
private SearchResult lessModelList;
@ -58,7 +57,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Set")));
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainAction()) {
@ -78,7 +77,7 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
}
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) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} 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.
*/
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 SearchResult lessModelList;
private SearchResult moreModelList;
@ -51,7 +50,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult();
moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_COMMUNITY_HELP")));
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainDocument()) {
@ -78,7 +77,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
}
}
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) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
@ -105,7 +104,7 @@ public class DocumentSearchManager implements AlphaFineSearchProcessor {
*/
private SearchResult getNoConnectList() {
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);
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 FRM_PREFIX = "k:frm ";
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 SearchResult filterModelList;
private SearchResult lessModelList;
@ -77,7 +76,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
searchText = searchText.substring(MARK_LENGTH, searchText.length());
}
if (StringUtils.isBlank(searchText) || ComparatorUtils.equals(searchText, DS_NAME)) {
lessModelList.add(TITLE_MODEL);
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Templates")));
return lessModelList;
}
@ -102,7 +101,7 @@ public class FileSearchManager implements AlphaFineSearchProcessor {
}
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) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} 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.
*/
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 SearchResult lessModelList;
private SearchResult moreModelList;
@ -84,7 +83,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
this.lessModelList = new SearchResult();
this.moreModelList = new SearchResult();
if (StringUtils.isBlank(searchText)) {
lessModelList.add(TITLE_MODEL);
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer-Plugin_Addon")));
return lessModelList;
}
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainPlugin()) {
@ -111,7 +110,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
}
}
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) {
lessModelList.add(AlphaFineHelper.NO_RESULT_MODEL);
} else {
@ -134,7 +133,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor {
private SearchResult getNoConnectList() {
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);
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
public SearchResult getLessSearchResult(String searchText) {
public synchronized SearchResult getLessSearchResult(String searchText) {
this.modelList = new SearchResult();
recentModelList = getRecentModelList(searchText);
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);
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() {
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);
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