Procházet zdrojové kódy

started to nicify subtype filters

pull/1/head
veronie před 5 roky
rodič
revize
8e5769651a
5 změnil soubory, kde provedl 72 přidání a 36 odebrání
  1. +3
    -3
      xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/contributions/ResultConfig.java
  2. +0
    -20
      xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/contributions/Subpage.java
  3. +28
    -0
      xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/contributions/Subtype.java
  4. +37
    -0
      xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/contributions/ThingFilterGroup.java
  5. +4
    -13
      xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/parts/LoadFromBggPart.java

+ 3
- 3
xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/contributions/ResultConfig.java Zobrazit soubor

@@ -5,7 +5,7 @@ public class ResultConfig {
// TODO: integrate different filters (or extend?)
private SourceFilter source;
private Subpage subpage;
private Subtype subpage;
private ResultAction action;
public SourceFilter getSource() {
@@ -14,10 +14,10 @@ public class ResultConfig {
public void setSource(SourceFilter source) {
this.source = source;
}
public Subpage getSubpage() {
public Subtype getSubpage() {
return subpage;
}
public void setSubpage(Subpage subpage) {
public void setSubpage(Subtype subpage) {
this.subpage = subpage;
}
public ResultAction getAction() {


+ 0
- 20
xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/contributions/Subpage.java Zobrazit soubor

@@ -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;
}
}

+ 28
- 0
xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/contributions/Subtype.java Zobrazit soubor

@@ -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;
}
}

+ 37
- 0
xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/contributions/ThingFilterGroup.java Zobrazit soubor

@@ -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);
}
}
}

+ 4
- 13
xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/parts/LoadFromBggPart.java Zobrazit soubor

@@ -32,7 +32,8 @@ import xyz.veronie.bgg.ui.contributions.RankSourceFilter;
import xyz.veronie.bgg.ui.contributions.ResultAction;
import xyz.veronie.bgg.ui.contributions.SearchSourceFilter;
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;
@@ -81,18 +82,8 @@ public class LoadFromBggPart {
// 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
Label lblAct = new Label(dlConfigGroup, SWT.LEFT);


Načítá se…
Zrušit
Uložit