| @@ -23,6 +23,7 @@ public class ResultConfig { | |||
| private static final String VERSION = "1.0"; | |||
| private static final String XYZ_VERONI_BGG = "xyz.veroni.bgg"; | |||
| private static final String USER_NAME = "UserName"; | |||
| private static final String USER_FLAGS = "UserFlags"; | |||
| private static final String RESULT_CONFIG = "ResultConfig"; | |||
| @@ -78,6 +79,7 @@ public class ResultConfig { | |||
| prefResultConfig.put(VERSION_KEY, VERSION); | |||
| prefResultConfig.put(SOURCE_FILTER_KEY, source.name()); | |||
| prefResultConfig.put(SUBTYPE_KEY, subtype.name()); | |||
| prefResultConfig.put(USER_NAME, user); | |||
| prefResultConfig.put(SourceFilter.GEEKLIST.name(), (geeklistId == null) ? "" : geeklistId.toString()); | |||
| prefResultConfig.put(SourceFilter.FAMILY.name(), (familyId == null) ? "" : familyId.toString()); | |||
| prefResultConfig.put(FAMILY_TYPE_KEY, familyType.name()); | |||
| @@ -98,19 +100,20 @@ public class ResultConfig { | |||
| } | |||
| public void initFromPrefrences() { | |||
| Preferences preferences = InstanceScope.INSTANCE.getNode("xyz.veron.bgg"); | |||
| Preferences preferences = InstanceScope.INSTANCE.getNode(XYZ_VERONI_BGG); | |||
| if(preferences != null) { | |||
| Preferences prefResultConfig = preferences.node(RESULT_CONFIG); | |||
| // assume latest version | |||
| String version = prefResultConfig.get(VERSION_KEY, VERSION); | |||
| if(version != VERSION) { | |||
| if(!version.equals(VERSION)) { | |||
| System.out.println("WARN: Version mismatch. Trying to read config anyways."); | |||
| return; | |||
| } | |||
| source = SourceFilter.getEnum(prefResultConfig.get(SOURCE_FILTER_KEY, source.name())); | |||
| subtype = Subtype.getEnum(prefResultConfig.get(SUBTYPE_KEY, subtype.name())); | |||
| user = prefResultConfig.get(USER_NAME, user); | |||
| String geeklist = prefResultConfig.get(SourceFilter.GEEKLIST.name(), ""); | |||
| if(!geeklist.isEmpty()) { | |||
| geeklistId = Integer.valueOf(geeklist); | |||
| @@ -89,8 +89,8 @@ public class ResultConfigManager { | |||
| (@UIEventTopic(EventConstants.TOPIC_FAMILY_CHANGED) | |||
| Integer id) { | |||
| getResultConfig().familyId = id; | |||
| System.out.println("TOPIC_FAMILY_CHANGED: geeklistId = " + id); | |||
| storePreferences(); | |||
| System.out.println("TOPIC_FAMILY_CHANGED: geeklistId = " + id); | |||
| } | |||
| @Inject | |||
| @@ -99,8 +99,8 @@ public class ResultConfigManager { | |||
| (@UIEventTopic(EventConstants.TOPIC_FAMILYTYPE_CHANGED) | |||
| FamilyType ft) { | |||
| getResultConfig().familyType = ft; | |||
| System.out.println("TOPIC_FAMILYTYPE_CHANGED: family type = " + ft); | |||
| storePreferences(); | |||
| System.out.println("TOPIC_FAMILYTYPE_CHANGED: family type = " + ft); | |||
| } | |||
| public ResultConfig getResultConfig() { | |||
| @@ -1,31 +0,0 @@ | |||
| package xyz.veronie.bgg.ui.filters; | |||
| import javax.inject.Inject; | |||
| import org.eclipse.e4.core.di.annotations.Creatable; | |||
| import org.eclipse.e4.core.services.events.IEventBroker; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.layout.GridData; | |||
| import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Composite; | |||
| import org.eclipse.swt.widgets.Label; | |||
| import xyz.veronie.bgg.result.ResultConfigManager; | |||
| @Creatable | |||
| public class AgeSourceFilter { | |||
| @Inject private IEventBroker eventBroker; | |||
| @Inject private ResultConfigManager configManager; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| parent.setLayout(filterLayout); | |||
| Label empty = new Label(parent, SWT.LEFT); | |||
| empty.setText("not implemented yet"); | |||
| empty.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| parent.layout(); | |||
| } | |||
| } | |||
| @@ -24,7 +24,6 @@ import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Combo; | |||
| import org.eclipse.swt.widgets.Composite; | |||
| import org.eclipse.swt.widgets.Label; | |||
| import org.eclipse.swt.widgets.Layout; | |||
| import xyz.veronie.bgg.result.ResultConfigManager; | |||
| import xyz.veronie.bgg.types.EventConstants; | |||
| @@ -32,12 +31,10 @@ import xyz.veronie.bgg.types.FilterFlagState; | |||
| import xyz.veronie.bgg.types.Subtype; | |||
| import xyz.veronie.bgg.types.UserFlag; | |||
| import xyz.veronie.bgg.types.UserFlagEvent; | |||
| import xyz.veronie.bgg.ui.helpers.BatLayouts; | |||
| import xyz.veronie.bgg.ui.helpers.CommonControls; | |||
| /// These are the controls to retrieve thing IDs for a given BGG user | |||
| /// Filters can be set for the state of the thing in the user's collection | |||
| /// (i.e. owned, previously owned, wishlist, etc.) | |||
| @@ -52,8 +49,11 @@ public class BggUserSourceFilter { | |||
| public void create(Composite parent, int style) { | |||
| Composite mainCompo = new Composite(parent, SWT.FILL); | |||
| mainCompo.setLayout(new GridLayout(5, false)); | |||
| mainCompo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | |||
| GridLayout gl_mainCompo = new GridLayout(5, false); | |||
| BatLayouts.applyZeroSpacing(gl_mainCompo); | |||
| mainCompo.setLayout(gl_mainCompo); | |||
| mainCompo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||
| Label lblUser = new Label(mainCompo, SWT.LEFT); | |||
| lblUser.setText("User name: "); | |||
| @@ -132,7 +132,7 @@ public class BggUserSourceFilter { | |||
| GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); | |||
| gridData.horizontalSpan = 5; | |||
| flagsComposite.setLayoutData(gridData); | |||
| layout.horizontalSpacing = 15; | |||
| layout.horizontalSpacing = 16; | |||
| flagsComposite.setLayout(layout); | |||
| Label infoLabel = new Label(flagsComposite, SWT.LEFT); | |||
| @@ -158,11 +158,10 @@ public class BggUserSourceFilter { | |||
| makeFilter(flagsComposite, UserFlag.PLAYED); | |||
| // flagsComposite.pack(); | |||
| // flagsComposite.getParent().pack(); | |||
| // flagsComposite.layout(); | |||
| mainCompo.pack(); | |||
| mainCompo.layout(true, true); | |||
| //mainCompo.layout(true, true); | |||
| parent.pack(); | |||
| parent.layout(true, true); | |||
| } | |||
| @@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Label; | |||
| import xyz.veronie.bgg.result.ResultConfigManager; | |||
| import xyz.veronie.bgg.types.EventConstants; | |||
| import xyz.veronie.bgg.types.FamilyType; | |||
| import xyz.veronie.bgg.ui.helpers.BatLayouts; | |||
| /// These are the controls to retrieve thing IDs for a given family ID | |||
| @Creatable | |||
| @@ -41,14 +42,17 @@ public class FamilySourceFilter { | |||
| private Combo cbFamilyId; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| parent.setLayout(filterLayout); | |||
| Label lblFamily = new Label(parent, SWT.LEFT); | |||
| Composite mainCompo = new Composite(parent, SWT.FILL); | |||
| GridLayout gl_mainCompo = new GridLayout(2, false); | |||
| BatLayouts.applyZeroSpacing(gl_mainCompo); | |||
| mainCompo.setLayout(gl_mainCompo); | |||
| mainCompo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||
| Label lblFamily = new Label(mainCompo, SWT.LEFT); | |||
| lblFamily.setText("Family ID: "); | |||
| lblFamily.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| cbFamilyId = new Combo(parent, SWT.DROP_DOWN); | |||
| cbFamilyId = new Combo(mainCompo, SWT.DROP_DOWN); | |||
| cbFamilyId.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| Integer fid = configManager.getResultConfig().familyId; | |||
| @@ -89,11 +93,11 @@ public class FamilySourceFilter { | |||
| }); | |||
| Label lblFamilyType = new Label(parent, SWT.LEFT); | |||
| Label lblFamilyType = new Label(mainCompo, SWT.LEFT); | |||
| lblFamilyType.setText("Family Type: "); | |||
| lblFamilyType.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| ComboViewer cbSubtypes = new ComboViewer(parent, SWT.READ_ONLY); | |||
| ComboViewer cbSubtypes = new ComboViewer(mainCompo, SWT.READ_ONLY); | |||
| cbSubtypes.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| cbSubtypes.setContentProvider(ArrayContentProvider.getInstance()); | |||
| List<FamilyType> subtypes = new ArrayList<FamilyType>(); | |||
| @@ -110,15 +114,17 @@ public class FamilySourceFilter { | |||
| } | |||
| }); | |||
| confLabel = new StyledText(parent, SWT.MULTI | SWT.READ_ONLY); | |||
| Label lblInfo = new Label(mainCompo, SWT.LEFT); | |||
| lblInfo.setText("Description: "); | |||
| lblInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| confLabel = new StyledText(mainCompo, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER); | |||
| confLabel.setText(""); | |||
| confLabel.setWordWrap(true); | |||
| confLabel.setBounds(10,10,100,100); | |||
| GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); | |||
| gd.horizontalSpan = 2; | |||
| confLabel.setLayoutData(gd); | |||
| confLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||
| parent.layout(); | |||
| mainCompo.pack(); | |||
| mainCompo.layout(true, true); | |||
| } | |||
| @@ -135,6 +141,7 @@ public class FamilySourceFilter { | |||
| private void subscribeTopicGeeklistInfo | |||
| (@UIEventTopic(EventConstants.TOPIC_FAMILY_INFO) | |||
| String familyInfo) { | |||
| System.out.println("TOPIC_FAMILY_INFO: " + familyInfo); | |||
| confLabel.setText(familyInfo); | |||
| confLabel.redraw(); | |||
| } | |||
| @@ -20,6 +20,7 @@ import org.eclipse.swt.widgets.Label; | |||
| import xyz.veronie.bgg.result.ResultConfigManager; | |||
| import xyz.veronie.bgg.types.EventConstants; | |||
| import xyz.veronie.bgg.ui.helpers.BatLayouts; | |||
| /// These are the controls to retrieve thing IDs for a given family ID | |||
| @Creatable | |||
| @@ -32,14 +33,17 @@ public class GeeklistSourceFilter { | |||
| private Combo cbGeeklistId; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| parent.setLayout(filterLayout); | |||
| Composite mainCompo = new Composite(parent, SWT.FILL); | |||
| GridLayout gl_mainCompo = new GridLayout(2, false); | |||
| BatLayouts.applyZeroSpacing(gl_mainCompo); | |||
| mainCompo.setLayout(gl_mainCompo); | |||
| mainCompo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||
| Label lblGeeklist = new Label(parent, SWT.LEFT); | |||
| Label lblGeeklist = new Label(mainCompo, SWT.LEFT); | |||
| lblGeeklist.setText("Geeklist ID: "); | |||
| lblGeeklist.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| cbGeeklistId = new Combo(parent, SWT.DROP_DOWN); | |||
| cbGeeklistId = new Combo(mainCompo, SWT.DROP_DOWN); | |||
| Integer gid = configManager.getResultConfig().geeklistId; | |||
| if(gid != null) { | |||
| cbGeeklistId.setText(Integer.toString(gid)); | |||
| @@ -76,17 +80,19 @@ public class GeeklistSourceFilter { | |||
| } | |||
| }); | |||
| confLabel = new StyledText(parent, SWT.MULTI | SWT.READ_ONLY); | |||
| Label lblInfo = new Label(mainCompo, SWT.LEFT); | |||
| lblInfo.setText("Description: "); | |||
| lblInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| confLabel = new StyledText(mainCompo, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER); | |||
| confLabel.setText(""); | |||
| confLabel.setWordWrap(true); | |||
| confLabel.setBounds(10,10,100,100); | |||
| GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); | |||
| gd.horizontalSpan = 2; | |||
| confLabel.setLayoutData(gd); | |||
| parent.pack(); | |||
| parent.getParent().pack(); | |||
| parent.layout(); | |||
| confLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); | |||
| mainCompo.pack(); | |||
| mainCompo.layout(true, true); | |||
| } | |||
| public void setGeeklistId(Integer geeklistId) { | |||
| @@ -102,6 +108,7 @@ public class GeeklistSourceFilter { | |||
| private void subscribeTopicGeeklistInfo | |||
| (@UIEventTopic(EventConstants.TOPIC_GEEKLIST_INFO) | |||
| String geeklistInfo) { | |||
| System.out.println("TOPIC_GEEKLIST_INFO: " + geeklistInfo); | |||
| confLabel.setText(geeklistInfo); | |||
| confLabel.redraw(); | |||
| } | |||
| @@ -1,31 +0,0 @@ | |||
| package xyz.veronie.bgg.ui.filters; | |||
| import javax.inject.Inject; | |||
| import org.eclipse.e4.core.di.annotations.Creatable; | |||
| import org.eclipse.e4.core.services.events.IEventBroker; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.layout.GridData; | |||
| import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Composite; | |||
| import org.eclipse.swt.widgets.Label; | |||
| import xyz.veronie.bgg.result.ResultConfigManager; | |||
| @Creatable | |||
| public class RankSourceFilter { | |||
| @Inject private IEventBroker eventBroker; | |||
| @Inject private ResultConfigManager configManager; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| parent.setLayout(filterLayout); | |||
| Label empty = new Label(parent, SWT.LEFT); | |||
| empty.setText("not implemented yet"); | |||
| empty.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| parent.layout(); | |||
| } | |||
| } | |||
| @@ -1,31 +0,0 @@ | |||
| package xyz.veronie.bgg.ui.filters; | |||
| import javax.inject.Inject; | |||
| import org.eclipse.e4.core.di.annotations.Creatable; | |||
| import org.eclipse.e4.core.services.events.IEventBroker; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.layout.GridData; | |||
| import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Composite; | |||
| import org.eclipse.swt.widgets.Label; | |||
| import xyz.veronie.bgg.result.ResultConfigManager; | |||
| @Creatable | |||
| public class SearchSourceFilter { | |||
| @Inject private IEventBroker eventBroker; | |||
| @Inject private ResultConfigManager configManager; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| parent.setLayout(filterLayout); | |||
| Label empty = new Label(parent, SWT.LEFT); | |||
| empty.setText("not implemented yet"); | |||
| empty.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| parent.layout(); | |||
| } | |||
| } | |||
| @@ -1,31 +0,0 @@ | |||
| package xyz.veronie.bgg.ui.filters; | |||
| import javax.inject.Inject; | |||
| import org.eclipse.e4.core.di.annotations.Creatable; | |||
| import org.eclipse.e4.core.services.events.IEventBroker; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.layout.GridData; | |||
| import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Composite; | |||
| import org.eclipse.swt.widgets.Label; | |||
| import xyz.veronie.bgg.result.ResultConfigManager; | |||
| @Creatable | |||
| public class YearSourceFilter { | |||
| @Inject private IEventBroker eventBroker; | |||
| @Inject private ResultConfigManager configManager; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| parent.setLayout(filterLayout); | |||
| Label empty = new Label(parent, SWT.LEFT); | |||
| empty.setText("not implemented yet"); | |||
| empty.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| parent.layout(); | |||
| } | |||
| } | |||
| @@ -6,13 +6,24 @@ public class BatLayouts { | |||
| public static void applyStandardSpacing(GridLayout gl) { | |||
| gl.horizontalSpacing = 8; | |||
| gl.verticalSpacing = 24; | |||
| gl.verticalSpacing = 8; | |||
| gl.marginWidth = 8; | |||
| gl.marginTop = 8; | |||
| gl.marginRight = 8; | |||
| gl.marginLeft = 8; | |||
| gl.marginHeight = 8; | |||
| gl.marginBottom = 8; | |||
| gl.marginBottom = 16; | |||
| } | |||
| public static void applyZeroSpacing(GridLayout gl) { | |||
| gl.horizontalSpacing = 8; | |||
| gl.verticalSpacing = 8; | |||
| gl.marginWidth = 0; | |||
| gl.marginTop = 0; | |||
| gl.marginRight = 0; | |||
| gl.marginLeft = 0; | |||
| gl.marginHeight = 0; | |||
| gl.marginBottom = 0; | |||
| } | |||
| } | |||
| @@ -27,7 +27,6 @@ import org.eclipse.jface.viewers.TableViewerColumn; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.events.MouseAdapter; | |||
| import org.eclipse.swt.events.MouseEvent; | |||
| import org.eclipse.swt.graphics.Color; | |||
| import org.eclipse.swt.graphics.Image; | |||
| import org.eclipse.swt.layout.GridData; | |||
| import org.eclipse.swt.layout.GridLayout; | |||
| @@ -46,7 +45,7 @@ import xyz.veronie.bgg.ui.helpers.BatColors; | |||
| import xyz.veronie.bgg.ui.helpers.BatLayouts; | |||
| // TODO: remember config | |||
| // TODO: layout of user flags | |||
| // TODO: load thing list from DB | |||
| // TODO: image sizes | |||
| // TODO: display current thinglist name | |||
| @@ -55,7 +54,7 @@ import xyz.veronie.bgg.ui.helpers.BatLayouts; | |||
| // TODO: generate PDF with nandeck | |||
| // TODO: handle thing list overwrite | |||
| // TODO: Display selection details on game | |||
| // TODO: cache family/geeklist descriptions | |||
| @SuppressWarnings("restriction") | |||
| public class BatMain { | |||
| @@ -80,34 +79,21 @@ public class BatMain { | |||
| EPartService partService, EModelService modelService, | |||
| ECommandService commandService, EHandlerService handlerService) | |||
| { | |||
| Color bgColor = BatColors.getBackgroundColor(); | |||
| parent.setBackground(bgColor); | |||
| GridLayout gl_parent = new GridLayout(1, false); | |||
| gl_parent.horizontalSpacing = 0; | |||
| gl_parent.verticalSpacing = 0; | |||
| gl_parent.marginWidth = 0; | |||
| gl_parent.marginHeight = 0; | |||
| parent.setLayout(gl_parent); | |||
| parent.setBackground(BatColors.getBackgroundColor()); | |||
| parent.setBackgroundMode(SWT.INHERIT_FORCE); | |||
| parent.setLayout(new GridLayout(1, false)); | |||
| Composite main = new Composite(parent, SWT.NONE); | |||
| GridData gd_main = new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1); | |||
| gd_main.minimumHeight = 192; | |||
| gd_main.minimumWidth = 348; | |||
| main.setLayoutData(gd_main); | |||
| main.setBackground(bgColor); | |||
| GridLayout gl_main = new GridLayout(1, false); | |||
| gl_main.verticalSpacing = 24; | |||
| BatLayouts.applyStandardSpacing(gl_main); | |||
| main.setLayout(gl_main); | |||
| Composite buttonRow = new Composite(main, SWT.NONE); | |||
| buttonRow.setBackground(bgColor); | |||
| GridLayout gl_buttonRow = new GridLayout(5, false); | |||
| gl_buttonRow.verticalSpacing = 8; | |||
| gl_buttonRow.marginWidth = 0; | |||
| gl_buttonRow.marginHeight = 8; | |||
| gl_buttonRow.horizontalSpacing = 8; | |||
| BatLayouts.applyStandardSpacing(gl_buttonRow); | |||
| buttonRow.setLayout(gl_buttonRow); | |||
| buttonRow.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false, 1, 1)); | |||
| @@ -128,8 +114,6 @@ public class BatMain { | |||
| }); | |||
| btnFetch.setToolTipText("Fetch games from BGG"); | |||
| btnFetch.setForeground(SWTResourceManager.getColor(SWT.COLOR_TRANSPARENT)); | |||
| btnFetch.setBackground(SWTResourceManager.getColor(SWT.COLOR_TRANSPARENT)); | |||
| btnFetch.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_Download_60x60.png")); | |||
| btnSave = new Button(buttonRow, SWT.NONE); | |||
| @@ -144,33 +128,43 @@ public class BatMain { | |||
| } | |||
| }); | |||
| btnSave.setToolTipText("Save list of games"); | |||
| btnSave.setBackground(SWTResourceManager.getColor(SWT.COLOR_TRANSPARENT)); | |||
| btnSave.setForeground(SWTResourceManager.getColor(SWT.COLOR_TRANSPARENT)); | |||
| btnSave.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_Save_60x60.png")); | |||
| btnSave.setEnabled(false); | |||
| Button btnLoad = new Button(buttonRow, SWT.NONE); | |||
| btnLoad.setBackground(SWTResourceManager.getColor(SWT.COLOR_TRANSPARENT)); | |||
| btnLoad.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_open_60x60.png")); | |||
| btnLoad.setToolTipText("Load list of games"); | |||
| btnUndo = new Button(buttonRow, SWT.NONE); | |||
| btnUndo.setToolTipText("Undo game list operation"); | |||
| btnUndo.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/noun_Undo_60x60.png")); | |||
| btnUndo.setBackground(SWTResourceManager.getColor(SWT.COLOR_TRANSPARENT)); | |||
| btnUndo.setEnabled(false); | |||
| btnExport = new Button(buttonRow, SWT.NONE); | |||
| btnExport.setBackground(SWTResourceManager.getColor(SWT.COLOR_TRANSPARENT)); | |||
| btnExport.setImage(ResourceManager.getPluginImage("xyz.veronie.bgg.ui", "icons/export_nandeck_60x60.png")); | |||
| btnExport.setToolTipText("Export for nanDeck"); | |||
| btnExport.setEnabled(false); | |||
| tableViewer = new TableViewer(main, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); | |||
| Composite centerComposite = new Composite(main, SWT.NONE); | |||
| GridLayout gl_centerComposite = new GridLayout(1, false); | |||
| BatLayouts.applyStandardSpacing(gl_centerComposite); | |||
| centerComposite.setLayout(gl_centerComposite); | |||
| centerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); | |||
| Composite tableComposite = new Composite(centerComposite, SWT.NONE); | |||
| tableComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); | |||
| GridLayout gl_tableComposite = new GridLayout(1, false); | |||
| BatLayouts.applyZeroSpacing(gl_tableComposite); | |||
| tableComposite.setLayout(gl_tableComposite); | |||
| tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); | |||
| tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); | |||
| tableGameList = tableViewer.getTable(); | |||
| tableGameList.setLinesVisible(true); | |||
| tableGameList.setHeaderVisible(true); | |||
| GridData gd_tableGameList = new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1); | |||
| GridData gd_tableGameList = new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1); | |||
| gd_tableGameList.heightHint = 466; | |||
| tableGameList.setLayoutData(gd_tableGameList); | |||
| @@ -193,12 +187,8 @@ public class BatMain { | |||
| Composite statusRow = new Composite(main, SWT.NONE); | |||
| statusRow.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false, 1, 1)); | |||
| statusRow.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); | |||
| GridLayout gl_statusRow = new GridLayout(1, false); | |||
| gl_statusRow.verticalSpacing = 8; | |||
| gl_statusRow.marginWidth = 8; | |||
| gl_statusRow.marginHeight = 8; | |||
| gl_statusRow.horizontalSpacing = 8; | |||
| BatLayouts.applyStandardSpacing(gl_statusRow); | |||
| statusRow.setLayout(gl_statusRow); | |||
| @@ -22,8 +22,8 @@ import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Button; | |||
| import org.eclipse.swt.widgets.Composite; | |||
| import org.eclipse.swt.widgets.Control; | |||
| import org.eclipse.swt.widgets.Group; | |||
| import org.eclipse.wb.swt.ResourceManager; | |||
| import org.eclipse.wb.swt.SWTResourceManager; | |||
| import xyz.veronie.bgg.result.BggApi; | |||
| import xyz.veronie.bgg.result.ResultConfig; | |||
| @@ -38,7 +38,6 @@ import xyz.veronie.bgg.ui.filters.FamilySourceFilter; | |||
| import xyz.veronie.bgg.ui.filters.GeeklistSourceFilter; | |||
| import xyz.veronie.bgg.ui.helpers.BatColors; | |||
| import xyz.veronie.bgg.ui.helpers.BatLayouts; | |||
| import org.eclipse.swt.widgets.Label; | |||
| public class FetchPart { | |||
| @@ -71,9 +70,10 @@ public class FetchPart { | |||
| private Button btnBggUser; | |||
| private Button btnFamily; | |||
| private Button btnGeeklist; | |||
| private Composite main; | |||
| private Composite filterComposite; | |||
| private Group filterGroup; | |||
| @Inject | |||
| public FetchPart() { | |||
| @@ -83,6 +83,7 @@ public class FetchPart { | |||
| @PostConstruct | |||
| public void postConstruct(Composite parent) { | |||
| parent.setBackground(BatColors.getBackgroundColor()); | |||
| parent.setBackgroundMode(SWT.INHERIT_FORCE); | |||
| parent.setLayout(new GridLayout(1, false)); | |||
| main = new Composite(parent, SWT.NONE); | |||
| @@ -94,7 +95,7 @@ public class FetchPart { | |||
| Composite buttonRow = new Composite(main, SWT.NONE); | |||
| buttonRow.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); | |||
| GridLayout gl_buttonRow = new GridLayout(3, false); | |||
| BatLayouts.applyStandardSpacing(gl_main); | |||
| BatLayouts.applyStandardSpacing(gl_buttonRow); | |||
| buttonRow.setLayout(gl_buttonRow); | |||
| btnBggUser = new Button(buttonRow, SWT.NONE); | |||
| @@ -135,12 +136,21 @@ public class FetchPart { | |||
| BatLayouts.applyStandardSpacing(gl_centerComposite); | |||
| centerComposite.setLayout(gl_centerComposite); | |||
| filterGroup = new Group(centerComposite, SWT.NONE); | |||
| filterGroup.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1)); | |||
| filterGroup.setLayout(new GridLayout(1, false)); | |||
| filterComposite = new Composite(centerComposite, SWT.NONE); | |||
| filterComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND)); | |||
| filterComposite.setBackgroundMode(SWT.INHERIT_FORCE); | |||
| filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); | |||
| GridLayout gl_filterComposite = new GridLayout(1, false); | |||
| BatLayouts.applyStandardSpacing(gl_filterComposite); | |||
| filterComposite.setLayout(gl_filterComposite); | |||
| Composite applyComposite = new Composite(main, SWT.NONE); | |||
| applyComposite.setLayout(new GridLayout(5, false)); | |||
| GridLayout gl_applyComposite = new GridLayout(5, false); | |||
| BatLayouts.applyStandardSpacing(gl_applyComposite); | |||
| applyComposite.setLayout(gl_applyComposite); | |||
| applyComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false, 1, 1)); | |||
| Button btnReplace = new Button(applyComposite, SWT.NONE); | |||
| @@ -196,9 +206,8 @@ public class FetchPart { | |||
| // init filter using config manager | |||
| SourceFilter source = configManager.getResultConfig().source; | |||
| selectFilter(source); | |||
| showFilter(filterGroup, source); | |||
| showFilter(filterComposite, source); | |||
| } | |||
| @@ -227,7 +236,7 @@ public class FetchPart { | |||
| btnGeeklist.setBackground(BatColors.getButtonBgColor()); | |||
| break; | |||
| } | |||
| showFilter(filterGroup, source); | |||
| showFilter(filterComposite, source); | |||
| eventBroker.send(EventConstants.TOPIC_SOURCE_CHANGED, source); | |||
| } | |||
| @@ -257,6 +266,7 @@ public class FetchPart { | |||
| break; | |||
| } | |||
| main.pack(); | |||
| main.layout(true, true); | |||
| } | |||