-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nicol
committed
Sep 11, 2023
1 parent
0aa9b74
commit 716d657
Showing
6 changed files
with
104 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.magic.main; | ||
|
||
import java.awt.BorderLayout; | ||
|
||
import javax.swing.JButton; | ||
import javax.swing.JPanel; | ||
|
||
import org.magic.api.interfaces.MTGDao; | ||
import org.magic.gui.abstracts.MTGUIComponent; | ||
import org.magic.services.MTGConstants; | ||
import org.magic.services.MTGControler; | ||
import org.magic.services.tools.MTG; | ||
import org.magic.services.tools.UITools; | ||
|
||
public class ChangeDAO { | ||
public static void main(String[] args) | ||
{ | ||
MTGControler.getInstance().loadAccountsConfiguration(); | ||
|
||
var cbo = UITools.createComboboxPlugins(MTGDao.class, true); | ||
var btnValid = new JButton("Validate"); | ||
|
||
var pane = new JPanel(); | ||
pane.setLayout(new BorderLayout()); | ||
pane.add(cbo,BorderLayout.CENTER); | ||
pane.add(btnValid,BorderLayout.SOUTH); | ||
|
||
|
||
var diag = MTGUIComponent.createJDialog(MTGUIComponent.build(pane, "Change DAO", MTGConstants.ICON_TAB_DAO), false, false); | ||
diag.setVisible(true); | ||
|
||
|
||
btnValid.addActionListener(al->{ | ||
|
||
var selectedProvider = (MTGDao)cbo.getSelectedItem(); | ||
selectedProvider.enable(true); | ||
MTGControler.getInstance().setProperty(selectedProvider, selectedProvider.isEnable()); | ||
|
||
MTG.listPlugins(MTGDao.class).stream().filter(p->p!=selectedProvider).forEach(p->{ | ||
p.enable(false); | ||
MTGControler.getInstance().setProperty(p, p.isEnable()); | ||
}); | ||
|
||
|
||
System.exit(0); | ||
|
||
}); | ||
|
||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
import org.jdesktop.swingx.util.PaintUtils; | ||
import org.magic.api.beans.MagicCollection; | ||
import org.magic.api.beans.MagicEdition; | ||
import org.magic.api.beans.shop.Contact; | ||
import org.magic.services.providers.IconSetProvider; | ||
|
||
import freemarker.template.Configuration; | ||
|
@@ -46,6 +47,22 @@ public static String[] getDefaultCollectionsNames() { | |
return DEFAULT_COLLECTIONS_NAMES; | ||
} | ||
|
||
public static final Contact DEFAULT_CONTACT; | ||
|
||
static { | ||
DEFAULT_CONTACT = new Contact(); | ||
DEFAULT_CONTACT.setId(1); | ||
DEFAULT_CONTACT.setName("MTG"); | ||
DEFAULT_CONTACT.setLastName("Companion"); | ||
DEFAULT_CONTACT.setTelephone("123456789"); | ||
DEFAULT_CONTACT.setAddress("Somewhere"); | ||
DEFAULT_CONTACT.setCity("In the middle of nowhere"); | ||
DEFAULT_CONTACT.setWebsite("https://www.mtgcompanion.org"); | ||
DEFAULT_CONTACT.setEmail("[email protected]"); | ||
DEFAULT_CONTACT.setActive(true); | ||
DEFAULT_CONTACT.setEmailAccept(true); | ||
} | ||
|
||
|
||
//CONFIG FILES CONSTANTS | ||
public static final String MTG_DESKTOP_VERSION_FILE = "/version"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters