Skip to content

Commit

Permalink
Simplify tab save/restore handling (hopefully should avoid losing tab…
Browse files Browse the repository at this point in the history
…s), and apply Andreas Stempfhuber's tab ordering patch. It also removes tabs which aren't currently visible from the 'Send To' list. Let's see how users react to that...

[#781 status:resolved tagged:committed]
  • Loading branch information
cyberfox committed Apr 16, 2010
1 parent 1ea2586 commit 94ec9a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/com/jbidwatcher/ui/FilterManager.java
Expand Up @@ -49,14 +49,14 @@ public void loadFilters() {
mDefaultSellingTab = mList.add(new AuctionListHolder("selling", false, false));

String tabName;
int i = 2;
int i = 0;

do {
tabName = JConfig.queryDisplayProperty("tabs.name." + i++);
if (tabName != null && mList.findCategory(tabName) == null) {
mList.add(new AuctionListHolder(tabName));
}
} while (tabName != null);
} while (i < 3 || tabName != null); // Do at least the first three, and then keep going until we miss an index.
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/com/jbidwatcher/ui/JBidTableContext.java
Expand Up @@ -89,7 +89,8 @@ public void actionPerformed(ActionEvent action) {

JTabbedPane tabbedPane = JTabManager.getInstance().getTabs();
String currentTitle = tabbedPane.getTitleAt(tabbedPane.getSelectedIndex());
List<String> tabs = Category.categories();
// shows the list of tabs in the same order as the tabs
List<String> tabs = ListManager.getInstance().allCategories();
if (tabs == null) {
tabMenu.setEnabled(false);
} else {
Expand Down
7 changes: 3 additions & 4 deletions src/com/jbidwatcher/ui/ListManager.java
Expand Up @@ -22,7 +22,8 @@ public class ListManager {
private static ListManager sInstance = null;

private ListManager() {
mCategoryMap = Collections.synchronizedMap(new HashMap<String, AuctionListHolder>(3));
// the LinkedHashMap fixes the random order of tabs
mCategoryMap = Collections.synchronizedMap(new LinkedHashMap<String, AuctionListHolder>(3));
}

public boolean toggleField(String tabName, String field) {
Expand Down Expand Up @@ -103,9 +104,7 @@ public Properties extractProperties(Properties outProps) {
step.getUI().getColumnWidthsToProperties(outProps);

String tab = step.getList().getName();
if (i > 2) {
outProps.setProperty("tabs.name." + (i - 2), tab);
}
outProps.setProperty("tabs.name." + i, tab);

String KEEP_ENDED = tab + ".end.keep";
String DELETE_NOT_MY_BID = tab + ".end.delete.notmybid";
Expand Down

0 comments on commit 94ec9a6

Please sign in to comment.