Browse Source

Merge branch 'release/10.0' of https://cloud.finedevelop.com/scm/~wim.zhai/Xdesign into release/10.0

bugfix/10.0
Wim.Zhai 6 years ago
parent
commit
96e4fed723
  1. 13
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  2. 68
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  3. 2
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java
  4. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java

13
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -26,6 +26,9 @@ import java.util.List;
public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver { public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int TEXT_LENGTH = 3;
private static final int BUTTON_SIZE = 2;
private int currentButtonSize = 0;
protected List<UIToggleButton> labelButtonList; protected List<UIToggleButton> labelButtonList;
protected int selectedIndex = -1; protected int selectedIndex = -1;
private List<T> objectList;// 起到一个render的作用 private List<T> objectList;// 起到一个render的作用
@ -154,6 +157,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (!ArrayUtils.isEmpty(objects) && textArray.length == objects.length) { if (!ArrayUtils.isEmpty(objects) && textArray.length == objects.length) {
this.objectList = Arrays.asList(objects); this.objectList = Arrays.asList(objects);
} }
currentButtonSize = textArray.length;
labelButtonList = new ArrayList<UIToggleButton>(textArray.length); labelButtonList = new ArrayList<UIToggleButton>(textArray.length);
this.setLayout(getGridLayout(textArray.length)); this.setLayout(getGridLayout(textArray.length));
this.setBorder(getGroupBorder()); this.setBorder(getGroupBorder());
@ -214,11 +218,20 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
protected void initButton(UIToggleButton labelButton) { protected void initButton(UIToggleButton labelButton) {
labelButton.setBorderPainted(false); labelButton.setBorderPainted(false);
adjustButton(labelButton);
UIComponentUtils.setLineWrap(labelButton); UIComponentUtils.setLineWrap(labelButton);
labelButtonList.add(labelButton); labelButtonList.add(labelButton);
this.add(labelButton); this.add(labelButton);
} }
private void adjustButton(UIToggleButton labelButton) {
if (labelButton.getText().length() > TEXT_LENGTH && currentButtonSize > BUTTON_SIZE) {
Dimension dimension = labelButton.getPreferredSize();
dimension.height <<= 1;
labelButton.setPreferredSize(dimension);
}
}
protected Border getGroupBorder() { protected Border getGroupBorder() {
return BorderFactory.createEmptyBorder(1, 1, 1, 1); return BorderFactory.createEmptyBorder(1, 1, 1, 1);
} }

68
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -489,21 +489,24 @@ public class AlphaFineDialog extends UIDialog {
* @param searchText * @param searchText
*/ */
private void dealWithSearchText(String searchText) { private void dealWithSearchText(String searchText) {
SearchListModel searchListModelTemp = new SearchListModel(new SearchResult());
searchResultList.setModel(searchListModelTemp);
if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) { if (searchText.startsWith(ACTION_MARK_SHORT) || searchText.startsWith(ACTION_MARK)) {
buildActionList(new String[]{getStoreText(searchText)}); buildActionList(new String[]{getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) { } else if (searchText.startsWith(DOCUMENT_MARK_SHORT) || searchText.startsWith(DOCUMENT_MARK)) {
buildDocumentList(new String[]{getStoreText(searchText)}); buildDocumentList(new String[]{getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) { } else if (searchText.startsWith(FILE_MARK_SHORT) || searchText.startsWith(FILE_MARK)) {
buildFileList(getStoreText(searchText), new String[]{getStoreText(searchText)}); buildFileList(getStoreText(searchText), new String[]{getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) { } else if (searchText.startsWith(CPT_MARK) || searchText.startsWith(FRM_MARK)) {
buildFileList(getStoreText(searchText), new String[]{searchText}); buildFileList(getStoreText(searchText), new String[]{searchText}, searchListModelTemp);
} else if (searchText.startsWith(DS_MARK)) { } else if (searchText.startsWith(DS_MARK)) {
buildFileList(getStoreText(searchText), new String[]{DS_NAME + getStoreText(searchText)}); buildFileList(getStoreText(searchText), new String[]{DS_NAME + getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) { } else if (searchText.startsWith(PLUGIN_MARK_SHORT) || searchText.startsWith(PLUGIN_MARK)) {
buildPluginList(new String[]{getStoreText(searchText)}); buildPluginList(new String[]{getStoreText(searchText)}, searchListModelTemp);
} else if (searchText.startsWith(SIMILAR_MARK)) { } else if (searchText.startsWith(SIMILAR_MARK)) {
buildSimilarList(new String[]{getStoreText(searchText)}); buildSimilarList(new String[]{getStoreText(searchText)}, searchListModelTemp);
} }
searchListModel = searchListModelTemp;
} }
/** /**
@ -535,51 +538,54 @@ public class AlphaFineDialog extends UIDialog {
* @param searchText * @param searchText
*/ */
private void doNormalSearch(String searchText) { private void doNormalSearch(String searchText) {
SearchListModel searchListModelTemp = new SearchListModel(new SearchResult());
searchResultList.setModel(searchListModelTemp);
if (segmentationResult != null) { if (segmentationResult != null) {
buildRecentList(segmentationResult); buildRecentList(segmentationResult, searchListModelTemp);
buildRecommendList(segmentationResult); buildRecommendList(segmentationResult, searchListModelTemp);
buildActionList(segmentationResult); buildActionList(segmentationResult, searchListModelTemp);
buildFileList(searchText, segmentationResult); buildFileList(searchText, segmentationResult, searchListModelTemp);
buildDocumentList(segmentationResult); buildDocumentList(segmentationResult, searchListModelTemp);
buildPluginList(segmentationResult); buildPluginList(segmentationResult, searchListModelTemp);
buildSimilarList(segmentationResult); buildSimilarList(segmentationResult, searchListModelTemp);
} }
searchListModel.addElement(new BottomModel()); searchListModelTemp.addElement(new BottomModel());
searchListModel = searchListModelTemp;
} }
private void buildDocumentList(final String[] searchText) { private void buildDocumentList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(DocumentSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildFileList(String searchStr, final String[] searchText) { private void buildFileList(String searchStr, final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(FileSearchManager.getInstance().getLessSearchResult(searchStr, searchText)); addSearchResult(FileSearchManager.getInstance().getLessSearchResult(searchStr, searchText), searchListModelTemp);
} }
private void buildActionList(final String[] searchText) { private void buildActionList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(ActionSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildPluginList(final String[] searchText) { private void buildPluginList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(PluginSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildRecommendList(final String[] searchText) { private void buildRecommendList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(RecommendSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildRecentList(final String[] searchText) { private void buildRecentList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(RecentSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private void buildSimilarList(final String[] searchText) { private void buildSimilarList(final String[] searchText, SearchListModel searchListModelTemp) {
addSearchResult(SimilarSearchManager.getInstance().getLessSearchResult(searchText)); addSearchResult(SimilarSearchManager.getInstance().getLessSearchResult(searchText), searchListModelTemp);
} }
private synchronized void addSearchResult(SearchResult searchResult) { private synchronized void addSearchResult(SearchResult searchResult, SearchListModel searchListModelTemp) {
for (AlphaCellModel object : searchResult) { for (AlphaCellModel object : searchResult) {
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
searchListModel.addElement(object); searchListModelTemp.addElement(object);
} }
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java

@ -57,7 +57,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider {
private Directory directory = null; private Directory directory = null;
private IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer); private IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
private IndexWriter indexWriter = null; private IndexWriter indexWriter = null;
private SearchResult recentModelList; private SearchResult recentModelList = new SearchResult();
public static RecentSearchManager getInstance() { public static RecentSearchManager getInstance() {

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java

@ -26,8 +26,8 @@ import java.util.List;
*/ */
public class RecommendSearchManager implements AlphaFineSearchProvider { public class RecommendSearchManager implements AlphaFineSearchProvider {
private static volatile RecommendSearchManager instance; private static volatile RecommendSearchManager instance;
private SearchResult modelList; private SearchResult modelList = new SearchResult();
private SearchResult recommendModelList; private SearchResult recommendModelList = new SearchResult();
private SearchResult complementAdviceModelList; private SearchResult complementAdviceModelList;
private SearchResult moreModelList = new SearchResult(); private SearchResult moreModelList = new SearchResult();

Loading…
Cancel
Save