Skip to content

Commit

Permalink
pcorlessGH-2 Renames searchPanel -> searchModel
Browse files Browse the repository at this point in the history
  • Loading branch information
gtache committed Feb 11, 2020
1 parent b37e6fc commit 9e8562e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public boolean isShowPages() {

public SearchTextTask getSearchTask(BaseSearchModel panel, Controller controller, String pattern) {
SearchTextTask.Builder builder = new SearchTextTask.Builder(controller, pattern);
return builder.setSearchPanel(panel)
return builder.setSearchModel(panel)
.setCaseSensitive(isCaseSensitive())
.setWholeWord(isWholeWord())
.setCumulative(isCumulative())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class SearchTextTask extends SwingWorker<Void, SearchTextTask.SearchResul
// parent swing controller
private Controller controller;
// append nodes for found text.
private BaseSearchModel baseSearchModel;
private BaseSearchModel searchModel;
private Container viewContainer;

/**
Expand Down Expand Up @@ -98,11 +98,11 @@ private SearchTextTask(Builder builder) {
lengthOfTask = controller.getDocument().getNumberOfPages();

// setup searching format format.
this.baseSearchModel = builder.searchPanel;
if (baseSearchModel != null) {
searchingMessageForm = baseSearchModel.setupSearchingMessageForm();
searchResultMessageForm = baseSearchModel.setupSearchResultMessageForm();
searchCompletionMessageForm = baseSearchModel.setupSearchCompletionMessageForm();
this.searchModel = builder.searchModel;
if (searchModel != null) {
searchingMessageForm = searchModel.setupSearchingMessageForm();
searchResultMessageForm = searchModel.setupSearchResultMessageForm();
searchCompletionMessageForm = searchModel.setupSearchCompletionMessageForm();
}
}

Expand Down Expand Up @@ -166,7 +166,7 @@ protected Void doInBackground() {
String nodeText =
searchResultMessageForm != null ? searchResultMessageForm.format(messageArguments) : "";
// add the node to the search panel tree
if (baseSearchModel != null) {
if (searchModel != null) {
publish(new TextResult(matchLineItems, nodeText, i));
}
} else {
Expand Down Expand Up @@ -213,34 +213,34 @@ protected Void doInBackground() {
@Override
protected void process(List<SearchResult> chunks) {

if (baseSearchModel != null) {
if (searchModel != null) {
for (SearchResult searchResult : chunks) {
if (isCancelled()) {
break;
}
if (searchResult instanceof CommentsResult) {
CommentsResult comment = (CommentsResult) searchResult;
baseSearchModel.addFoundCommentEntry(comment, this);
searchModel.addFoundCommentEntry(comment, this);
} else if (searchResult instanceof TextResult) {
TextResult textResult = (TextResult) searchResult;
baseSearchModel.addFoundTextEntry(textResult, this);
searchModel.addFoundTextEntry(textResult, this);
} else if (searchResult instanceof OutlineResult) {
OutlineResult outlineResult = (OutlineResult) searchResult;
baseSearchModel.addFoundOutlineEntry(outlineResult, this);
searchModel.addFoundOutlineEntry(outlineResult, this);
} else if (searchResult instanceof DestinationsResult) {
DestinationsResult destinationsResult = (DestinationsResult) searchResult;
baseSearchModel.addFoundDestinationEntry(destinationsResult, this);
searchModel.addFoundDestinationEntry(destinationsResult, this);
}
}
// update the dialog messages.
baseSearchModel.updateProgressControls(dialogMessage);
searchModel.updateProgressControls(dialogMessage);
}
viewContainer.repaint();
}

@Override
protected void done() {
if (baseSearchModel != null) baseSearchModel.updateProgressControls(dialogMessage);
if (searchModel != null) searchModel.updateProgressControls(dialogMessage);
viewContainer.validate();
}

Expand Down Expand Up @@ -348,7 +348,7 @@ public static class Builder {
private final String pattern;

// parent search panel
private BaseSearchModel searchPanel;
private BaseSearchModel searchModel;

// optional search controls.
private boolean wholeWord;
Expand All @@ -367,8 +367,8 @@ public Builder(Controller controller, String pattern) {
this.pattern = pattern;
}

public Builder setSearchPanel(BaseSearchModel searchPanel) {
this.searchPanel = searchPanel;
public Builder setSearchModel(BaseSearchModel searchModel) {
this.searchModel = searchModel;
return this;
}

Expand Down

0 comments on commit 9e8562e

Please sign in to comment.