| @@ -1,28 +1,30 @@ | |||
| <?xml version="1.0" encoding="ASCII"?> | |||
| <application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmi:id="_Lw_ZsEqSEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.application"> | |||
| <application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_Lw_ZsEqSEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.application"> | |||
| <children xsi:type="basic:TrimmedWindow" xmi:id="_QDxdgEqSEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.trimmedwindow.main" label="BGG Tool Another" width="1200" height="800"> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_B_h_UEqVEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.0"> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_tbnr0EqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.main" horizontal="true"> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_4NsHQEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.bggload"> | |||
| <children xsi:type="basic:PartStack" xmi:id="_7KNiwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partstack.bggloadconf" containerData="1000"> | |||
| <children xsi:type="basic:Part" xmi:id="_9ocfwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.part.resultconfig" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.LoadFromBggPart" label="Load IDs from BGG"/> | |||
| <children xsi:type="basic:PartStack" xmi:id="_7KNiwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partstack.bggloadconf" containerData="1400"> | |||
| <children xsi:type="basic:Part" xmi:id="_9ocfwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.part.resultconfig" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.LoadFromBggPart" label="Prepare"/> | |||
| </children> | |||
| <children xsi:type="basic:PartStack" xmi:id="_7hQw0EqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partstack.bggresult" containerData="1000"> | |||
| <children xsi:type="basic:Part" xmi:id="_97XbwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.part.resulttable" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.BggResultPart" label="BGG Result"/> | |||
| <children xsi:type="basic:PartStack" xmi:id="_7hQw0EqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partstack.bggresult" containerData="600"> | |||
| <children xsi:type="basic:Part" xmi:id="_-Mdy0EqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.gamesconfig" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.LoadThingDetailsPart" label="Load game details"/> | |||
| </children> | |||
| </children> | |||
| <children xsi:type="basic:PartSashContainer" xmi:id="_AF1vQEqUEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.partsashcontainer.gamelist"> | |||
| <children xsi:type="basic:PartStack" xmi:id="_0MbRQEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.gameslistconf"> | |||
| <children xsi:type="basic:Part" xmi:id="_-Mdy0EqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.gamesconfig" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.LoadThingDetailsPart" label="Load game details"/> | |||
| </children> | |||
| <children xsi:type="basic:PartStack" xmi:id="_CS1yUEqUEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.gameslist"> | |||
| <children xsi:type="basic:PartStack" xmi:id="_0MbRQEqTEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.partstack.gameslist" containerData="300"> | |||
| <children xsi:type="basic:Part" xmi:id="_97XbwEqTEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.part.resulttable" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.BggResultPart" label="BGG Result"/> | |||
| <children xsi:type="basic:Part" xmi:id="_Ckm3wEqUEeqT5sxfmvJ5Tg" elementId="de.wt.bgg.ui.part.gamestable" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.ThingListPart" label="Games list"/> | |||
| </children> | |||
| </children> | |||
| </children> | |||
| <children xsi:type="advanced:Area" xmi:id="_8nEs4EqUEeqT5sxfmvJ5Tg" elementId="xyz.veronie.bgg.ui.area.status" containerData="100" label="Status"/> | |||
| </children> | |||
| <mainMenu xmi:id="_wtXeQEs0EeqGDvPDavxXPQ" elementId="org.eclipse.ui.main.menu"/> | |||
| <trimBars xmi:id="_1nq0UFu3Eeq4377K74W4EQ" elementId="xyz.veronie.bgg.ui.status" side="Bottom"> | |||
| <children xsi:type="menu:ToolBar" xmi:id="_JFF2UFu4Eeq4377K74W4EQ" elementId="xyz.veronie.bgg.ui.toolbar.0"> | |||
| <children xsi:type="menu:ToolControl" xmi:id="_xUKiUFu4Eeq4377K74W4EQ" elementId="xyz.veronie.bgg.ui.toolcontrol.status" contributionURI="bundleclass://xyz.veronie.bgg.ui/xyz.veronie.bgg.ui.parts.StatusBar"/> | |||
| </children> | |||
| </trimBars> | |||
| </children> | |||
| <addons xmi:id="_Lw_ZsUqSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/> | |||
| <addons xmi:id="_Lw_ZskqSEeqT5sxfmvJ5Tg" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/> | |||
| @@ -32,6 +32,22 @@ public class ResultConfig { | |||
| public Integer geeklistId = null; | |||
| public Integer familyId = null; | |||
| // TODO: add others | |||
| @Override | |||
| public String toString() { | |||
| switch(source) { | |||
| case BGG_USER: | |||
| return "user = " + user; | |||
| case GEEKLIST: | |||
| return "Geeklist #" + geeklistId; | |||
| case FAMILY: | |||
| return "Family #" + familyId; | |||
| default: | |||
| return ""; | |||
| } | |||
| } | |||
| } | |||
| @@ -12,7 +12,7 @@ public class ThingMetaData { | |||
| private String comment; | |||
| private Integer numPlays; | |||
| private static String[] titles = { "Id", "Name", "Image", "Thumb", "comment", "# plays"}; | |||
| private static String[] titles = { "Id", "Name" }; //, "Image", "Thumb", "comment", "# plays"}; | |||
| private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); | |||
| @@ -55,18 +55,22 @@ public class ThingMetaData { | |||
| case 1: | |||
| returnStr = this.name; | |||
| break; | |||
| case 2: | |||
| returnStr = this.imgURL; | |||
| break; | |||
| case 3: | |||
| returnStr = this.thumbURL; | |||
| break; | |||
| case 4: | |||
| returnStr = this.comment; | |||
| break; | |||
| case 5: | |||
| returnStr = String.valueOf(this.numPlays); | |||
| break; | |||
| // case 2: | |||
| // returnStr = this.imgURL; | |||
| // break; | |||
| // case 3: | |||
| // returnStr = this.thumbURL; | |||
| // break; | |||
| // case 4: | |||
| // returnStr = this.comment; | |||
| // break; | |||
| // case 5: | |||
| // if (this.numPlays == null) { | |||
| // returnStr = ""; | |||
| // } else { | |||
| // returnStr = String.valueOf(this.numPlays); | |||
| // } | |||
| // break; | |||
| default: | |||
| throw new ArrayIndexOutOfBoundsException( | |||
| "idx " + String.valueOf(idx) + " must be in [0," + (titles.length-1) + "]"); | |||
| @@ -20,5 +20,6 @@ public interface EventConstants { | |||
| String TOPIC_RESULT_CHANGED = "RESULT_CHANGED"; | |||
| String TOPIC_STATUS = "STATUS"; | |||
| } | |||
| @@ -1,11 +1,11 @@ | |||
| package xyz.veronie.bgg.types; | |||
| public enum ResultAction { | |||
| ADD("add"), | |||
| ADD("add to"), | |||
| REP("replace"), | |||
| SUB("subtract"), | |||
| AND("and"), | |||
| MIS("mis"); | |||
| SUB("subtract from"), | |||
| AND("intercept with"); | |||
| //MIS("mis"); | |||
| private String name; | |||
| @@ -26,6 +26,8 @@ public class GeeklistSourceFilter { | |||
| @Inject private IEventBroker eventBroker; | |||
| @Inject private ResultConfigManager configManager; | |||
| private Label confLabel; | |||
| public void create(Composite parent, int style) { | |||
| GridLayout filterLayout = new GridLayout(2, false); | |||
| parent.setLayout(filterLayout); | |||
| @@ -66,12 +68,20 @@ public class GeeklistSourceFilter { | |||
| // nothing | |||
| } | |||
| }); | |||
| confLabel = new Label(parent, SWT.LEFT); | |||
| confLabel.setText(""); | |||
| GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false); | |||
| gd.horizontalSpan = 2; | |||
| confLabel.setLayoutData(gd); | |||
| parent.layout(); | |||
| } | |||
| public void setGeeklistId(Integer geeklistId) { | |||
| if(eventBroker != null) { | |||
| eventBroker.post(EventConstants.TOPIC_GEEKLIST_CHANGED, geeklistId); | |||
| confLabel.setText("Geeklist #" + geeklistId); | |||
| } else { | |||
| System.out.println("setGeeklistId: eventBroker is null."); | |||
| } | |||
| @@ -66,7 +66,7 @@ public class BggResultPart { | |||
| // This will create the columns for the table | |||
| private void createColumns(final Composite parent, final TableViewer viewer) { | |||
| String[] titles = ThingMetaData.getTitles(); | |||
| int[] bounds = { 100, 100, 100, 100, 100, 100 }; | |||
| int[] bounds = { 100, 500 }; // , 100, 100, 100, 100 }; | |||
| for(int i = 0; i < titles.length; ++i) { | |||
| TableViewerColumn col = createTableViewerColumn(titles[i], bounds[i], i); | |||
| @@ -7,6 +7,7 @@ import javax.annotation.PostConstruct; | |||
| import javax.inject.Inject; | |||
| import org.eclipse.e4.core.services.events.IEventBroker; | |||
| import org.eclipse.jface.dialogs.MessageDialog; | |||
| import org.eclipse.jface.viewers.ArrayContentProvider; | |||
| import org.eclipse.jface.viewers.ComboViewer; | |||
| import org.eclipse.jface.viewers.ISelectionChangedListener; | |||
| @@ -16,7 +17,6 @@ import org.eclipse.jface.viewers.StructuredSelection; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.events.SelectionAdapter; | |||
| import org.eclipse.swt.events.SelectionEvent; | |||
| import org.eclipse.swt.graphics.Image; | |||
| import org.eclipse.swt.layout.GridData; | |||
| import org.eclipse.swt.layout.GridLayout; | |||
| import org.eclipse.swt.widgets.Button; | |||
| @@ -65,44 +65,44 @@ public class LoadFromBggPart { | |||
| Composite main = new Composite(parent, SWT.FILL); | |||
| main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| GridLayout layout = new GridLayout(2, false); | |||
| GridLayout layout = new GridLayout(5, false); | |||
| main.setLayout(layout); | |||
| // contains configuration options for download of the bgg thing ID list | |||
| Group dlConfigGroup = new Group(main, SWT.SHADOW_ETCHED_IN); | |||
| GridData configGrid = new GridData(SWT.FILL, SWT.FILL, true, true); | |||
| dlConfigGroup.setText("Configure download..."); | |||
| dlConfigGroup.setLayoutData(configGrid); | |||
| // // contains configuration options for download of the bgg thing ID list | |||
| // Group dlConfigGroup = new Group(main, SWT.SHADOW_ETCHED_IN); | |||
| // GridData configGrid = new GridData(SWT.FILL, SWT.FILL, true, true); | |||
| // dlConfigGroup.setText("Configure filters..."); | |||
| // dlConfigGroup.setLayoutData(configGrid); | |||
| // GridLayout layoutG = new GridLayout(2, false); | |||
| // dlConfigGroup.setLayout(layoutG); | |||
| GridLayout layoutG = new GridLayout(2, false); | |||
| dlConfigGroup.setLayout(layoutG); | |||
| Label lblSource = new Label(dlConfigGroup, SWT.LEFT); | |||
| Label lblSource = new Label(main, SWT.LEFT); | |||
| lblSource.setText("Source: "); | |||
| lblSource.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); | |||
| lblSource.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false)); | |||
| // choose the bgg data source | |||
| ComboViewer cbSource = new ComboViewer(dlConfigGroup, SWT.READ_ONLY); | |||
| ComboViewer cbSource = new ComboViewer(main, SWT.READ_ONLY); | |||
| cbSource.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); | |||
| cbSource.setContentProvider(ArrayContentProvider.getInstance()); | |||
| List<SourceFilter> sources = new ArrayList<SourceFilter>(); | |||
| for(SourceFilter sf : SourceFilter.values()) { | |||
| sources.add(sf); | |||
| } | |||
| cbSource.setInput(sources); | |||
| // TODO: implement all the sources | |||
| cbSource.setSelection(new StructuredSelection(configManager.getResultConfig().source)); | |||
| // listener is configured further below | |||
| makeEmptySpace(main, 1); | |||
| // choose the thing sub-type | |||
| Label lblSubtype = new Label(dlConfigGroup, SWT.LEFT); | |||
| Label lblSubtype = new Label(main, SWT.LEFT); | |||
| lblSubtype.setText("Subtypes: "); | |||
| lblSubtype.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); | |||
| ComboViewer cbSubtypes = new ComboViewer(dlConfigGroup, SWT.READ_ONLY); | |||
| ComboViewer cbSubtypes = new ComboViewer(main, SWT.READ_ONLY); | |||
| cbSubtypes.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| cbSubtypes.setContentProvider(ArrayContentProvider.getInstance()); | |||
| List<Subtype> subtypes = new ArrayList<Subtype>(); | |||
| for (Subtype st : Subtype.values()) { | |||
| @@ -117,32 +117,17 @@ public class LoadFromBggPart { | |||
| eventBroker.send(EventConstants.TOPIC_SUBTYPE_CHANGED, selection.getFirstElement()); | |||
| } | |||
| }); | |||
| // choose action on result list | |||
| Label lblAct = new Label(dlConfigGroup, SWT.LEFT); | |||
| lblAct.setText("Action on result: "); | |||
| lblAct.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); | |||
| ComboViewer cbAct = new ComboViewer(dlConfigGroup, SWT.READ_ONLY); | |||
| cbAct.setContentProvider(ArrayContentProvider.getInstance()); | |||
| List<ResultAction> actions = new ArrayList<ResultAction>(); | |||
| for(ResultAction act : ResultAction.values()) { | |||
| actions.add(act); | |||
| } | |||
| cbAct.setInput(actions); | |||
| cbAct.setSelection(new StructuredSelection(configManager.getResultConfig().action)); | |||
| cbAct.addSelectionChangedListener(new ISelectionChangedListener() { | |||
| @Override | |||
| public void selectionChanged(SelectionChangedEvent event) { | |||
| IStructuredSelection selection = (IStructuredSelection) event.getSelection(); | |||
| eventBroker.send(EventConstants.TOPIC_ACTION_CHANGED, selection.getFirstElement()); | |||
| } | |||
| }); | |||
| // area to display filter controls in | |||
| // next row: | |||
| // area to display filter controls in | |||
| Group gFilters = new Group(main, SWT.SHADOW_ETCHED_IN); | |||
| gFilters.setText(""); | |||
| gFilters.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| GridData gdf = new GridData(SWT.FILL, SWT.FILL, false, false); | |||
| gdf.horizontalSpan = 5; | |||
| gFilters.setLayoutData(gdf); | |||
| showFilter(gFilters, (IStructuredSelection)cbSource.getSelection()); // set content to initial selection | |||
| cbSource.addSelectionChangedListener(new ISelectionChangedListener() { // later, its content will be set via the dropdown | |||
| @@ -156,26 +141,23 @@ public class LoadFromBggPart { | |||
| }); | |||
| // next row: | |||
| makeEmptySpace(main, 5); | |||
| // next row | |||
| Label empty = new Label(main, SWT.LEFT); | |||
| empty.setText(""); | |||
| empty.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| // Start retrieval when download button is pushed | |||
| // choose action on result list | |||
| Button btDownload = new Button(main, SWT.PUSH); | |||
| // TODO: how do I locate icons? | |||
| try { | |||
| Image dlIcon = new Image(getDisplay(), | |||
| getClass().getResourceAsStream("C:\\Users/goya/workspace/icons/icons/material_design/png/download-button.png")); | |||
| btDownload.setImage(dlIcon); | |||
| } | |||
| catch(Exception ex) { | |||
| btDownload.setText("Download now"); | |||
| } | |||
| GridData gd = new GridData(SWT.LEFT, SWT.FILL, false, false); | |||
| gd.horizontalSpan = 2; | |||
| btDownload.setLayoutData(gd); | |||
| btDownload.setText("Fetch"); | |||
| btDownload.addSelectionListener(new SelectionAdapter() { | |||
| @Override | |||
| public void widgetSelected(SelectionEvent e) { | |||
| System.out.println("Downloading " + cbSource.getSelection().toString()); | |||
| eventBroker.send(EventConstants.TOPIC_STATUS, "Fetching " + cbSource.getSelection().toString()); | |||
| ResultConfig resultConfig = configManager.getResultConfig(); | |||
| IStructuredSelection selection = (IStructuredSelection) cbSource.getSelection(); | |||
| @@ -184,7 +166,7 @@ public class LoadFromBggPart { | |||
| if(selection.getFirstElement() == SourceFilter.BGG_USER) { | |||
| String user = resultConfig.user; | |||
| if(user == null || user.isEmpty()) { | |||
| System.out.println("Please enter a user name."); | |||
| MessageDialog.openError(main.getShell(), "", "Please enter a user name."); | |||
| return; | |||
| } else { | |||
| System.out.println("...for user '" + user + "'"); | |||
| @@ -196,7 +178,7 @@ public class LoadFromBggPart { | |||
| } else if(selection.getFirstElement() == SourceFilter.GEEKLIST) { | |||
| Integer geeklistId = resultConfig.geeklistId; | |||
| if(geeklistId == null) { | |||
| System.out.println("Please enter a geeklist id."); | |||
| MessageDialog.openError(main.getShell(), "", "Please enter a geeklist id."); | |||
| return; | |||
| } else { | |||
| System.out.println("...for geeklist id '" + geeklistId + "'"); | |||
| @@ -218,7 +200,46 @@ public class LoadFromBggPart { | |||
| } | |||
| } | |||
| }); | |||
| btDownload.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); | |||
| Label lblAct = new Label(main, SWT.LEFT); | |||
| lblAct.setText("and"); | |||
| lblAct.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false)); | |||
| ComboViewer cbAct = new ComboViewer(main, SWT.READ_ONLY); | |||
| GridData gdact = new GridData(SWT.FILL, SWT.FILL, false, false); | |||
| cbSubtypes.getCombo().setLayoutData(gdact); | |||
| cbAct.setContentProvider(ArrayContentProvider.getInstance()); | |||
| List<ResultAction> actions = new ArrayList<ResultAction>(); | |||
| for(ResultAction act : ResultAction.values()) { | |||
| actions.add(act); | |||
| } | |||
| cbAct.setInput(actions); | |||
| cbAct.setSelection(new StructuredSelection(configManager.getResultConfig().action)); | |||
| cbAct.addSelectionChangedListener(new ISelectionChangedListener() { | |||
| @Override | |||
| public void selectionChanged(SelectionChangedEvent event) { | |||
| IStructuredSelection selection = (IStructuredSelection) event.getSelection(); | |||
| eventBroker.send(EventConstants.TOPIC_ACTION_CHANGED, selection.getFirstElement()); | |||
| } | |||
| }); | |||
| Label toResultLabel = new Label(main, SWT.LEFT); | |||
| toResultLabel.setText("result"); | |||
| toResultLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); | |||
| // // Start retrieval when download button is pushed | |||
| // // TODO: how do I locate icons? | |||
| // Button btDownload = new Button(main, SWT.PUSH); | |||
| // try { | |||
| // Image dlIcon = new Image(getDisplay(), | |||
| // getClass().getResourceAsStream("C:\\Users/goya/workspace/icons/icons/material_design/png/download-button.png")); | |||
| // btDownload.setImage(dlIcon); | |||
| // } | |||
| // catch(Exception ex) { | |||
| // btDownload.setText("Download now"); | |||
| // } | |||
| main.pack(); | |||
| @@ -275,6 +296,15 @@ public class LoadFromBggPart { | |||
| return display; | |||
| } | |||
| public void makeEmptySpace(Composite parent, int span) { | |||
| Label empty = new Label(parent, SWT.LEFT); | |||
| empty.setText(""); | |||
| GridData gde = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); | |||
| if(span > 1) { | |||
| gde.horizontalSpan = span; | |||
| } | |||
| empty.setLayoutData(gde); | |||
| } | |||
| // DISPOSE images! | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package xyz.veronie.bgg.ui.parts; | |||
| import javax.annotation.PostConstruct; | |||
| import javax.inject.Inject; | |||
| import org.eclipse.e4.core.di.annotations.Creatable; | |||
| import org.eclipse.e4.core.di.annotations.Optional; | |||
| import org.eclipse.e4.ui.di.UIEventTopic; | |||
| import org.eclipse.swt.SWT; | |||
| import org.eclipse.swt.widgets.Composite; | |||
| import org.eclipse.swt.widgets.Label; | |||
| import xyz.veronie.bgg.types.EventConstants; | |||
| @Creatable | |||
| public class StatusBar { | |||
| private Label statusLabel; | |||
| private Composite main; | |||
| @PostConstruct | |||
| public void createControls(Composite parent) { | |||
| main = new Composite(parent, SWT.FILL); | |||
| statusLabel = new Label(main, SWT.FILL); | |||
| statusLabel.setText("ASDF"); | |||
| } | |||
| @Inject | |||
| @Optional | |||
| private void subscribeTopicSourceChanged | |||
| (@UIEventTopic(EventConstants.TOPIC_STATUS) | |||
| String text) { | |||
| statusLabel.setText(text); | |||
| main.layout(); | |||
| System.out.println("Status: " + text); | |||
| } | |||
| } | |||