@@ -5,7 +5,7 @@ public class ResultConfig { | |||||
// TODO: integrate different filters (or extend?) | // TODO: integrate different filters (or extend?) | ||||
private SourceFilter source; | private SourceFilter source; | ||||
private Subpage subpage; | |||||
private Subtype subpage; | |||||
private ResultAction action; | private ResultAction action; | ||||
public SourceFilter getSource() { | public SourceFilter getSource() { | ||||
@@ -14,10 +14,10 @@ public class ResultConfig { | |||||
public void setSource(SourceFilter source) { | public void setSource(SourceFilter source) { | ||||
this.source = source; | this.source = source; | ||||
} | } | ||||
public Subpage getSubpage() { | |||||
public Subtype getSubpage() { | |||||
return subpage; | return subpage; | ||||
} | } | ||||
public void setSubpage(Subpage subpage) { | |||||
public void setSubpage(Subtype subpage) { | |||||
this.subpage = subpage; | this.subpage = subpage; | ||||
} | } | ||||
public ResultAction getAction() { | public ResultAction getAction() { | ||||
@@ -1,20 +0,0 @@ | |||||
package xyz.veronie.bgg.ui.contributions; | |||||
public enum Subpage { | |||||
BOARDGAMES("Board Games"), | |||||
RPG("RPGs"), | |||||
RPG_ITEMS("RPG Items"), | |||||
VIDEOGAMES("Video Games"), | |||||
ACCESSORIES("Accessories"); | |||||
private String name; | |||||
private Subpage(String name) { | |||||
this.name = name; | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return this.name; | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
package xyz.veronie.bgg.ui.contributions; | |||||
public enum Subtype { | |||||
BOARDGAME("Board games", "boardgame"), | |||||
BGEXPANSION("Board game expansions", "boardgameexpansion"), | |||||
BGACCESSORIES("Board game accessories", "boardgameaccessory"), | |||||
RPG_ISSUES("RPG issues", "rpgissue"), | |||||
RPG_ITEMS("RPG items", "rpgitem"), | |||||
VIDEOGAMES("Video Games", "videogame"); | |||||
private String name; //< the display name | |||||
private String thingTypeString; //< the THINGTYPE string for BGG XMLAPI2 | |||||
private Subtype(String name, String thingtypestr) { | |||||
this.name = name; | |||||
this.thingTypeString = thingtypestr; | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return this.name; | |||||
} | |||||
/// return the string used in BGG XMLAPI2 to identify the thingtype | |||||
public String toSubtypeString() { | |||||
return this.thingTypeString; | |||||
} | |||||
} |
@@ -0,0 +1,37 @@ | |||||
package xyz.veronie.bgg.ui.contributions; | |||||
import java.util.HashMap; | |||||
import org.eclipse.swt.SWT; | |||||
import org.eclipse.swt.layout.GridData; | |||||
import org.eclipse.swt.layout.GridLayout; | |||||
import org.eclipse.swt.widgets.Button; | |||||
import org.eclipse.swt.widgets.Composite; | |||||
import org.eclipse.swt.widgets.Group; | |||||
public class ThingFilterGroup { | |||||
private HashMap<Subtype, Button> buttons; | |||||
public void create(Composite parent) { | |||||
Group gSubtype = new Group(parent, SWT.LEFT); | |||||
gSubtype.setText("Subtypes"); | |||||
gSubtype.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); | |||||
gSubtype.setLayout(new GridLayout(1, false)); | |||||
buttons = new HashMap<Subtype, Button>(); | |||||
for (Subtype st : Subtype.values()) { | |||||
Button bb = new Button(gSubtype, SWT.CHECK); | |||||
bb.setText(st.toString()); | |||||
if(st == Subtype.BOARDGAME) { | |||||
// initially, only boardgame is checked | |||||
bb.setEnabled(true); | |||||
} else { | |||||
bb.setEnabled(false); | |||||
} | |||||
bb.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||||
buttons.put(st, bb); | |||||
} | |||||
} | |||||
} |
@@ -32,7 +32,8 @@ import xyz.veronie.bgg.ui.contributions.RankSourceFilter; | |||||
import xyz.veronie.bgg.ui.contributions.ResultAction; | import xyz.veronie.bgg.ui.contributions.ResultAction; | ||||
import xyz.veronie.bgg.ui.contributions.SearchSourceFilter; | import xyz.veronie.bgg.ui.contributions.SearchSourceFilter; | ||||
import xyz.veronie.bgg.ui.contributions.SourceFilter; | import xyz.veronie.bgg.ui.contributions.SourceFilter; | ||||
import xyz.veronie.bgg.ui.contributions.Subpage; | |||||
import xyz.veronie.bgg.ui.contributions.Subtype; | |||||
import xyz.veronie.bgg.ui.contributions.ThingFilterGroup; | |||||
import xyz.veronie.bgg.ui.contributions.YearSourceFilter; | import xyz.veronie.bgg.ui.contributions.YearSourceFilter; | ||||
@@ -81,18 +82,8 @@ public class LoadFromBggPart { | |||||
// choose the bgg sub-site | // choose the bgg sub-site | ||||
Label lblTopic = new Label(dlConfigGroup, SWT.LEFT); | |||||
lblTopic.setText("Subpage: "); | |||||
lblTopic.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); | |||||
ComboViewer cbTopic = new ComboViewer(dlConfigGroup, SWT.READ_ONLY); | |||||
cbTopic.setContentProvider(ArrayContentProvider.getInstance()); | |||||
List<Subpage> sites = Arrays.asList(new Subpage[] { | |||||
Subpage.BOARDGAMES, Subpage.RPG, Subpage.RPG_ITEMS, | |||||
Subpage.VIDEOGAMES, Subpage.ACCESSORIES }); | |||||
cbTopic.setInput(sites); | |||||
cbTopic.setSelection(new StructuredSelection(sites.get(0))); | |||||
ThingFilterGroup gSubtypes = new ThingFilterGroup(); | |||||
gSubtypes.create(dlConfigGroup); | |||||
// choose action on result list | // choose action on result list | ||||
Label lblAct = new Label(dlConfigGroup, SWT.LEFT); | Label lblAct = new Label(dlConfigGroup, SWT.LEFT); | ||||