	public void initGUI() throws Exception {
		logger.info("init collection GUI");

////////INIT COMPONENTS
		JPanel panneauHaut = new JPanel();
		JButton btnAdd = new JButton(MTGConstants.ICON_NEW);
		JButton btnRefresh = new JButton(MTGConstants.ICON_REFRESH);
		JButton btnRemove = new JButton(MTGConstants.ICON_DELETE);
		JButton btnAddAllSet = new JButton(MTGConstants.ICON_CHECK);
		JButton btnExport = new JButton(MTGConstants.ICON_EXPORT);
		JButton btnMassCollection = new JButton(MTGConstants.ICON_IMPORT);
		JButton btnExportPriceCatalog = new JButton(MTGConstants.ICON_EURO);
		JButton btnGenerateWebSite = new JButton(MTGConstants.ICON_WEBSITE);
		JScrollPane scrollPaneCollections = new JScrollPane();
		JScrollPane scrollPrices = new JScrollPane();
		JSplitPane splitListPanel = new JSplitPane();
		JSplitPane splitPane = new JSplitPane();
		JPanel panneauGauche = new JPanel();
		JScrollPane scrollPane = new JScrollPane();
		JPanel panelTotal = new JPanel();
		JPanel panneauDroite = new JPanel();
		MagicCollectionTableCellRenderer render = new MagicCollectionTableCellRenderer();

		tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		progressBar = new JProgressBar();
		lblTotal = new JLabel();
		magicEditionDetailPanel = new MagicEditionDetailPanel(true,false);
		magicCardDetailPanel = new MagicCardDetailPanel();
		typeRepartitionPanel = new TypeRepartitionPanel();
		manaRepartitionPanel = new ManaRepartitionPanel();
		rarityRepartitionPanel = new RarityRepartitionPanel();
		statsPanel = new CardStockPanel();
		historyPricesPanel = new HistoryPricesPanel();
		jsonPanel = new JSONPanel();
		tree = new LazyLoadingTree();
		tableEditions = new JXTable();

////////MODELS
		model = new MagicEditionsTableModel();
		DefaultRowSorter sorterEditions = new TableRowSorter<DefaultTableModel>(model);
		modelPrices = new CardsPriceTableModel();
		tablePrices = new JXTable(modelPrices);
		model.init(provider.loadEditions());
		tableEditions.setModel(model);
		new TableFilterHeader(tableEditions, AutoChoices.ENABLED);

/////////CONFIGURE COMPONENTS
		splitListPanel.setDividerLocation(0.5);
		splitListPanel.setResizeWeight(0.5);

		progressBar.setVisible(false);
		btnRemove.setEnabled(true);
		btnExport.setEnabled(false);
		btnExportPriceCatalog.setEnabled(false);

		splitPane.setResizeWeight(0.5);
		splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
		scrollPaneCollections.setMinimumSize(new Dimension(0, 0));
		tree.setCellRenderer(new MagicCollectionTreeCellRenderer());
		tablePrices.setColumnControlVisible(true);

		magicCardDetailPanel.setPreferredSize(new Dimension(0, 0));
		magicCardDetailPanel.enableThumbnail(true);

		tableEditions.setDefaultRenderer(Object.class,render);
		tableEditions.setDefaultRenderer(String.class,render);
		tableEditions.setDefaultRenderer(Integer.class, render);
		tableEditions.setDefaultRenderer(double.class, render);
		tableEditions.setRowHeight(25);
		tableEditions.setRowSorter(sorterEditions);

/////////LAYOUT
		setLayout(new BorderLayout(0, 0));
		panneauDroite.setLayout(new BorderLayout());
		panneauGauche.setLayout(new BorderLayout(0, 0));

/////////ADD PANELS
		add(panneauHaut, BorderLayout.NORTH);
		panneauHaut.add(btnAdd);
		panneauHaut.add(btnRefresh);
		panneauHaut.add(btnRemove);
		panneauHaut.add(btnAddAllSet);
		panneauHaut.add(btnMassCollection);
		panneauHaut.add(btnExport);
		panneauHaut.add(btnExportPriceCatalog);
		panneauHaut.add(btnGenerateWebSite);
		panneauHaut.add(progressBar);
		add(splitListPanel, BorderLayout.CENTER);
		splitListPanel.setRightComponent(panneauDroite);
		panneauDroite.add(splitPane, BorderLayout.CENTER);
		splitPane.setLeftComponent(scrollPaneCollections);
		scrollPaneCollections.setViewportView(tree);
		splitPane.setRightComponent(tabbedPane);
		scrollPrices.setViewportView(tablePrices);
		splitListPanel.setLeftComponent(panneauGauche);
		panneauGauche.add(scrollPane);
		scrollPane.setViewportView(tableEditions);
		panneauGauche.add(panelTotal, BorderLayout.SOUTH);
		panelTotal.add(lblTotal);

		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("DETAILS"), null, magicCardDetailPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("CARD_EDITIONS"), null, magicEditionDetailPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("PRICES"), null, scrollPrices, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("CARD_TYPES"), null, typeRepartitionPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("CARD_MANA"), null, manaRepartitionPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("CARD_RARITY"), null, rarityRepartitionPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("STOCK_MODULE"), null, statsPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("PRICE_VARIATIONS"), null, historyPricesPanel, null);

		if(MTGControler.getInstance().get("debug-json-panel").equalsIgnoreCase("true"))
			tabbedPane.addTab("Json", null, jsonPanel, null);

/////////Labels
		lblTotal.setText("Total : " + model.getCountDefaultLibrary() +"/" + model.getCountTotal());
		btnAdd.setToolTipText(MTGControler.getInstance().getLangService().get("COLLECTION_ADD"));
		btnRefresh.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("COLLECTION_REFRESH"));
		btnRemove.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("ITEM_SELECTED_REMOVE"));
		btnAddAllSet.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("COLLECTION_SET_FULL"));
		btnExport.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("EXPORT_AS"));
		btnMassCollection.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("COLLECTION_IMPORT"));
		btnExportPriceCatalog.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("COLLECTION_EXPORT_PRICES"));
		btnGenerateWebSite.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("GENERATE_WEBSITE"));

		List<SortKey> keys = new ArrayList<>();
		SortKey sortKey = new SortKey(3, SortOrder.DESCENDING);//column index 2
		keys.add(sortKey);
		sorterEditions.setSortKeys(keys);

		tableEditions.packAll();

		initPopupCollection();

		tableEditions.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
					int row = tableEditions.getSelectedRow();
					MagicEdition ed = (MagicEdition)tableEditions.getValueAt(row, 1);
					magicEditionDetailPanel.setMagicEdition(ed);
					historyPricesPanel.init(null,ed,ed.getSet());
					jsonPanel.show(ed);
			}
		});

		btnAdd.addActionListener(e->{
				String name = JOptionPane.showInputDialog(MTGControler.getInstance().getLangService().getCapitalize("NAME")+" ?");
				MagicCollection mc = new MagicCollection();
				mc.setName(name);
				try {
					dao.saveCollection(mc);
					((LazyLoadingTree.MyNode)getJTree().getModel().getRoot()).add(new DefaultMutableTreeNode(mc));
					getJTree().refresh();
					initPopupCollection();
				} catch (Exception ex) {
					logger.error(ex);
					JOptionPane.showMessageDialog(null, ex,MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
				}
		});

		btnRefresh.addActionListener(e->{

				ThreadManager.getInstance().execute(() -> {
						progressBar.setVisible(true);
						tree.refresh();
						try {
							model.calculate();
							lblTotal.setText("Total : " + model.getCountDefaultLibrary() +"/" + model.getCountTotal());
						} catch (Exception ex) {
							logger.error(ex);
						}
						model.fireTableDataChanged();
						progressBar.setVisible(false);
				}, "update Tree");
		});

		btnExport.addActionListener(ae-> {
								JPopupMenu menu = new JPopupMenu();

								for(final AbstractCardExport exp : MTGControler.getInstance().getEnabledDeckExports())
								{
									JMenuItem it = new JMenuItem();
									it.setIcon(exp.getIcon());
									it.setText(exp.getName());
									it.addActionListener(arg0->{
											ThreadManager.getInstance().execute(()->{
													try {

														DefaultMutableTreeNode curr = (DefaultMutableTreeNode) path.getLastPathComponent();
														JFileChooser jf = new JFileChooser();

														MagicCollection mc=null;
														MagicEdition ed=null;

														if(curr.getUserObject() instanceof MagicEdition)
														{
															ed = (MagicEdition) curr.getUserObject();
															mc = (MagicCollection)((DefaultMutableTreeNode)curr.getParent()).getUserObject();
														}
														else
														{
															mc = (MagicCollection) curr.getUserObject();
														}

														jf.setSelectedFile(new File(mc.getName()+exp.getFileExtension()));
														int result = jf.showSaveDialog(null);
														File f = jf.getSelectedFile();

														exp.addObserver((Observable o, Object arg)-> progressBar.setValue((int) arg));

														if(result==JFileChooser.APPROVE_OPTION)
														{
															progressBar.setVisible(true);
															if(ed==null)
																exp.export(dao.getCardsFromCollection(mc), f);
															else
																exp.export(dao.getCardsFromCollection(mc,ed), f);

															progressBar.setVisible(false);
															JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().combine("EXPORT","FINISHED"), MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), JOptionPane.INFORMATION_MESSAGE);

														}

													} catch (Exception e) {
														logger.error(e);
														progressBar.setVisible(false);
														JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);
													}
											}, "export collection with " + exp);
									});

									menu.add(it);
								}

								Component b=(Component)ae.getSource();
						        Point p=b.getLocationOnScreen();
						        menu.show(b,0,0);
						        menu.setLocation(p.x,p.y+b.getHeight());

						});

		splitPane.addComponentListener(new ComponentAdapter() {

		      @Override
		      public void componentShown(ComponentEvent componentEvent) {
		        splitPane.setDividerLocation(.5);
		        removeComponentListener(this);
		      }
		    });

		tablePrices.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent ev) {
				if (ev.getClickCount() == 2 && !ev.isConsumed()) {
					ev.consume();
					try {
						String url = tablePrices.getValueAt(tablePrices.getSelectedRow(), 6).toString();
						Desktop.getDesktop().browse(new URI(url));
					} catch (Exception e) {
						logger.error(e);
					}
				}

			}
		});

		tree.addTreeSelectionListener(tse->{
				path = tse.getPath();

				final DefaultMutableTreeNode curr = (DefaultMutableTreeNode) path.getLastPathComponent();

				if(curr.getUserObject() instanceof String)
				{
					btnExport.setEnabled(false);
					btnExportPriceCatalog.setEnabled(false);
					statsPanel.enabledAdd(false);
				}

				if (curr.getUserObject() instanceof MagicCollection)
				{
					btnExport.setEnabled(true);
					btnExportPriceCatalog.setEnabled(true);
					selectedcol = (MagicCollection) curr.getUserObject();
					statsPanel.enabledAdd(false);
					btnExport.setEnabled(true);
					btnExportPriceCatalog.setEnabled(true);
				}

				if(curr.getUserObject() instanceof MagicEdition)
				{
					magicEditionDetailPanel.setMagicEdition((MagicEdition)curr.getUserObject());
					btnExport.setEnabled(true);
					btnExportPriceCatalog.setEnabled(false);
					statsPanel.enabledAdd(false);
					ThreadManager.getInstance().execute(new Runnable() {
						public void run() {
							try{

								MagicCollection c = (MagicCollection)((DefaultMutableTreeNode)curr.getParent()).getUserObject();
								List<MagicCard> list = dao.getCardsFromCollection(c,(MagicEdition)curr.getUserObject());
								rarityRepartitionPanel.init(list);
								typeRepartitionPanel.init(list);
								manaRepartitionPanel.init(list);
								historyPricesPanel.init(null,(MagicEdition)curr.getUserObject(),curr.getUserObject().toString());
								jsonPanel.show(curr.getUserObject());

							}catch(Exception e)
							{
								logger.error(e);
							}
						}
					},"Refresh Collection");
				}

				if (curr.getUserObject() instanceof MagicCard) {
					final MagicCard card = (MagicCard) ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
					btnExport.setEnabled(false);
					btnExportPriceCatalog.setEnabled(false);

					magicCardDetailPanel.setMagicCard((MagicCard)curr.getUserObject());
					magicEditionDetailPanel.setMagicEdition(card.getEditions().get(0));
					magicCardDetailPanel.enableThumbnail(true);
					jsonPanel.show(curr.getUserObject());

					ThreadManager.getInstance().execute(new Runnable() {

						@Override
						public void run() {
							statsPanel.initMagicCardStock(card,(MagicCollection)((DefaultMutableTreeNode)curr.getParent().getParent()).getUserObject() );
							statsPanel.enabledAdd(true);

						}
					},"Update Collection");

					if(tabbedPane.getSelectedIndex()==2)
					{
						loadPrices(card);
					}

					ThreadManager.getInstance().execute(()->{
							try {
								historyPricesPanel.init(card,null,card.getName());
							} catch (Exception e) {
								logger.error(e);
							}
					},"update history");
				}

		});

		tabbedPane.addChangeListener(e-> {
				if(tabbedPane.getSelectedIndex()==2)
					if(((DefaultMutableTreeNode)tree.getLastSelectedPathComponent()).getUserObject() instanceof MagicCard)
						loadPrices((MagicCard)((DefaultMutableTreeNode)tree.getLastSelectedPathComponent()).getUserObject() );
		});

		tree.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if (SwingUtilities.isRightMouseButton(e)) {
					int row = tree.getClosestRowForLocation(e.getX(), e.getY());
					tree.setSelectionRow(row);

					final DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

					if (node.getUserObject() instanceof MagicEdition)
					{
						popupMenuEdition.show(e.getComponent(), e.getX(), e.getY());

					}
					if (node.getUserObject() instanceof MagicCard)
					{
						popupMenuCards.show(e.getComponent(), e.getX(), e.getY());
					}
					if (node.getUserObject() instanceof MagicCollection)
					{
						JPopupMenu p = new JPopupMenu();
						JMenuItem it = new JMenuItem("Mass movement");
						p.add(it);

						it.addActionListener(ae->{
								MassMoverDialog d = new MassMoverDialog((MagicCollection)node.getUserObject(),null);
								d.setVisible(true);
								logger.debug("closing mass import with change =" + d.hasChange());
						});
						p.show(e.getComponent(), e.getX(), e.getY());
					}

				}
			}
		});

		btnMassCollection.addActionListener(ae->{
				new MassCollectionImporterDialog(dao, provider, model.getEditions()).setVisible(true);
				try {
					model.calculate();
				} catch (Exception e) {
				}
				model.fireTableDataChanged();
		});

		btnExportPriceCatalog.addActionListener(ae->{

				ThreadManager.getInstance().execute(new Runnable() {
					public void run() {
						try {
							PriceCatalogExportDialog diag = new PriceCatalogExportDialog(selectedcol);
							diag.setVisible(true);
							if (diag.value())
							{
								progressBar.setVisible(true);
								progressBar.setStringPainted(true);
								progressBar.setMinimum(0);
								progressBar.setMaximum(dao.getCardsCount(selectedcol,null));
								CSVExport exp = new CSVExport();
								exp.addObserver((Observable o, Object arg)->progressBar.setValue((int) arg));
								exp.exportPriceCatalog(dao.getCardsFromCollection(selectedcol), diag.getDest(),diag.getPriceProviders());

								JOptionPane.showMessageDialog(null,MTGControler.getInstance().getLangService().combine("EXPORT","FINISHED"));
								progressBar.setVisible(false);
							}
						} catch (Exception e) {
							logger.error(e);
						}

					}
				},"btnExportPriceCatalog export Prices");
		});

		btnGenerateWebSite.addActionListener(arg0->{

				ThreadManager.getInstance().execute(new Runnable() {
					public void run() {
						try {

							WebSiteGeneratorDialog diag = new WebSiteGeneratorDialog(dao.getCollections());
							diag.setVisible(true);
							if (diag.value() == true) {
								progressBar.setVisible(true);
								progressBar.setStringPainted(true);
								progressBar.setMinimum(0);

								int max = 0;
								for (MagicCollection col : diag.getSelectedCollections())
									max += dao.getCardsCount(col,null);

								progressBar.setMaximum(max);
								progressBar.setValue(0);

								MagicWebSiteGenerator gen = new MagicWebSiteGenerator( diag.getTemplate(),
										diag.getDest().getAbsolutePath());

								gen.addObserver(new Observer() {
									public void update(Observable o, Object arg) {
										progressBar.setValue((int) arg);
									}
								});
								gen.generate(diag.getSelectedCollections(), diag.getPriceProviders());

								int res = JOptionPane.showConfirmDialog(null, MTGControler.getInstance().getLangService().getCapitalize("WEBSITE_CONFIRMATION_VIEW"));

								if (res == JOptionPane.YES_OPTION) {
									// URI uri = new
									// URI("file:///"+diag.getDest().getAbsolutePath()+"/index.htm");
									Path p = Paths.get(diag.getDest().getAbsolutePath() + "/index.htm");
									Desktop.getDesktop().browse(p.toUri());
								}
								progressBar.setVisible(false);
							}

						} catch (Exception e) {
							logger.error("error generating website",e);
							progressBar.setVisible(false);
							JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);
						}

					}
				},"btnGenerateWebSite generate website");
		});

		btnAddAllSet.addActionListener(evt->{
				MagicEdition ed = (MagicEdition) tableEditions.getValueAt(tableEditions.getSelectedRow(), 1);

				int res = JOptionPane.showConfirmDialog(null, MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_COLLECTION_ITEM_ADDITION",ed,MTGControler.getInstance().get("default-library")));

				if (res == JOptionPane.YES_OPTION)
					try {
						List<MagicCard> list = provider.searchCardByCriteria("set", ed.getId(),null,false);
						logger.debug("save " + list.size() +" cards from " + ed.getId());
						for (MagicCard mc : list) {
							MagicCollection col = new MagicCollection();
							col.setName(MTGControler.getInstance().get("default-library"));
							dao.saveCard(mc, col);
						}
						model.calculate();
						model.fireTableDataChanged();
					} catch (Exception e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
						logger.error(e);
					}
		});

		btnRemove.addActionListener(evt->{

				MagicCollection col = (MagicCollection) ((DefaultMutableTreeNode) path.getPathComponent(1)).getUserObject();
				int res = 0;

				DefaultMutableTreeNode curr = (DefaultMutableTreeNode) path.getLastPathComponent();
				if (curr.getUserObject() instanceof MagicCard) {
					MagicCard card = (MagicCard) ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();

					try {
						res = JOptionPane.showConfirmDialog(null,
								MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_COLLECTION_ITEM_DELETE",card,col));
						if (res == JOptionPane.YES_OPTION) {
							dao.removeCard(card, col);
							curr.removeFromParent();
						}
					} catch (SQLException e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
				}
				if (curr.getUserObject() instanceof MagicEdition) {
					MagicEdition me = (MagicEdition) ((DefaultMutableTreeNode) path.getPathComponent(2))
							.getUserObject();

					try {
						res = JOptionPane.showConfirmDialog(null,
								MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_COLLECTION_ITEM_DELETE",me,col));
						if (res == JOptionPane.YES_OPTION) {
							dao.removeEdition(me, col);
							curr.removeFromParent();
						}
					} catch (SQLException e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
				}
				if (curr.getUserObject() instanceof MagicCollection) {
					try {
						res = JOptionPane.showConfirmDialog(null,
								MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_COLLECTION_DELETE",col,dao.getCardsCount(col,null)));
						if (res == JOptionPane.YES_OPTION) {
							dao.removeCollection(col);
							curr.removeFromParent();
						}
					} catch (SQLException e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
				}

				if (res == JOptionPane.YES_OPTION) {
					try {
						model.calculate();
					} catch (Exception e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
					tree.refresh();

				}
		});

	}

	public void initGUI() throws Exception {
		logger.info("init collection GUI");

////////INIT COMPONENTS
		JPanel panneauHaut = new JPanel();
		JButton btnAdd = new JButton(MTGConstants.ICON_NEW);
		JButton btnRefresh = new JButton(MTGConstants.ICON_REFRESH);
		JButton btnRemove = new JButton(MTGConstants.ICON_DELETE);
		JButton btnAddAllSet = new JButton(MTGConstants.ICON_CHECK);
		JButton btnExport = new JButton(MTGConstants.ICON_EXPORT);
		JButton btnMassCollection = new JButton(MTGConstants.ICON_IMPORT);
		JButton btnExportPriceCatalog = new JButton(MTGConstants.ICON_EURO);
		JButton btnGenerateWebSite = new JButton(MTGConstants.ICON_WEBSITE);
		JScrollPane scrollPaneCollections = new JScrollPane();
		JScrollPane scrollPrices = new JScrollPane();
		JSplitPane splitListPanel = new JSplitPane();
		JSplitPane splitPane = new JSplitPane();
		JPanel panneauGauche = new JPanel();
		JScrollPane scrollPane = new JScrollPane();
		JPanel panelTotal = new JPanel();
		JPanel panneauDroite = new JPanel();
		MagicCollectionTableCellRenderer render = new MagicCollectionTableCellRenderer();

		tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		progressBar = new JProgressBar();
		lblTotal = new JLabel();
		magicEditionDetailPanel = new MagicEditionDetailPanel(true,false);
		magicCardDetailPanel = new MagicCardDetailPanel();
		typeRepartitionPanel = new TypeRepartitionPanel();
		manaRepartitionPanel = new ManaRepartitionPanel();
		rarityRepartitionPanel = new RarityRepartitionPanel();
		statsPanel = new CardStockPanel();
		historyPricesPanel = new HistoryPricesPanel();
		jsonPanel = new JSONPanel();
		tree = new LazyLoadingTree();
		tableEditions = new JXTable();

////////MODELS
		model = new MagicEditionsTableModel();
		DefaultRowSorter sorterEditions = new TableRowSorter<DefaultTableModel>(model);
		modelPrices = new CardsPriceTableModel();
		tablePrices = new JXTable(modelPrices);
		model.init(provider.loadEditions());
		tableEditions.setModel(model);
		new TableFilterHeader(tableEditions, AutoChoices.ENABLED);

/////////CONFIGURE COMPONENTS
		splitListPanel.setDividerLocation(0.5);
		splitListPanel.setResizeWeight(0.5);

		progressBar.setVisible(false);
		btnRemove.setEnabled(true);
		btnExport.setEnabled(false);
		btnExportPriceCatalog.setEnabled(false);

		splitPane.setResizeWeight(0.5);
		splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
		scrollPaneCollections.setMinimumSize(new Dimension(0, 0));
		tree.setCellRenderer(new MagicCollectionTreeCellRenderer());
		tablePrices.setColumnControlVisible(true);

		magicCardDetailPanel.setPreferredSize(new Dimension(0, 0));
		magicCardDetailPanel.enableThumbnail(true);

		tableEditions.setDefaultRenderer(Object.class,render);
		tableEditions.setDefaultRenderer(String.class,render);
		tableEditions.setDefaultRenderer(Integer.class, render);
		tableEditions.setDefaultRenderer(double.class, render);
		tableEditions.setRowHeight(25);
		tableEditions.setRowSorter(sorterEditions);

/////////LAYOUT
		setLayout(new BorderLayout(0, 0));
		panneauDroite.setLayout(new BorderLayout());
		panneauGauche.setLayout(new BorderLayout(0, 0));

/////////ADD PANELS
		add(panneauHaut, BorderLayout.NORTH);
		panneauHaut.add(btnAdd);
		panneauHaut.add(btnRefresh);
		panneauHaut.add(btnRemove);
		panneauHaut.add(btnAddAllSet);
		panneauHaut.add(btnMassCollection);
		panneauHaut.add(btnExport);
		panneauHaut.add(btnExportPriceCatalog);
		panneauHaut.add(btnGenerateWebSite);
		panneauHaut.add(progressBar);
		add(splitListPanel, BorderLayout.CENTER);
		splitListPanel.setRightComponent(panneauDroite);
		panneauDroite.add(splitPane, BorderLayout.CENTER);
		splitPane.setLeftComponent(scrollPaneCollections);
		scrollPaneCollections.setViewportView(tree);
		splitPane.setRightComponent(tabbedPane);
		scrollPrices.setViewportView(tablePrices);
		splitListPanel.setLeftComponent(panneauGauche);
		panneauGauche.add(scrollPane);
		scrollPane.setViewportView(tableEditions);
		panneauGauche.add(panelTotal, BorderLayout.SOUTH);
		panelTotal.add(lblTotal);

		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("DETAILS"), null, magicCardDetailPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("CARD_EDITIONS"), null, magicEditionDetailPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("PRICES"), null, scrollPrices, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("CARD_TYPES"), null, typeRepartitionPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("CARD_MANA"), null, manaRepartitionPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("CARD_RARITY"), null, rarityRepartitionPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("STOCK_MODULE"), null, statsPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("PRICE_VARIATIONS"), null, historyPricesPanel, null);

		if(MTGControler.getInstance().get("debug-json-panel").equalsIgnoreCase("true"))
			tabbedPane.addTab("Json", null, jsonPanel, null);

/////////Labels
		lblTotal.setText("Total : " + model.getCountDefaultLibrary() +"/" + model.getCountTotal());
		btnAdd.setToolTipText(MTGControler.getInstance().getLangService().get("COLLECTION_ADD"));
		btnRefresh.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("COLLECTION_REFRESH"));
		btnRemove.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("ITEM_SELECTED_REMOVE"));
		btnAddAllSet.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("COLLECTION_SET_FULL"));
		btnExport.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("EXPORT_AS"));
		btnMassCollection.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("COLLECTION_IMPORT"));
		btnExportPriceCatalog.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("COLLECTION_EXPORT_PRICES"));
		btnGenerateWebSite.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("GENERATE_WEBSITE"));

		List<SortKey> keys = new ArrayList<SortKey>();
		SortKey sortKey = new SortKey(3, SortOrder.DESCENDING);//column index 2
		keys.add(sortKey);
		sorterEditions.setSortKeys(keys);

		tableEditions.packAll();

		initPopupCollection();

		tableEditions.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
					int row = tableEditions.getSelectedRow();
					MagicEdition ed = (MagicEdition)tableEditions.getValueAt(row, 1);
					magicEditionDetailPanel.setMagicEdition(ed);
					historyPricesPanel.init(null,ed,ed.getSet());
					jsonPanel.show(ed);
			}
		});

		btnAdd.addActionListener(e->{
				String name = JOptionPane.showInputDialog(MTGControler.getInstance().getLangService().getCapitalize("NAME")+" ?");
				MagicCollection mc = new MagicCollection();
				mc.setName(name);
				try {
					dao.saveCollection(mc);
					((LazyLoadingTree.MyNode)getJTree().getModel().getRoot()).add(new DefaultMutableTreeNode(mc));
					getJTree().refresh();
					initPopupCollection();
				} catch (Exception ex) {
					logger.error(ex);
					JOptionPane.showMessageDialog(null, ex,MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
				}
		});

		btnRefresh.addActionListener(e->{

				ThreadManager.getInstance().execute(() -> {
						progressBar.setVisible(true);
						tree.refresh();
						try {
							model.calculate();
							lblTotal.setText("Total : " + model.getCountDefaultLibrary() +"/" + model.getCountTotal());
						} catch (Exception ex) {
							logger.error(ex);
						}
						model.fireTableDataChanged();
						progressBar.setVisible(false);
				}, "update Tree");
		});

		btnExport.addActionListener(ae-> {
								JPopupMenu menu = new JPopupMenu();

								for(final AbstractCardExport exp : MTGControler.getInstance().getEnabledDeckExports())
								{
									JMenuItem it = new JMenuItem();
									it.setIcon(exp.getIcon());
									it.setText(exp.getName());
									it.addActionListener(arg0->{
											ThreadManager.getInstance().execute(()->{
													try {

														DefaultMutableTreeNode curr = (DefaultMutableTreeNode) path.getLastPathComponent();
														JFileChooser jf = new JFileChooser();

														MagicCollection mc=null;
														MagicEdition ed=null;

														if(curr.getUserObject() instanceof MagicEdition)
														{
															ed = (MagicEdition) curr.getUserObject();
															mc = (MagicCollection)((DefaultMutableTreeNode)curr.getParent()).getUserObject();
														}
														else
														{
															mc = (MagicCollection) curr.getUserObject();
														}

														jf.setSelectedFile(new File(mc.getName()+exp.getFileExtension()));
														int result = jf.showSaveDialog(null);
														File f = jf.getSelectedFile();

														exp.addObserver((Observable o, Object arg)-> progressBar.setValue((int) arg));

														if(result==JFileChooser.APPROVE_OPTION)
														{
															progressBar.setVisible(true);
															if(ed==null)
																exp.export(dao.getCardsFromCollection(mc), f);
															else
																exp.export(dao.getCardsFromCollection(mc,ed), f);

															progressBar.setVisible(false);
															JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().combine("EXPORT","FINISHED"), MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), JOptionPane.INFORMATION_MESSAGE);

														}

													} catch (Exception e) {
														logger.error(e);
														progressBar.setVisible(false);
														JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);
													}
											}, "export collection with " + exp);
									});

									menu.add(it);
								}

								Component b=(Component)ae.getSource();
						        Point p=b.getLocationOnScreen();
						        menu.show(b,0,0);
						        menu.setLocation(p.x,p.y+b.getHeight());

						});

		splitPane.addComponentListener(new ComponentAdapter() {

		      @Override
		      public void componentShown(ComponentEvent componentEvent) {
		        splitPane.setDividerLocation(.5);
		        removeComponentListener(this);
		      }
		    });

		tablePrices.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent ev) {
				if (ev.getClickCount() == 2 && !ev.isConsumed()) {
					ev.consume();
					try {
						String url = tablePrices.getValueAt(tablePrices.getSelectedRow(), 6).toString();
						Desktop.getDesktop().browse(new URI(url));
					} catch (Exception e) {
						logger.error(e);
					}
				}

			}
		});

		tree.addTreeSelectionListener(tse->{
				path = tse.getPath();

				final DefaultMutableTreeNode curr = (DefaultMutableTreeNode) path.getLastPathComponent();

				if(curr.getUserObject() instanceof String)
				{
					btnExport.setEnabled(false);
					btnExportPriceCatalog.setEnabled(false);
					statsPanel.enabledAdd(false);
				}

				if (curr.getUserObject() instanceof MagicCollection)
				{
					btnExport.setEnabled(true);
					btnExportPriceCatalog.setEnabled(true);
					selectedcol = (MagicCollection) curr.getUserObject();
					statsPanel.enabledAdd(false);
					btnExport.setEnabled(true);
					btnExportPriceCatalog.setEnabled(true);
				}

				if(curr.getUserObject() instanceof MagicEdition)
				{
					magicEditionDetailPanel.setMagicEdition((MagicEdition)curr.getUserObject());
					btnExport.setEnabled(true);
					btnExportPriceCatalog.setEnabled(false);
					statsPanel.enabledAdd(false);
					ThreadManager.getInstance().execute(new Runnable() {
						public void run() {
							try{

								MagicCollection c = (MagicCollection)((DefaultMutableTreeNode)curr.getParent()).getUserObject();
								List<MagicCard> list = dao.getCardsFromCollection(c,(MagicEdition)curr.getUserObject());
								rarityRepartitionPanel.init(list);
								typeRepartitionPanel.init(list);
								manaRepartitionPanel.init(list);
								historyPricesPanel.init(null,(MagicEdition)curr.getUserObject(),curr.getUserObject().toString());
								jsonPanel.show(curr.getUserObject());

							}catch(Exception e)
							{
								logger.error(e);
							}
						}
					},"Refresh Collection");
				}

				if (curr.getUserObject() instanceof MagicCard) {
					final MagicCard card = (MagicCard) ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
					btnExport.setEnabled(false);
					btnExportPriceCatalog.setEnabled(false);

					magicCardDetailPanel.setMagicCard((MagicCard)curr.getUserObject());
					magicEditionDetailPanel.setMagicEdition(card.getEditions().get(0));
					magicCardDetailPanel.enableThumbnail(true);
					jsonPanel.show(curr.getUserObject());

					ThreadManager.getInstance().execute(new Runnable() {

						@Override
						public void run() {
							statsPanel.initMagicCardStock(card,(MagicCollection)((DefaultMutableTreeNode)curr.getParent().getParent()).getUserObject() );
							statsPanel.enabledAdd(true);

						}
					},"Update Collection");

					if(tabbedPane.getSelectedIndex()==2)
					{
						loadPrices(card);
					}

					ThreadManager.getInstance().execute(()->{
							try {
								historyPricesPanel.init(card,null,card.getName());
							} catch (Exception e) {
								logger.error(e);
							}
					},"update history");
				}

		});

		tabbedPane.addChangeListener(e-> {
				if(tabbedPane.getSelectedIndex()==2)
					if(((DefaultMutableTreeNode)tree.getLastSelectedPathComponent()).getUserObject() instanceof MagicCard)
						loadPrices((MagicCard)((DefaultMutableTreeNode)tree.getLastSelectedPathComponent()).getUserObject() );
		});

		tree.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if (SwingUtilities.isRightMouseButton(e)) {
					int row = tree.getClosestRowForLocation(e.getX(), e.getY());
					tree.setSelectionRow(row);

					final DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

					if (node.getUserObject() instanceof MagicEdition)
					{
						popupMenuEdition.show(e.getComponent(), e.getX(), e.getY());

					}
					if (node.getUserObject() instanceof MagicCard)
					{
						popupMenuCards.show(e.getComponent(), e.getX(), e.getY());
					}
					if (node.getUserObject() instanceof MagicCollection)
					{
						JPopupMenu p = new JPopupMenu();
						JMenuItem it = new JMenuItem("Mass movement");
						p.add(it);

						it.addActionListener(ae->{
								MassMoverDialog d = new MassMoverDialog((MagicCollection)node.getUserObject(),null);
								d.setVisible(true);
								logger.debug("closing mass import with change =" + d.hasChange());
						});
						p.show(e.getComponent(), e.getX(), e.getY());
					}

				}
			}
		});

		btnMassCollection.addActionListener(ae->{
				new MassCollectionImporterDialog(dao, provider, model.getEditions()).setVisible(true);
				try {
					model.calculate();
				} catch (Exception e) {
				}
				model.fireTableDataChanged();
		});

		btnExportPriceCatalog.addActionListener(ae->{

				ThreadManager.getInstance().execute(new Runnable() {
					public void run() {
						try {
							PriceCatalogExportDialog diag = new PriceCatalogExportDialog(selectedcol);
							diag.setVisible(true);
							if (diag.value())
							{
								progressBar.setVisible(true);
								progressBar.setStringPainted(true);
								progressBar.setMinimum(0);
								progressBar.setMaximum(dao.getCardsCount(selectedcol,null));
								CSVExport exp = new CSVExport();
								exp.addObserver((Observable o, Object arg)->progressBar.setValue((int) arg));
								exp.exportPriceCatalog(dao.getCardsFromCollection(selectedcol), diag.getDest(),diag.getPriceProviders());

								JOptionPane.showMessageDialog(null,MTGControler.getInstance().getLangService().combine("EXPORT","FINISHED"));
								progressBar.setVisible(false);
							}
						} catch (Exception e) {
							logger.error(e);
						}

					}
				},"btnExportPriceCatalog export Prices");
		});

		btnGenerateWebSite.addActionListener(arg0->{

				ThreadManager.getInstance().execute(new Runnable() {
					public void run() {
						try {

							WebSiteGeneratorDialog diag = new WebSiteGeneratorDialog(dao.getCollections());
							diag.setVisible(true);
							if (diag.value() == true) {
								progressBar.setVisible(true);
								progressBar.setStringPainted(true);
								progressBar.setMinimum(0);

								int max = 0;
								for (MagicCollection col : diag.getSelectedCollections())
									max += dao.getCardsCount(col,null);

								progressBar.setMaximum(max);
								progressBar.setValue(0);

								MagicWebSiteGenerator gen = new MagicWebSiteGenerator( diag.getTemplate(),
										diag.getDest().getAbsolutePath());

								gen.addObserver(new Observer() {
									public void update(Observable o, Object arg) {
										progressBar.setValue((int) arg);
									}
								});
								gen.generate(diag.getSelectedCollections(), diag.getPriceProviders());

								int res = JOptionPane.showConfirmDialog(null, MTGControler.getInstance().getLangService().getCapitalize("WEBSITE_CONFIRMATION_VIEW"));

								if (res == JOptionPane.YES_OPTION) {
									// URI uri = new
									// URI("file:///"+diag.getDest().getAbsolutePath()+"/index.htm");
									Path p = Paths.get(diag.getDest().getAbsolutePath() + "/index.htm");
									Desktop.getDesktop().browse(p.toUri());
								}
								progressBar.setVisible(false);
							}

						} catch (Exception e) {
							logger.error("error generating website",e);
							progressBar.setVisible(false);
							JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);
						}

					}
				},"btnGenerateWebSite generate website");
		});

		btnAddAllSet.addActionListener(evt->{
				MagicEdition ed = (MagicEdition) tableEditions.getValueAt(tableEditions.getSelectedRow(), 1);

				int res = JOptionPane.showConfirmDialog(null, MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_COLLECTION_ITEM_ADDITION",ed,MTGControler.getInstance().get("default-library")));

				if (res == JOptionPane.YES_OPTION)
					try {
						List<MagicCard> list = provider.searchCardByCriteria("set", ed.getId(),null,false);
						logger.debug("save " + list.size() +" cards from " + ed.getId());
						for (MagicCard mc : list) {
							MagicCollection col = new MagicCollection();
							col.setName(MTGControler.getInstance().get("default-library"));
							dao.saveCard(mc, col);
						}
						model.calculate();
						model.fireTableDataChanged();
					} catch (Exception e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
						logger.error(e);
					}
		});

		btnRemove.addActionListener(evt->{

				MagicCollection col = (MagicCollection) ((DefaultMutableTreeNode) path.getPathComponent(1)).getUserObject();
				int res = 0;

				DefaultMutableTreeNode curr = (DefaultMutableTreeNode) path.getLastPathComponent();
				if (curr.getUserObject() instanceof MagicCard) {
					MagicCard card = (MagicCard) ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();

					try {
						res = JOptionPane.showConfirmDialog(null,
								MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_COLLECTION_ITEM_DELETE",card,col));
						if (res == JOptionPane.YES_OPTION) {
							dao.removeCard(card, col);
							curr.removeFromParent();
						}
					} catch (SQLException e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
				}
				if (curr.getUserObject() instanceof MagicEdition) {
					MagicEdition me = (MagicEdition) ((DefaultMutableTreeNode) path.getPathComponent(2))
							.getUserObject();

					try {
						res = JOptionPane.showConfirmDialog(null,
								MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_COLLECTION_ITEM_DELETE",me,col));
						if (res == JOptionPane.YES_OPTION) {
							dao.removeEdition(me, col);
							curr.removeFromParent();
						}
					} catch (SQLException e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
				}
				if (curr.getUserObject() instanceof MagicCollection) {
					try {
						res = JOptionPane.showConfirmDialog(null,
								MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_COLLECTION_DELETE",col,dao.getCardsCount(col,null)));
						if (res == JOptionPane.YES_OPTION) {
							dao.removeCollection(col);
							curr.removeFromParent();
						}
					} catch (SQLException e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
				}

				if (res == JOptionPane.YES_OPTION) {
					try {
						model.calculate();
					} catch (Exception e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
					tree.refresh();

				}
		});

	}

Replace Generic With Diamond ArrayList<SortKey> with ArrayList<> in method public initGUI() : void from class org.magic.gui.CollectionPanelGUI


	public List<MagicPricesProvider> getEnabledPricers()
	{
		List<MagicPricesProvider> pricersE= new ArrayList<>();

		for(MagicPricesProvider p : getPricers())
			if(p.isEnable())
				pricersE.add(p);

		return pricersE;
	}

	public List<MagicPricesProvider> getEnabledPricers()
	{
		List<MagicPricesProvider> pricersE= new ArrayList<MagicPricesProvider>();

		for(MagicPricesProvider p : getPricers())
			if(p.isEnable())
				pricersE.add(p);

		return pricersE;
	}

Replace Generic With Diamond ArrayList<MagicPricesProvider> with ArrayList<> in method public getEnabledPricers() : List<MagicPricesProvider> from class org.magic.services.MTGControler


	public List<DeckSniffer> getEnabledDeckSniffer() {
		List<DeckSniffer> prov= new ArrayList<>();

		for(DeckSniffer p : getDeckSniffers())
			if(p.isEnable())
				prov.add(p);

		return prov;
	}

	public List<DeckSniffer> getEnabledDeckSniffer() {
		List<DeckSniffer> prov= new ArrayList<DeckSniffer>();

		for(DeckSniffer p : getDeckSniffers())
			if(p.isEnable())
				prov.add(p);

		return prov;
	}

Replace Generic With Diamond ArrayList<DeckSniffer> with ArrayList<> in method public getEnabledDeckSniffer() : List<DeckSniffer> from class org.magic.services.MTGControler


	public List<MagicShopper> getEnabledShoppers() {
		List<MagicShopper> enable = new ArrayList<>();
		for(MagicShopper p : getShoppers())
			if(p.isEnable())
				enable.add(p);

		return enable;
	}

	public List<MagicShopper> getEnabledShoppers() {
		List<MagicShopper> enable = new ArrayList<MagicShopper>();
		for(MagicShopper p : getShoppers())
			if(p.isEnable())
				enable.add(p);

		return enable;
	}

Replace Generic With Diamond ArrayList<MagicShopper> with ArrayList<> in method public getEnabledShoppers() : List<MagicShopper> from class org.magic.services.MTGControler


	public List<MTGServer> getEnabledServers() {
		List<MTGServer> enable = new ArrayList<>();
		for(MTGServer p : getServers())
			if(p.isEnable())
				enable.add(p);
		return enable;
	}

	public List<MTGServer> getEnabledServers() {
		List<MTGServer> enable = new ArrayList<MTGServer>();
		for(MTGServer p : getServers())
			if(p.isEnable())
				enable.add(p);
		return enable;
	}

Replace Generic With Diamond ArrayList<MTGServer> with ArrayList<> in method public getEnabledServers() : List<MTGServer> from class org.magic.services.MTGControler


	public List<AbstractCardExport> getEnabledDeckExports() {
		List<AbstractCardExport> enable = new ArrayList<>();
		for(AbstractCardExport p : getDeckExports())
			if(p.isEnable())
				enable.add(p);

		return enable;
	}

	public List<AbstractCardExport> getEnabledDeckExports() {
		List<AbstractCardExport> enable = new ArrayList<AbstractCardExport>();
		for(AbstractCardExport p : getDeckExports())
			if(p.isEnable())
				enable.add(p);

		return enable;
	}

Replace Generic With Diamond ArrayList<AbstractCardExport> with ArrayList<> in method public getEnabledDeckExports() : List<AbstractCardExport> from class org.magic.services.MTGControler


	private void initGUI() {
		JScrollPane scrollList = new JScrollPane();
		JScrollPane scrollEditor = new JScrollPane();

		setLayout(new BorderLayout(0, 0));
		resultListModel= new DefaultListModel<>();

		listResult = new JList<>(resultListModel);
		listResult.setCellRenderer(new MTGStoryListRenderer());
		listResult.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		listResult.addMouseListener(new MouseAdapter() {
			@Override
		    public void mouseClicked(MouseEvent evt) {
		        if (evt.getClickCount() == 1) {
		        	evt.consume();

		        		ThreadManager.getInstance().execute(new Runnable() {

							@Override
							public void run() {
								lblLoading.setVisible(true);
					        	try {
					        		editorPane.setText(Jsoup.connect(listResult.getSelectedValue().getUrl().toString()).get().select("div#content-detail-page-of-an-article").html());

					        	} catch (Exception e) {
									JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
								}
					        	lblLoading.setVisible(false);
							}
						},"Load story");

		        }
		        else
		        {
		        	try {
						Desktop.getDesktop().browse(listResult.getSelectedValue().getUrl().toURI());
					} catch (Exception e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
		        }
		    }
		});

		scrollList.setViewportView(listResult);

		JPanel panel = new JPanel();
		add(panel, BorderLayout.NORTH);

		JButton btnLoadNext = new JButton("Load Next");
		btnLoadNext.addActionListener(ae->initStories());
		panel.add(btnLoadNext);

		lblLoading = new JLabel(MTGConstants.ICON_LOADING);
		lblLoading.setVisible(false);
		panel.add(lblLoading);

		editorPane = new JEditorPane();
		editorPane.setEditable(false);
		editorPane.setContentType("text/html");

			HTMLEditorKit kit = new HTMLEditorKit();
			editorPane.setEditorKit(kit);
			Document doc = kit.createDefaultDocument();
			editorPane.setDocument(doc);
			scrollEditor.setViewportView(editorPane);

		JSplitPane splitPane = new JSplitPane();
		splitPane.setLeftComponent(scrollList);
		splitPane.setRightComponent(scrollEditor);
		add(splitPane, BorderLayout.CENTER);
	}

	private void initGUI() {
		JScrollPane scrollList = new JScrollPane();
		JScrollPane scrollEditor = new JScrollPane();

		setLayout(new BorderLayout(0, 0));
		resultListModel= new DefaultListModel<>();

		listResult = new JList<>(resultListModel);
		listResult.setCellRenderer(new MTGStoryListRenderer());
		listResult.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		listResult.addMouseListener(new MouseAdapter() {
			@Override
		    public void mouseClicked(MouseEvent evt) {
		        if (evt.getClickCount() == 1) {
		        	evt.consume();

		        		ThreadManager.getInstance().execute(new Runnable() {

							@Override
							public void run() {
								lblLoading.setVisible(true);
					        	try {
					        		editorPane.setText(Jsoup.connect(listResult.getSelectedValue().getUrl().toString()).get().select("div#content-detail-page-of-an-article").html());

					        	} catch (Exception e) {
									JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
								}
					        	lblLoading.setVisible(false);
							}
						},"Load story");

		        }
		        else
		        {
		        	try {
						Desktop.getDesktop().browse(listResult.getSelectedValue().getUrl().toURI());
					} catch (Exception e) {
						JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
					}
		        }
		    }
		});

		scrollList.setViewportView(listResult);

		JPanel panel = new JPanel();
		add(panel, BorderLayout.NORTH);

		JButton btnLoadNext = new JButton("Load Next");
		btnLoadNext.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				initStories();
			}
		});
		panel.add(btnLoadNext);

		lblLoading = new JLabel(MTGConstants.ICON_LOADING);
		lblLoading.setVisible(false);
		panel.add(lblLoading);

		editorPane = new JEditorPane();
		editorPane.setEditable(false);
		editorPane.setContentType("text/html");

			HTMLEditorKit kit = new HTMLEditorKit();
			editorPane.setEditorKit(kit);
			Document doc = kit.createDefaultDocument();
			editorPane.setDocument(doc);
			scrollEditor.setViewportView(editorPane);

		JSplitPane splitPane = new JSplitPane();
		splitPane.setLeftComponent(scrollList);
		splitPane.setRightComponent(scrollEditor);
		add(splitPane, BorderLayout.CENTER);
	}

Replace Anonymous With Lambda org.magic.gui.StoriesGUI.initGUI.addActionListener.new ActionListener with ae -> initStories() in method private initGUI() : void from class org.magic.gui.StoriesGUI


	public void initStories()
	{
		ThreadManager.getInstance().execute(()->{
				lblLoading.setVisible(true);

					try {
						for(MTGStory story:provider.next())
							resultListModel.addElement(story);
					}
					catch (IOException e) {
						MTGLogger.printStackTrace(e);
					}
					finally {
						lblLoading.setVisible(false);
					}
		}, "loading stories");
	}

	public void initStories()
	{
		ThreadManager.getInstance().execute(new Runnable() {
			@Override
			public void run() {
				lblLoading.setVisible(true);

					try {
						for(MTGStory story:provider.next())
							resultListModel.addElement(story);
					}
					catch (IOException e) {
						MTGLogger.printStackTrace(e);
					}
					finally {
						lblLoading.setVisible(false);
					}
			}
		}, "loading stories");
	}

Replace Anonymous With Lambda org.magic.gui.StoriesGUI.initStories.execute.new Runnable with () -> {lblLoading.setVisible(true); in method public initStories() : void from class org.magic.gui.StoriesGUI


	public Exile() {
		cards = new ArrayList<>();
	}

	public Exile() {
		cards = new ArrayList<MagicCard>();
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public Exile() from class org.magic.game.model.Exile


	public ManaPool() {
		pool= new HashMap<>();
		addObserver(GamePanelGUI.getInstance().getManaPoolPanel());
	}

	public ManaPool() {
		pool= new HashMap<String,Integer>();
		addObserver(GamePanelGUI.getInstance().getManaPoolPanel());
	}

Replace Generic With Diamond HashMap<String,Integer> with HashMap<> in method public ManaPool() from class org.magic.game.model.ManaPool


	public void init()
	{
		graveyard=new Graveyard();
		exil=new Exile();
		hand=new ArrayList<>();
		library=new Library(deck.getAsList());
		battlefield=new BattleField();
		manaPool = new ManaPool();
		local=Locale.getDefault();
		mixHandAndLibrary();
		shuffleLibrary();
	}

	public void init()
	{
		graveyard=new Graveyard();
		exil=new Exile();
		hand=new ArrayList<MagicCard>();
		library=new Library(deck.getAsList());
		battlefield=new BattleField();
		manaPool = new ManaPool();
		local=Locale.getDefault();
		mixHandAndLibrary();
		shuffleLibrary();
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public init() : void from class org.magic.game.model.Player


	public List<MagicCard> discardCardFromLibrary(int parseInt) {

		List<MagicCard> ret = new ArrayList<>();
		for(int i=0;i<parseInt;i++)
		{
			MagicCard mc = library.getCards().get(i);
			ret.add(mc);
			graveyard.add(mc);
			library.getCards().remove(i);

		}
		logAction("Discard " + parseInt +" cards from library" );
		return ret;

	}

	public List<MagicCard> discardCardFromLibrary(int parseInt) {

		List<MagicCard> ret = new ArrayList<MagicCard>();
		for(int i=0;i<parseInt;i++)
		{
			MagicCard mc = library.getCards().get(i);
			ret.add(mc);
			graveyard.add(mc);
			library.getCards().remove(i);

		}
		logAction("Discard " + parseInt +" cards from library" );
		return ret;

	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public discardCardFromLibrary(parseInt int) : List<MagicCard> from class org.magic.game.model.Player


	public CardTransfertHandler() {

		localObjectFlavor = new ActivationDataFlavor(DisplayableCard.class, DataFlavor.javaJVMLocalObjectMimeType, "DisplayableCard");
		window.add(dragLab);
		window.setBackground(new Color(0,true));

		DragSource.getDefaultDragSource().addDragSourceMotionListener(dsde->{
				Point pt = dsde.getLocation();
					  pt.translate(5, 5);
				window.setLocation(pt);
				window.setVisible(true);
				window.pack();
		});
	}

	public CardTransfertHandler() {

		localObjectFlavor = new ActivationDataFlavor(DisplayableCard.class, DataFlavor.javaJVMLocalObjectMimeType, "DisplayableCard");
		window.add(dragLab);
		window.setBackground(new Color(0,true));

		DragSource.getDefaultDragSource().addDragSourceMotionListener(new DragSourceMotionListener() {
			public void dragMouseMoved(DragSourceDragEvent dsde) {
				Point pt = dsde.getLocation();
					  pt.translate(5, 5); // offset
				window.setLocation(pt);
				window.setVisible(true);
				window.pack();
			}
		});
	}

Replace Anonymous With Lambda org.magic.game.transfert.CardTransfertHandler.CardTransfertHandler.addDragSourceMotionListener.new DragSourceMotionListener with dsde -> {Point pt=dsde.getLocation(); in method public CardTransfertHandler() from class org.magic.game.transfert.CardTransfertHandler


	public void refreshPlayers(IoSession session)
	{
		List<Player> list = new ArrayList<>();
			for(IoSession s : acceptor.getManagedSessions().values())
			{
				if(session.getId()!=((Player)s.getAttribute("PLAYER")).getId())
					list.add((Player)s.getAttribute("PLAYER"));
			}

		session.write(new ListPlayersAction(list));
	}

	public void refreshPlayers(IoSession session)
	{
		List<Player> list = new ArrayList<Player>();
			for(IoSession s : acceptor.getManagedSessions().values())
			{
				if(session.getId()!=((Player)s.getAttribute("PLAYER")).getId())
					list.add((Player)s.getAttribute("PLAYER"));
			}

		session.write(new ListPlayersAction(list));
	}

Replace Generic With Diamond ArrayList<Player> with ArrayList<> in method public refreshPlayers(session IoSession) : void from class org.magic.servers.impl.MTGGameRoomServer


	public List<MagicCard> getUniqueCards()
	{
		return new ArrayList<>(deck.getMap().keySet());
	}

	public List<MagicCard> getUniqueCards()
	{
		return new ArrayList<MagicCard>(deck.getMap().keySet());
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public getUniqueCards() : List<MagicCard> from class org.magic.tools.DeckCalculator


	public Set<MagicFormat> getLegality() {
		Set<MagicFormat> cmap = new LinkedHashSet<>();
		for(MagicCard mc : mapDeck.keySet())
		{
			for(MagicFormat mf : mc.getLegalities())
			{
				cmap.add(mf);
			}
		}
		return cmap;
	}

	public Set<MagicFormat> getLegality() {
		Set<MagicFormat> cmap = new LinkedHashSet<MagicFormat>();
		for(MagicCard mc : mapDeck.keySet())
		{
			for(MagicFormat mf : mc.getLegalities())
			{
				cmap.add(mf);
			}
		}
		return cmap;
	}

Replace Generic With Diamond LinkedHashSet<MagicFormat> with LinkedHashSet<> in method public getLegality() : Set<MagicFormat> from class org.magic.api.beans.MagicDeck


	public List<MagicCard> getAsList()
	{
		ArrayList<MagicCard> deck = new ArrayList<>();

		for(MagicCard c : mapDeck.keySet())
			for(int i=0;i<mapDeck.get(c);i++)
				deck.add(c);
		return deck;
	}

	public List<MagicCard> getAsList()
	{
		ArrayList<MagicCard> deck = new ArrayList<MagicCard>();

		for(MagicCard c : mapDeck.keySet())
			for(int i=0;i<mapDeck.get(c);i++)
				deck.add(c);
		return deck;
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public getAsList() : List<MagicCard> from class org.magic.api.beans.MagicDeck


	public List<MagicCard> getSideAsList()
	{
		ArrayList<MagicCard> deck = new ArrayList<>();

		for(MagicCard c : mapSideBoard.keySet())
			for(int i=0;i<mapSideBoard.get(c);i++)
				deck.add(c);
		return deck;
	}

	public List<MagicCard> getSideAsList()
	{
		ArrayList<MagicCard> deck = new ArrayList<MagicCard>();

		for(MagicCard c : mapSideBoard.keySet())
			for(int i=0;i<mapSideBoard.get(c);i++)
				deck.add(c);
		return deck;
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public getSideAsList() : List<MagicCard> from class org.magic.api.beans.MagicDeck


	public MagicEdition() {
		booster=new ArrayList<>();
	}

	public MagicEdition() {
		booster=new ArrayList<Object>();
	}

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method public MagicEdition() from class org.magic.api.beans.MagicEdition


	public RetrievableDeck() {
		keycards = new ArrayList<>();
	}

	public RetrievableDeck() {
		keycards = new ArrayList<String>();
	}

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public RetrievableDeck() from class org.magic.api.beans.RetrievableDeck


	public void updatePicture()
	{
			ThreadManager.getInstance().execute(()->{
				try {
					panel.removeAll();
					for(int i=0;i<4;i++)
					{
						JLabel lab = new JLabel();
						MagicCard mc =  (MagicCard)magicDeck.getMap().keySet().toArray()[i];
						lab.setIcon(new ImageIcon(MTGControler.getInstance().getEnabledPicturesProvider().extractPicture(mc)));
						lab.setToolTipText(mc.getName());
						panel.add(lab);
					}
					panel.revalidate();
					panel.repaint();

				} catch (Exception e) {
					MTGLogger.printStackTrace(e);
				}
		}, "extract deck pictures");
	}

	public void updatePicture()
	{
			ThreadManager.getInstance().execute(new Runnable() {

			@Override
			public void run() {
				try {
					panel.removeAll();
					for(int i=0;i<4;i++)
					{
						JLabel lab = new JLabel();
						MagicCard mc =  (MagicCard)magicDeck.getMap().keySet().toArray()[i];
						lab.setIcon(new ImageIcon(MTGControler.getInstance().getEnabledPicturesProvider().extractPicture(mc)));
						lab.setToolTipText(mc.getName());
						panel.add(lab);
					}
					panel.revalidate();
					panel.repaint();

				} catch (Exception e) {

				}
			}
		}, "extract deck pictures");
	}

Replace Anonymous With Lambda org.magic.gui.components.DeckDetailsPanel.updatePicture.execute.new Runnable with () -> {trypanel.removeAll(); in method public updatePicture() : void from class org.magic.gui.components.DeckDetailsPanel


	@Override
	public List<MagicCardAlert> getAlerts() {

		try{
				if(list!=null)
					return list;

				try(PreparedStatement pst=con.prepareStatement("select * from alerts");ResultSet rs = pst.executeQuery();)
				{
					list = new ArrayList<>();

					while(rs.next())
					{
						MagicCardAlert alert = new MagicCardAlert();
									   alert.setCard((MagicCard)rs.getObject(cardField));
									   alert.setId(rs.getString("id"));
									   alert.setPrice(rs.getDouble("amount"));
						   list.add(alert);
					}
					return list;
				}
		}
		catch(Exception e)
		{
			return new ArrayList<>();
		}

	}

	@Override
	public List<MagicCardAlert> getAlerts() {

		try{

				if(list!=null)
					return list;

				PreparedStatement pst=con.prepareStatement("select * from alerts");
				list = new ArrayList<>();
				ResultSet rs = pst.executeQuery();
				while(rs.next())
				{
					MagicCardAlert alert = new MagicCardAlert();
								   alert.setCard((MagicCard)rs.getObject(cardField));
								   alert.setId(rs.getString("id"));
								   alert.setPrice(rs.getDouble("amount"));
					   list.add(alert);
				}
				return list;
		}
		catch(Exception e)
		{
			return new ArrayList<>();
		}

	}

Try With Resources try(PreparedStatement pst=con.prepareStatement("select * from alerts"); ResultSet rs=pst.executeQuery()) in method public getAlerts() : List<MagicCardAlert> from class org.magic.api.dao.impl.HsqlDAO


	@Override
	public boolean hasAlert(MagicCard mc) {

		try(PreparedStatement pst=con.prepareStatement("select * from alerts where id=?"))
		{
			pst.setString(1, IDGenerator.generate(mc));
			try(ResultSet rs = pst.executeQuery())
			{
				return rs.next();
			}
		}
		catch(Exception e)
		{
			logger.error(e);
			return false;
		}
	}

	@Override
	public boolean hasAlert(MagicCard mc) {
		try
		{
				PreparedStatement pst=con.prepareStatement("select * from alerts where id=?");
				pst.setString(1, IDGenerator.generate(mc));
				ResultSet rs = pst.executeQuery();
				return rs.next();
		}catch(Exception e)
		{
			return false;
		}

	}

Try With Resources try(PreparedStatement pst=con.prepareStatement("select * from alerts where id=?")) in method public hasAlert(mc MagicCard) : boolean from class org.magic.api.dao.impl.HsqlDAO


	 public boolean createDB()
	 {
		 try(Statement stat=con.createStatement())
		 {
		 	logger.debug("Create table Cards");
		 	stat.executeUpdate("create table cards (ID varchar(250),name varchar(250), mcard bytea, edition varchar(20), cardprovider varchar(50),collection varchar(250))");
		 	logger.debug("Create table Shop");
		 	stat.executeUpdate("create table shop (id varchar(250), statut varchar(250))");
		 	logger.debug("Create table collections");
		 	stat.executeUpdate("CREATE TABLE collections ( name VARCHAR(250))");
		 	logger.debug("Create table stocks");
		 	stat.executeUpdate("create table stocks (idstock SERIAL PRIMARY KEY , idmc varchar(250), collection varchar(250),comments varchar(250), conditions varchar(50),foil boolean, signedcard boolean, langage varchar(50), qte integer,mcard bytea,altered boolean,price decimal)");
		 	logger.debug("Create table Alerts");
		 	stat.executeUpdate("create table alerts (id varchar(250), mcard bytea, amount decimal)");

		 	logger.debug("populate collections");
		 	stat.executeUpdate("insert into collections values ('Library')");
		 	stat.executeUpdate("insert into collections values ('Needed')");
		 	stat.executeUpdate("insert into collections values ('For sell')");
		 	stat.executeUpdate("insert into collections values ('Favorites')");
		 	return true;
		 }
		 catch(SQLException e)
		 {
			 logger.debug(e);
			 return false;
		 }

	 }

	 public boolean createDB()
	 {
		 try{
		 	logger.debug("Create table Cards");
		 	con.createStatement().executeUpdate("create table cards (ID varchar(250),name varchar(250), mcard bytea, edition varchar(20), cardprovider varchar(50),collection varchar(250))");
		 	logger.debug("Create table Shop");
		 	con.createStatement().executeUpdate("create table shop (id varchar(250), statut varchar(250))");
		 	logger.debug("Create table collections");
		 	con.createStatement().executeUpdate("CREATE TABLE collections ( name VARCHAR(250))");
		 	logger.debug("Create table stocks");
		 	con.createStatement().executeUpdate("create table stocks (idstock SERIAL PRIMARY KEY , idmc varchar(250), collection varchar(250),comments varchar(250), conditions varchar(50),foil boolean, signedcard boolean, langage varchar(50), qte integer,mcard bytea,altered boolean,price decimal)");
		 	logger.debug("Create table Alerts");
		 	con.createStatement().executeUpdate("create table alerts (id varchar(250), mcard bytea, amount decimal)");

		 	logger.debug("populate collections");
		 	con.createStatement().executeUpdate("insert into collections values ('Library')");
		 	con.createStatement().executeUpdate("insert into collections values ('Needed')");
		 	con.createStatement().executeUpdate("insert into collections values ('For sell')");
		 	con.createStatement().executeUpdate("insert into collections values ('Favorites')");

		 	return true;
		 }
		 catch(SQLException e)
		 {
			 logger.debug(e);
			 return false;
		 }

	 }

Try With Resources try(Statement stat=con.createStatement()) in method public createDB() : boolean from class org.magic.api.dao.impl.PostgresqlDAO


		@Override
		public void saveCard(MagicCard mc, MagicCollection collection) throws SQLException {
			logger.debug("saving " + mc +" in " + collection);
			try( PreparedStatement pst = con.prepareStatement("insert into cards values (?,?,?,?,?,?)");)
			{
			 pst.setString(1, IDGenerator.generate(mc));
			 pst.setString(2, mc.getName());
			 pst.setBinaryStream(3, convertObject(mc));
			 pst.setString(4, mc.getEditions().get(0).getId());
			 pst.setString(5, MTGControler.getInstance().getEnabledProviders().toString());
			 pst.setString(6, collection.getName());
			 pst.executeUpdate();
			}
		}

		@Override
		public void saveCard(MagicCard mc, MagicCollection collection) throws SQLException {
			logger.debug("saving " + mc +" in " + collection);
			try{

			PreparedStatement pst = con.prepareStatement("insert into cards values (?,?,?,?,?,?)");
			 pst.setString(1, IDGenerator.generate(mc));
			 pst.setString(2, mc.getName());
			 pst.setBinaryStream(3, convertObject(mc));
			 pst.setString(4, mc.getEditions().get(0).getId());
			 pst.setString(5, MTGControler.getInstance().getEnabledProviders().toString());
			 pst.setString(6, collection.getName());

			 pst.executeUpdate();
			}
			catch(Exception e)
			{
				logger.error("Error saving " + mc + " in " + collection,e);
			}
		}

Try With Resources try(PreparedStatement pst=con.prepareStatement("insert into cards values (?,?,?,?,?,?)")) in method public saveCard(mc MagicCard, collection MagicCollection) : void from class org.magic.api.dao.impl.PostgresqlDAO


		@Override
		public List<MagicCardAlert> getAlerts()  {

			try(PreparedStatement pst=con.prepareStatement("select * from alerts");	ResultSet rs = pst.executeQuery();)
			{
			list = new ArrayList<>();
			while(rs.next())
			{

					MagicCardAlert alert = new MagicCardAlert();
								   alert.setCard(readObject(MagicCard.class, rs.getBinaryStream("mcard")));
								   alert.setId(rs.getString("id"));
								   alert.setPrice(rs.getDouble("amount"));

								   list.add(alert);
			}
			return list;

			}catch(Exception e)
			{
				logger.error(e);
				return new ArrayList<>();
			}
		}

		@Override
		public List<MagicCardAlert> getAlerts()  {

			try{

			PreparedStatement pst=con.prepareStatement("select * from alerts");
			list = new ArrayList<>();
			ResultSet rs = pst.executeQuery();
			while(rs.next())
			{

					MagicCardAlert alert = new MagicCardAlert();
								   alert.setCard(readObject(MagicCard.class, rs.getBinaryStream("mcard")));
								   alert.setId(rs.getString("id"));
								   alert.setPrice(rs.getDouble("amount"));

								   list.add(alert);
			}
			return list;

			}catch(Exception e)
			{
				logger.error(e);
				return new ArrayList<>();
			}
		}

Try With Resources try(PreparedStatement pst=con.prepareStatement("select * from alerts"); ResultSet rs=pst.executeQuery()) in method public getAlerts() : List<MagicCardAlert> from class org.magic.api.dao.impl.PostgresqlDAO


		@Override
		public boolean hasAlert(MagicCard mc) {
			try(PreparedStatement pst=con.prepareStatement("select * from alerts where id=?"))
			{
					pst.setString(1, IDGenerator.generate(mc));
					try(ResultSet rs = pst.executeQuery())
					{
						return rs.next();
					}
			}catch(Exception e)
			{
				return false;
			}

		}

		@Override
		public boolean hasAlert(MagicCard mc) {
			try
			{
					PreparedStatement pst=con.prepareStatement("select * from alerts where id=?");
					pst.setString(1, IDGenerator.generate(mc));
					ResultSet rs = pst.executeQuery();
					return rs.next();
			}catch(Exception e)
			{
				return false;
			}

		}

Try With Resources try(PreparedStatement pst=con.prepareStatement("select * from alerts where id=?")) in method public hasAlert(mc MagicCard) : boolean from class org.magic.api.dao.impl.PostgresqlDAO


            @Override
            protected List<MyNode> doInBackground() throws Exception {

                List<MyNode> children = new ArrayList<>();
                for(MagicCollection c : MTGControler.getInstance().getEnabledDAO().getCollections())
                {
                	MyNode n = new MyNode(c);
                	children.add(n);
            	}
                return children;
            }

            @Override
            protected List<MyNode> doInBackground() throws Exception {

                List<MyNode> children = new ArrayList<LazyLoadingTree.MyNode>();
                for(MagicCollection c : MTGControler.getInstance().getEnabledDAO().getCollections())
                {
                	MyNode n = new MyNode(c);
                	children.add(n);
            	}
                return children;
            }

Replace Generic With Diamond ArrayList<LazyLoadingTree.MyNode> with ArrayList<> in method protected doInBackground() : List<MyNode> from class org.magic.gui.components.LazyLoadingTree.MyNode.loadCollection.worker.new SwingWorker<List<MyNode>,Void>


	private void loadCollection() {
		SwingWorker<List<MyNode>, Void> worker = new SwingWorker<List<MyNode>, Void>() {
            @Override
            protected List<MyNode> doInBackground() throws Exception {

                List<MyNode> children = new ArrayList<>();
                for(MagicCollection c : MTGControler.getInstance().getEnabledDAO().getCollections())
                {
                	MyNode n = new MyNode(c);
                	children.add(n);
            	}
                return children;
            }

            @Override
            protected void done() {
                try {
                    setChildren(get());
                    model.nodeStructureChanged(MyNode.this);
                } catch (Exception e) {
                    MTGLogger.printStackTrace(e);
                }
                super.done();
            }
        };
        worker.execute();

	}

	private void loadCollection() {
		SwingWorker<List<MyNode>, Void> worker = new SwingWorker<List<MyNode>, Void>() {
            @Override
            protected List<MyNode> doInBackground() throws Exception {

                List<MyNode> children = new ArrayList<LazyLoadingTree.MyNode>();
                for(MagicCollection c : MTGControler.getInstance().getEnabledDAO().getCollections())
                {
                	MyNode n = new MyNode(c);
                	children.add(n);
            	}
                return children;
            }

            @Override
            protected void done() {
                try {
                    setChildren(get());
                    model.nodeStructureChanged(MyNode.this);
                } catch (Exception e) {
                    MTGLogger.printStackTrace(e);
                }
                super.done();
            }
        };
        worker.execute();

	}

Replace Generic With Diamond ArrayList<LazyLoadingTree.MyNode> with ArrayList<> in method private loadCollection() : void from class org.magic.gui.components.LazyLoadingTree.MyNode


            @Override
            protected List<MyNode> doInBackground() {
            	logger.debug("loading cards from " + col+"/"+ed);

                List<MyNode> children = new ArrayList<>();
                try {
                	List<MagicCard> res = MTGControler.getInstance().getEnabledDAO().getCardsFromCollection(col, ed);
                	Collections.sort(res,new MagicCardComparator());

					for(MagicCard card : res)
					{
						MyNode n = new MyNode(card);
						children.add(n);
					}
				} catch (SQLException e) {
					logger.error("unknow edition " + ed.getId());
				}
                return children;
            }

            @Override
            protected List<MyNode> doInBackground() {
            	logger.debug("loading cards from " + col+"/"+ed);

                List<MyNode> children = new ArrayList<LazyLoadingTree.MyNode>();
                try {
                	List<MagicCard> res = MTGControler.getInstance().getEnabledDAO().getCardsFromCollection(col, ed);
                	Collections.sort(res,new MagicCardComparator());

					for(MagicCard card : res)
					{
						MyNode n = new MyNode(card);
						children.add(n);
					}
				} catch (SQLException e) {
					logger.error("unknow edition " + ed.getId());
				}
                return children;
            }

Replace Generic With Diamond ArrayList<LazyLoadingTree.MyNode> with ArrayList<> in method protected doInBackground() : List<MyNode> from class org.magic.gui.components.LazyLoadingTree.MyNode.loadCardsFromEdition.worker.new SwingWorker<List<MyNode>,Void>


	private void loadCardsFromEdition(final MagicCollection col, final MagicEdition ed) {

        SwingWorker<List<MyNode>, Void> worker = new SwingWorker<List<MyNode>, Void>() {
            @Override
            protected List<MyNode> doInBackground() {
            	logger.debug("loading cards from " + col+"/"+ed);

                List<MyNode> children = new ArrayList<>();
                try {
                	List<MagicCard> res = MTGControler.getInstance().getEnabledDAO().getCardsFromCollection(col, ed);
                	Collections.sort(res,new MagicCardComparator());

					for(MagicCard card : res)
					{
						MyNode n = new MyNode(card);
						children.add(n);
					}
				} catch (SQLException e) {
					logger.error("unknow edition " + ed.getId());
				}
                return children;
            }

            @Override
            protected void done() {
                try {
                	logger.debug("loading cards from " + col+"/"+ed +" done");
                    setChildren(get());
                    model.nodeStructureChanged(MyNode.this);
                } catch (Exception e) {
                    MTGLogger.printStackTrace(e);
                }
                super.done();
            }
        };
        worker.execute();

	}

	private void loadCardsFromEdition(final MagicCollection col, final MagicEdition ed) {

        SwingWorker<List<MyNode>, Void> worker = new SwingWorker<List<MyNode>, Void>() {
            @Override
            protected List<MyNode> doInBackground() {
            	logger.debug("loading cards from " + col+"/"+ed);

                List<MyNode> children = new ArrayList<LazyLoadingTree.MyNode>();
                try {
                	List<MagicCard> res = MTGControler.getInstance().getEnabledDAO().getCardsFromCollection(col, ed);
                	Collections.sort(res,new MagicCardComparator());

					for(MagicCard card : res)
					{
						MyNode n = new MyNode(card);
						children.add(n);
					}
				} catch (SQLException e) {
					logger.error("unknow edition " + ed.getId());
				}
                return children;
            }

            @Override
            protected void done() {
                try {
                	logger.debug("loading cards from " + col+"/"+ed +" done");
                    setChildren(get());
                    model.nodeStructureChanged(MyNode.this);
                } catch (Exception e) {
                    MTGLogger.printStackTrace(e);
                }
                super.done();
            }
        };
        worker.execute();

	}

Replace Generic With Diamond ArrayList<LazyLoadingTree.MyNode> with ArrayList<> in method private loadCardsFromEdition(col MagicCollection, ed MagicEdition) : void from class org.magic.gui.components.LazyLoadingTree.MyNode


            @Override
            protected List<MyNode> doInBackground() throws Exception {
            	logger.debug("loading editions from " + c);
                List<MyNode> children = new ArrayList<>();
                for(String ed : MTGControler.getInstance().getEnabledDAO().getEditionsIDFromCollection(c))
                {
                	MyNode n = new MyNode(MTGControler.getInstance().getEnabledProviders().getSetById(ed));
                	children.add(n);
            	}
               Collections.sort(children);
                return children;
            }

            @Override
            protected List<MyNode> doInBackground() throws Exception {
            	logger.debug("loading editions from " + c);
                List<MyNode> children = new ArrayList<LazyLoadingTree.MyNode>();
                for(String ed : MTGControler.getInstance().getEnabledDAO().getEditionsIDFromCollection(c))
                {
                	MyNode n = new MyNode(MTGControler.getInstance().getEnabledProviders().getSetById(ed));
                	children.add(n);
            	}
               Collections.sort(children);
                return children;
            }

Replace Generic With Diamond ArrayList<LazyLoadingTree.MyNode> with ArrayList<> in method protected doInBackground() : List<MyNode> from class org.magic.gui.components.LazyLoadingTree.MyNode.loadEditionFromCollection.worker.new SwingWorker<List<MyNode>,Void>


	private void loadEditionFromCollection(final MagicCollection c) {

        SwingWorker<List<MyNode>, Void> worker = new SwingWorker<List<MyNode>, Void>() {
            @Override
            protected List<MyNode> doInBackground() throws Exception {
            	logger.debug("loading editions from " + c);
                List<MyNode> children = new ArrayList<>();
                for(String ed : MTGControler.getInstance().getEnabledDAO().getEditionsIDFromCollection(c))
                {
                	MyNode n = new MyNode(MTGControler.getInstance().getEnabledProviders().getSetById(ed));
                	children.add(n);
            	}
               Collections.sort(children);
                return children;
            }

            @Override
            protected void done() {
                try {
                	logger.debug("loading editions from " + c +  " done");
                    setChildren(get());
                    model.nodeStructureChanged(MyNode.this);
                } catch (Exception e) {
                    MTGLogger.printStackTrace(e);
                }
                super.done();
            }
        };
        worker.execute();

	}

	private void loadEditionFromCollection(final MagicCollection c) {

        SwingWorker<List<MyNode>, Void> worker = new SwingWorker<List<MyNode>, Void>() {
            @Override
            protected List<MyNode> doInBackground() throws Exception {
            	logger.debug("loading editions from " + c);
                List<MyNode> children = new ArrayList<LazyLoadingTree.MyNode>();
                for(String ed : MTGControler.getInstance().getEnabledDAO().getEditionsIDFromCollection(c))
                {
                	MyNode n = new MyNode(MTGControler.getInstance().getEnabledProviders().getSetById(ed));
                	children.add(n);
            	}
               Collections.sort(children);
                return children;
            }

            @Override
            protected void done() {
                try {
                	logger.debug("loading editions from " + c +  " done");
                    setChildren(get());
                    model.nodeStructureChanged(MyNode.this);
                } catch (Exception e) {
                    MTGLogger.printStackTrace(e);
                }
                super.done();
            }
        };
        worker.execute();

	}

Replace Generic With Diamond ArrayList<LazyLoadingTree.MyNode> with ArrayList<> in method private loadEditionFromCollection(c MagicCollection) : void from class org.magic.gui.components.LazyLoadingTree.MyNode


	public Graveyard() {
		cards = new ArrayList<>();
	}

	public Graveyard() {
		cards = new ArrayList<MagicCard>();
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public Graveyard() from class org.magic.game.model.Graveyard


	public void init(MagicDeck deck) {
		cards = new ArrayList<>();
		try{
			for(Entry<MagicCard, Integer> cci : deck.getMap().entrySet())
			{
				MagicCard mc = cci.getKey();
				for(int i=0;i<cci.getValue();i++)
					cards.add(mc);
			}
		}catch(Exception e)
		{

		}
		refresh();
	}

	public void init(MagicDeck deck) {
		cards = new ArrayList<MagicCard>();
		try{
			for(Entry<MagicCard, Integer> cci : deck.getMap().entrySet())
			{
				MagicCard mc = cci.getKey();
				for(int i=0;i<cci.getValue();i++)
					cards.add(mc);
			}
		}catch(Exception e)
		{

		}
		refresh();
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public init(deck MagicDeck) : void from class org.magic.gui.components.charts.ManaRepartitionPanel


	public void init(MagicDeck deck) {
		cards = new ArrayList<>();
		if(deck!=null)
			if(deck.getMap()!=null)
				for(Entry<MagicCard, Integer> cci : deck.getMap().entrySet())
				{
					MagicCard mc = cci.getKey();
					for(int i=0;i<cci.getValue();i++)
						cards.add(mc);
				}

		refresh();
	}

	public void init(MagicDeck deck) {
		cards = new ArrayList<MagicCard>();
		if(deck!=null)
			if(deck.getMap()!=null)
				for(Entry<MagicCard, Integer> cci : deck.getMap().entrySet())
				{
					MagicCard mc = cci.getKey();
					for(int i=0;i<cci.getValue();i++)
						cards.add(mc);
				}

		refresh();
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public init(deck MagicDeck) : void from class org.magic.gui.components.charts.RarityRepartitionPanel


	public void init(MagicDeck deck) {
		cards = new ArrayList<>();

		if(deck!=null)
		for(Entry<MagicCard, Integer> cci : deck.getMap().entrySet())
		{
			MagicCard mc = cci.getKey();
			for(int i=0;i<cci.getValue();i++)
				cards.add(mc);
		}
		refresh();
	}

	public void init(MagicDeck deck) {
		cards = new ArrayList<MagicCard>();

		if(deck!=null)
		for(Entry<MagicCard, Integer> cci : deck.getMap().entrySet())
		{
			MagicCard mc = cci.getKey();
			for(int i=0;i<cci.getValue();i++)
				cards.add(mc);
		}
		refresh();
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public init(deck MagicDeck) : void from class org.magic.gui.components.charts.TypeRepartitionPanel


	public CardSearchImportDialog() {
		getContentPane().setLayout(new BorderLayout(0, 0));
		setModal(true);
		selectCard = new JButton(MTGConstants.ICON_IMPORT);
		cardSearchPanel = new CardSearchPanel();

		selectCard.addActionListener(e->dispose());

		getContentPane().add(cardSearchPanel, BorderLayout.CENTER);
		getContentPane().add(selectCard, BorderLayout.SOUTH);

		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		pack();
	}

	public CardSearchImportDialog() {
		getContentPane().setLayout(new BorderLayout(0, 0));
		setModal(true);
		selectCard = new JButton(MTGConstants.ICON_IMPORT);
		cardSearchPanel = new CardSearchPanel();

		selectCard.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});

		getContentPane().add(cardSearchPanel, BorderLayout.CENTER);
		getContentPane().add(selectCard, BorderLayout.SOUTH);

		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		pack();
	}

Replace Anonymous With Lambda org.magic.gui.components.dialog.CardSearchImportDialog.CardSearchImportDialog.addActionListener.new ActionListener with e -> dispose() in method public CardSearchImportDialog() from class org.magic.gui.components.dialog.CardSearchImportDialog


	private void initGUI() throws SQLException {
		getContentPane().setLayout(new BorderLayout(0, 0));

		JPanel panelCollectionInput = new JPanel();
		getContentPane().add(panelCollectionInput, BorderLayout.NORTH);

		JLabel lblImport = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("IMPORT")+" ");
		panelCollectionInput.add(lblImport);

		final JComboBox cboEditions = new JComboBox(list.toArray());
		cboEditions.setRenderer(new MagicEditionListRenderer());
		panelCollectionInput.add(cboEditions);

		List lc = dao.getCollections();

		JLabel lblNewLabel = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("BY"));
		panelCollectionInput.add(lblNewLabel);

		final JComboBox<String> cboByType = new JComboBox<>();
		cboByType.setModel(new DefaultComboBoxModel<String>(new String[] {"number", "name"}));
		panelCollectionInput.add(cboByType);

		JLabel lblIn = new JLabel("in");
		panelCollectionInput.add(lblIn);
		final JComboBox cboCollections = new JComboBox(lc.toArray());
		panelCollectionInput.add(cboCollections);

		JPanel panneauBas = new JPanel();
		getContentPane().add(panneauBas, BorderLayout.SOUTH);
		final JProgressBar progressBar = new JProgressBar();
		progressBar.setStringPainted(true);

		final JCheckBox checkNewOne = new JCheckBox(MTGControler.getInstance().getLangService().getCapitalize("IMPORT_OTHER_SERIE"));

		JButton btnInverse = new JButton("Inverse");
		btnInverse.addActionListener(e-> {
				MagicEdition ed = (MagicEdition)cboEditions.getSelectedItem();
				int max = ed.getCardCount();
				List<String> elements = Arrays.asList(txtNumbersInput.getText().replaceAll("\n", " ").replaceAll("  ", " ").trim().split(" "));
				List<String> edList = new ArrayList<>();
				for(int i=1;i<=max;i++)
					edList.add(String.valueOf(i));

				edList.removeAll(elements);

				StringBuilder temp = new StringBuilder();
				for(String s : edList)
					temp.append(s).append(" ");

				txtNumbersInput.setText(temp.toString());
		});
		panneauBas.add(btnInverse);

		panneauBas.add(checkNewOne);

		JButton btnImport = new JButton(MTGControler.getInstance().getLangService().getCapitalize("IMPORT"));
		btnImport.addActionListener(e->{
				final MagicEdition ed = (MagicEdition)cboEditions.getSelectedItem();
				final MagicCollection col = (MagicCollection)cboCollections.getSelectedItem();

				if(cboByType.getSelectedItem().equals("number"))
					ids = txtNumbersInput.getText().replaceAll("\n", " ").replaceAll("  ", " ").trim().split(" ");
				else
					ids = txtNumbersInput.getText().split("\n");
				progressBar.setMaximum(ids.length);

				ThreadManager.getInstance().execute(()->{
						int i=1;
						for(String id : ids)
						{
							try {
								MagicCard mc = null;

								if(cboByType.getSelectedItem().toString().equalsIgnoreCase("number"))
									mc=provider.getCardByNumber(id, ed);
								else
									mc=provider.searchCardByCriteria("name", id.replaceAll("\n", " ").replaceAll("  ", " ").trim(),(MagicEdition)cboEditions.getSelectedItem(),true).get(0);

								dao.saveCard(mc, col);
								progressBar.setValue(i++);
							} catch (Exception e1) {
								MTGLogger.printStackTrace(e1);
							}
						}
						JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().getCapitalize("X_ITEMS_IMPORTED",ids.length),MTGControler.getInstance().getLangService().getCapitalize("FINISHED"),JOptionPane.INFORMATION_MESSAGE);
						if(!checkNewOne.isSelected())
						{
							setVisible(false);
							progressBar.setValue(0);
						}
				},"btnImport importCards");
		});
		panneauBas.add(btnImport);

		panneauBas.add(progressBar);

		txtNumbersInput = new JTextPane();

		JScrollPane scrollPane = new JScrollPane();
		getContentPane().add(scrollPane, BorderLayout.CENTER);
		scrollPane.setViewportView(txtNumbersInput);

		setModal(true);
		setLocationRelativeTo(null);

	}

	private void initGUI() throws Exception {
		getContentPane().setLayout(new BorderLayout(0, 0));

		JPanel panelCollectionInput = new JPanel();
		getContentPane().add(panelCollectionInput, BorderLayout.NORTH);

		JLabel lblImport = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("IMPORT")+" ");
		panelCollectionInput.add(lblImport);

		final JComboBox cboEditions = new JComboBox(list.toArray());
		cboEditions.setRenderer(new MagicEditionListRenderer());
		panelCollectionInput.add(cboEditions);

		List lc = dao.getCollections();

		JLabel lblNewLabel = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("BY"));
		panelCollectionInput.add(lblNewLabel);

		final JComboBox cboByType = new JComboBox();
		cboByType.setModel(new DefaultComboBoxModel<String>(new String[] {"number", "name"}));
		panelCollectionInput.add(cboByType);

		JLabel lblIn = new JLabel("in");
		panelCollectionInput.add(lblIn);
		final JComboBox cboCollections = new JComboBox(lc.toArray());
		panelCollectionInput.add(cboCollections);

		JPanel panneauBas = new JPanel();
		getContentPane().add(panneauBas, BorderLayout.SOUTH);
		final JProgressBar progressBar = new JProgressBar();
		progressBar.setStringPainted(true);

		final JCheckBox checkNewOne = new JCheckBox(MTGControler.getInstance().getLangService().getCapitalize("IMPORT_OTHER_SERIE"));

		JButton btnInverse = new JButton("Inverse");
		btnInverse.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {

				MagicEdition ed = (MagicEdition)cboEditions.getSelectedItem();
				int max = ed.getCardCount();
				List<String> ids = Arrays.asList(txtNumbersInput.getText().replaceAll("\n", " ").replaceAll("  ", " ").trim().split(" "));
				List<String> edList = new ArrayList<>();
				for(int i=1;i<=max;i++)
					edList.add(String.valueOf(i));

				edList.removeAll(ids);

				StringBuilder temp = new StringBuilder();
				for(String s : edList)
					temp.append(s).append(" ");

				txtNumbersInput.setText(temp.toString());

			}
		});
		panneauBas.add(btnInverse);

		panneauBas.add(checkNewOne);

		JButton btnImport = new JButton(MTGControler.getInstance().getLangService().getCapitalize("IMPORT"));
		btnImport.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				final MagicEdition ed = (MagicEdition)cboEditions.getSelectedItem();
				final MagicCollection col = (MagicCollection)cboCollections.getSelectedItem();

				if(cboByType.getSelectedItem().equals("number"))
					ids = txtNumbersInput.getText().replaceAll("\n", " ").replaceAll("  ", " ").trim().split(" ");
				else
					ids = txtNumbersInput.getText().split("\n");
				progressBar.setMaximum(ids.length);

				ThreadManager.getInstance().execute(new Runnable() {

					@Override
					public void run() {
						int i=1;
						for(String id : ids)
						{
							try {
								MagicCard mc = null;

								if(cboByType.getSelectedItem().toString().equalsIgnoreCase("number"))
									mc=provider.getCardByNumber(id, ed);
								else
									mc=provider.searchCardByCriteria("name", id.replaceAll("\n", " ").replaceAll("  ", " ").trim(),(MagicEdition)cboEditions.getSelectedItem(),true).get(0);

								dao.saveCard(mc, col);
								progressBar.setValue(i++);
							} catch (Exception e1) {
								MTGLogger.printStackTrace(e1);
							}
						}
						JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().getCapitalize("X_ITEMS_IMPORTED",ids.length),MTGControler.getInstance().getLangService().getCapitalize("FINISHED"),JOptionPane.INFORMATION_MESSAGE);
						if(!checkNewOne.isSelected())
						{
							setVisible(false);
							progressBar.setValue(0);
						}

					}
				},"btnImport importCards");

			}
		});
		panneauBas.add(btnImport);

		panneauBas.add(progressBar);

		txtNumbersInput = new JTextPane();

		JScrollPane scrollPane = new JScrollPane();
		getContentPane().add(scrollPane, BorderLayout.CENTER);
		scrollPane.setViewportView(txtNumbersInput);

		setModal(true);
		setLocationRelativeTo(null);

	}

Replace Anonymous With Lambda org.magic.gui.components.dialog.MassCollectionImporterDialog.initGUI.addActionListener.new ActionListener with e -> {final MagicEdition ed=(MagicEdition)cboEditions.getSelectedItem(); in method private initGUI() : void from class org.magic.gui.components.dialog.MassCollectionImporterDialog