Commit ee753674 authored by SAPONE Alann's avatar SAPONE Alann

help menu v1

parent 71a9cb3e
......@@ -96,9 +96,7 @@ import org.cnrs.lam.dis.etc.ui.swing.dataset.DatasetManagementTool;
import org.cnrs.lam.dis.etc.ui.swing.generic.ClosableTabComponent;
import org.cnrs.lam.dis.etc.ui.swing.generic.MultiSelectDialog;
import org.cnrs.lam.dis.etc.ui.swing.help.AboutDialog;
import org.cnrs.lam.dis.etc.ui.swing.help.ContactDialog;
import org.cnrs.lam.dis.etc.ui.swing.help.ContributionDialog;
import org.cnrs.lam.dis.etc.ui.swing.help.LicenseDialog;
import org.cnrs.lam.dis.etc.ui.swing.importer.MultiImportTool;
import org.cnrs.lam.dis.etc.ui.swing.result.ChartsTabbedPane;
import org.cnrs.lam.dis.etc.ui.swing.result.ImagesTabbedPane;
......@@ -243,8 +241,6 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
helpMenu = new javax.swing.JMenu();
helpMenuItem = new javax.swing.JMenuItem();
contributionMenuItem = new javax.swing.JMenuItem();
licenseMenuItem = new javax.swing.JMenuItem();
contactMenuItem = new javax.swing.JMenuItem();
aboutMenuItem = new javax.swing.JMenuItem();
fileChooser.setName("fileChooser"); // NOI18N
......@@ -258,6 +254,11 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/cnrs/lam/dis/etc/ui/swing/messages"); // NOI18N
setTitle(bundle.getString("ETC_FRAME_TITLE")); // NOI18N
// MAC app name
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", bundle.getString("ETC_FRAME_TITLE"));
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/cnrs/lam/dis/etc/ui/swing/images/Etc-small.png")));
setName("etcFrame"); // NOI18N
addWindowListener(new java.awt.event.WindowAdapter() {
......@@ -566,8 +567,8 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
});
helpMenu.add(helpMenuItem);
contributionMenuItem.setText("Contribution"); // NOI18N
contributionMenuItem.setName("contributionMenuItem"); // NOI18N
contributionMenuItem.setText("Contribute"); // NOI18N
contributionMenuItem.setName("contributeMenuItem"); // NOI18N
contributionMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
......@@ -576,26 +577,6 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
});
helpMenu.add(contributionMenuItem);
licenseMenuItem.setText("License"); // NOI18N
licenseMenuItem.setName("licenseMenuItem"); // NOI18N
licenseMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
LicenseDialog.show(EtcFrame.this);
}
});
helpMenu.add(licenseMenuItem);
contactMenuItem.setText("Contact"); // NOI18N
contactMenuItem.setName("contactMenuItem"); // NOI18N
contactMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
ContactDialog.show(EtcFrame.this);
}
});
helpMenu.add(contactMenuItem);
aboutMenuItem.setText("About"); // NOI18N
aboutMenuItem.setName("aboutMenuItem"); // NOI18N
aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
......@@ -933,8 +914,6 @@ private void OptionsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//G
private javax.swing.JMenu helpMenu;
private javax.swing.JMenuItem helpMenuItem;
private javax.swing.JMenuItem contributionMenuItem;
private javax.swing.JMenuItem licenseMenuItem;
private javax.swing.JMenuItem contactMenuItem;
private javax.swing.JMenuItem aboutMenuItem;
// End of variables declaration//GEN-END:variables
......
......@@ -2,20 +2,18 @@ package org.cnrs.lam.dis.etc.ui.swing.help;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Font;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
......@@ -24,88 +22,221 @@ import javax.swing.border.EmptyBorder;
import org.cnrs.lam.dis.etc.configuration.ConfigFactory;
public class AboutDialog extends HelpDialog {
private static final long serialVersionUID = -679981628077230532L;
private static AboutDialog instance = null;
public final static String LICENSE_URL = "http://www.cecill.info/licences/Licence_CeCILL_V2.1-fr.html";
public final static String CONTACT_URL = "etc42@lam.fr";
private final static String[] authors = {
"C. Surace",
"N. Apostolakos",
"P.Y. Chabaud",
"A. Gross",
"J. Penguen",
"A. Sapone"
};
private final static String[] contributors = {
"J.G. Cuby",
"V. Le Brun",
"G. Leleu",
"J. Liu"
};
private JLabel logoLamLabel;
private JLabel logoCesamLabel;
private String formatList(String[] list, int lineBreakIndex) {
String listString = "";
for (int i = 0; i < list.length; i++) {
String item = list[i];
listString += item;
if (i < list.length - 1) {
listString += ", ";
}
if ( (i+1) % lineBreakIndex == 0) {
listString += "<br>";
}
}
return listString;
}
public AboutDialog(JFrame parent) {
super(parent, "About ETC-42");
JPanel wrapper = new JPanel();
wrapper.setLayout(new BoxLayout(wrapper, BoxLayout.PAGE_AXIS));
getContentPane().remove(buttonPane);
// LogoETC
Image logoImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/cnrs/lam/dis/etc/ui/swing/images/Etc-big.png"));
ImageIcon logo = new ImageIcon(logoImage.getScaledInstance(200, 200, Image.SCALE_SMOOTH));
ImageIcon logo = new ImageIcon(logoImage.getScaledInstance(120, 120, Image.SCALE_SMOOTH));
JLabel logoLabel = new JLabel(logo);
logoLabel.setBorder(new EmptyBorder(30, 30, 30, 30));
logoLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
wrapper.add(logoLabel);
// Title
JLabel title = new JLabel("ETC-42 Version: " + ConfigFactory.getConfig().getVersion());
title.setAlignmentX(Component.CENTER_ALIGNMENT);
Font font = title.getFont();
Font boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize());
title.setFont(boldFont);
title.setBorder(new EmptyBorder(0, 30, 30, 30));
wrapper.add(title);
// Content
JLabel content = new JLabel("Content");
content.setAlignmentX(Component.CENTER_ALIGNMENT);
content.setBorder(new EmptyBorder(15, 30, 15, 30));
// wrapper.add(content);
Box horizontalLogoGroup = Box.createHorizontalBox();
// LogoLAM
Image logoLamImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/cnrs/lam/dis/etc/ui/swing/images/LAM.jpg"));
ImageIcon logoLam = new ImageIcon(logoLamImage.getScaledInstance(110, 35, Image.SCALE_SMOOTH));
JLabel logoLamLabel = new JLabel(logoLam);
logoLamLabel = new JLabel(logoLam);
logoLamLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
logoLamLabel.setBorder(new EmptyBorder(5, 5, 5, 5 * 3));
logoLamLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
logoLamLabel.setBorder(new EmptyBorder(0, 0, 0, 30));
logoLamLabel.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
BrowserLoader.openWebpage(new URL("https://www.lam.fr/"));
UtilsLoader.openWebpage(new URL("https://www.lam.fr/"));
} catch (MalformedURLException e1) {}
}
});
horizontalLogoGroup.add(logoLamLabel);
// LogoCesam
Image logoCesamImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/cnrs/lam/dis/etc/ui/swing/images/Cesam.png"));
ImageIcon logoCesam = new ImageIcon(logoCesamImage.getScaledInstance(61, 35, Image.SCALE_SMOOTH));
logoCesamLabel = new JLabel(logoCesam);
logoCesamLabel.setAlignmentX(Component.RIGHT_ALIGNMENT);
logoCesamLabel.setBorder(new EmptyBorder(5, 5 * 3, 5, 5));
logoCesamLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
logoCesamLabel.setBorder(new EmptyBorder(0, 30, 0, 0));
logoCesamLabel.addMouseListener(new MouseAdapter()
{
@Override
@Override
public void mouseClicked(MouseEvent e)
{
try {
BrowserLoader.openWebpage(new URL("https://www.lam.fr/cesam/"));
UtilsLoader.openWebpage(new URL("https://www.lam.fr/cesam/"));
} catch (MalformedURLException e1) {}
}
});
// Title
JLabel titleLabel = new JLabel("ETC-42 Version: " + ConfigFactory.getConfig().getVersion());
Font font = titleLabel.getFont();
Font boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize());
titleLabel.setFont(boldFont);
horizontalLogoGroup.add(logoCesamLabel);
wrapper.add(horizontalLogoGroup);
// Licence
JLabel distributedLabel = new JLabel("Distributed under ");
distributedLabel.setAlignmentX(LEFT_ALIGNMENT);
String htmlLicenceURL = "<html><a href=\"" + LICENSE_URL + "\">CeCILL</a></html>";
JLabel licenceURLLabel = new JLabel(htmlLicenceURL);
licenceURLLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
licenceURLLabel.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
UtilsLoader.openWebpage(new URL(LICENSE_URL));
} catch (MalformedURLException e1) {}
}
});
// Authors
String authorsString = formatList(authors, 3);
JLabel authorsLabel = new JLabel("<html><b>Authors:</b> " + authorsString + "</html>");
authorsLabel.setAlignmentX(LEFT_ALIGNMENT);
authorsLabel.setBorder(new EmptyBorder(15, 0, 15, 0));
String contributorsString = formatList(contributors, 4);
JLabel contributorsLabel = new JLabel("<html><b>Contributors:</b> " + contributorsString + "</html>");
contributorsLabel.setAlignmentX(LEFT_ALIGNMENT);
// contact
JLabel contactLabel = new JLabel("Contact: ");
contactLabel.setAlignmentX(LEFT_ALIGNMENT);
Font fontContact = contactLabel.getFont();
Font boldFontContact = new Font(fontContact.getFontName(), Font.BOLD, fontContact.getSize());
contactLabel.setFont(boldFontContact);
String contactURL = "<html><a href=\"" + CONTACT_URL + "\">"+ CONTACT_URL +"</a></html>";
JLabel contactUrlLabel = new JLabel(contactURL);
contactUrlLabel.setAlignmentX(LEFT_ALIGNMENT);
contactUrlLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
contactUrlLabel.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
UtilsLoader.openMail(new URL(CONTACT_URL));
} catch (MalformedURLException e1) {}
}
});
// Panels
JPanel wrapper = new JPanel();
BoxLayout layout = new BoxLayout(wrapper, BoxLayout.LINE_AXIS);
wrapper.setLayout(layout);
wrapper.setBorder(new EmptyBorder(15, 15, 15, 15));
Box logosPane = Box.createHorizontalBox();
logosPane.add(logoLamLabel);
logosPane.add(logoCesamLabel);
logosPane.setBorder(new EmptyBorder(30, 30, 0, 30));
JPanel leftPane = new JPanel();
leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
leftPane.add(logoLabel);
leftPane.add(logosPane);
leftPane.setAlignmentY(CENTER_ALIGNMENT);
JPanel licensePane = new JPanel();
licensePane.setLayout(new BoxLayout(licensePane, BoxLayout.LINE_AXIS));
licensePane.add(distributedLabel);
licensePane.add(licenceURLLabel);
licensePane.setAlignmentX(LEFT_ALIGNMENT);
JPanel contactPane = new JPanel();
contactPane.setLayout(new BoxLayout(contactPane, BoxLayout.LINE_AXIS));
contactPane.setBorder(new EmptyBorder(15, 0, 15, 0));
contactPane.add(contactLabel);
contactPane.add(contactUrlLabel);
contactPane.setAlignmentX(LEFT_ALIGNMENT);
JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
contentPane.setAlignmentY(CENTER_ALIGNMENT);
contentPane.setAlignmentX(LEFT_ALIGNMENT);
titleLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(titleLabel);
licensePane.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(licensePane);
authorsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(authorsLabel);
contributorsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(contributorsLabel);
contactPane.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(contactPane);
wrapper.add(leftPane);
wrapper.add(contentPane);
getContentPane().add(wrapper);
// Contribute link from about
JButton contributeButton = new JButton("Contribute");
final JFrame dialogOwner = new JFrame();
dialogOwner.setLocationRelativeTo(this);
contributeButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
ContributionDialog.show(dialogOwner);
}
});
this.buttonPane.add(contributeButton);
JPanel buttonPaneWrapper = new JPanel();
buttonPaneWrapper.add(buttonPane);
buttonPaneWrapper.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(buttonPaneWrapper);
pack();
}
public static void show(JFrame parent) {
instance = new AboutDialog(parent);
if (instance == null) {
......
package org.cnrs.lam.dis.etc.ui.swing.help;
import javax.swing.JFrame;
public class ContactDialog extends HelpDialog {
private static final long serialVersionUID = -3651195093944644615L;
private static ContactDialog instance = null;
public ContactDialog(JFrame parent) {
super(parent, "Contact",
"<b>Contact:</b><br>" +
"etc42@lam.fr"
);
}
public static void show(JFrame parent) {
instance = new ContactDialog(parent);
if (instance == null) {
}
instance.setVisible(true);
}
}
package org.cnrs.lam.dis.etc.ui.swing.help;
import java.awt.Cursor;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
public class ContributionDialog extends HelpDialog {
private static final long serialVersionUID = 3773082265462219174L;
private static ContributionDialog instance = null;
private final static String[] authors = {
"C. Surace",
"N. Apostolakos",
"P.Y. Chabaud",
"A. Gross",
"J. Penguen",
"A. Sapone"
};
private final static String[] contributors = {
"J.G. Cuby",
"V. Le Brun",
"G. Leleu",
"J. Liu"
};
private final static String intro =
"We are always looking for contributors.<br>"
+ "Do not hesitate to contact us !<br><br>";
private final static String SOURCE_URL = "https://gitlab.lam.fr/etc42/ETC42";
public ContributionDialog(JFrame parent) {
super(parent, "Contribution",
"<div style='text-align: center;'>" +
intro +
"<b>Authors:</b><br>" +
String.join(", <br>", authors) + "<br><br>" +
"<b>Contributors:</b><br>" +
String.join(", <br>", contributors) + "<br>" +
"</div>"
);
super(parent, "Contribute");
JPanel wrapper = new JPanel();
wrapper.setLayout(new BoxLayout(wrapper, BoxLayout.PAGE_AXIS));
wrapper.setBorder(new EmptyBorder(15, 15, 15, 15));
JPanel important = new JPanel();
important.setLayout(new BoxLayout(important, BoxLayout.Y_AXIS));
important.setBorder(BorderFactory.createTitledBorder("Important"));
String intro = "<html><div style='text-align: center;'>We are looking for contributors.<br> Please, do not hesitate to contact us at:</div><br></html>";
JLabel introLabel = new JLabel(intro, SwingConstants.CENTER);
important.add(introLabel);
String htmlContactURL = "<html><div style='text-align: center;'><a href=''>"+ AboutDialog.CONTACT_URL +"</a></div></html>";
JLabel contactUrlLabel = new JLabel(htmlContactURL, SwingConstants.CENTER);
contactUrlLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
contactUrlLabel.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
UtilsLoader.openMail(new URL(AboutDialog.CONTACT_URL));
} catch (MalformedURLException e1) {}
}
});
important.add(contactUrlLabel);
important.setAlignmentX(LEFT_ALIGNMENT);
wrapper.add(important);
// Code source linking
String source = "<html><div style='text-align: center;'><br>You can download and contribute to the ETC-42 codebase<br>by accessing the project repository:</div><br></html>";
JLabel sourceLabel = new JLabel(source, SwingConstants.CENTER);
sourceLabel.setBorder(new EmptyBorder(10, 0, 0, 0));
wrapper.add(sourceLabel);
String htmlSourceURL = "<html><div style='text-align: center;'><a href=''>" + SOURCE_URL + "</a></div></html>";
JLabel sourceURLLabel = new JLabel(htmlSourceURL, SwingConstants.CENTER);
sourceURLLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
sourceURLLabel.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
UtilsLoader.openWebpage(new URL(SOURCE_URL));
} catch (MalformedURLException e1) {}
}
});
wrapper.add(sourceURLLabel);
getContentPane().add(wrapper);
pack();
}
public static void show(JFrame parent) {
......
......@@ -6,7 +6,6 @@ import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
......@@ -17,11 +16,12 @@ import javax.swing.SwingConstants;
public class HelpDialog extends JDialog implements ActionListener {
private static final long serialVersionUID = 690722433853815375L;
protected JPanel buttonPane = new JPanel();
public HelpDialog(JFrame parent, String title) {
super(parent, title, true);
JPanel buttonPane = new JPanel();
JButton okButton = new JButton("OK");
buttonPane.add(okButton);
getContentPane().add(buttonPane, BorderLayout.SOUTH);
......
package org.cnrs.lam.dis.etc.ui.swing.help;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
public class LicenseDialog extends HelpDialog {
private static final long serialVersionUID = -2828109863960281086L;
private static LicenseDialog instance = null;
private final static String LICENSE_URL = "http://www.cecill.info/licences/Licence_CeCILL_V2.1-fr.html";
private final static String SOURCE_URL = "https://gitlab.lam.fr/etc42/ETC42";
public LicenseDialog(JFrame parent) {
super(parent, "License");
JPanel wrapper = new JPanel();
wrapper.setLayout(new BoxLayout(wrapper, BoxLayout.PAGE_AXIS));
wrapper.setBorder(new EmptyBorder(5, 5, 5, 5));
// Distribution linking
String distributed = "Distributed under CeCILL:";
JLabel distributedLabel = new JLabel(distributed);
distributedLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
wrapper.add(distributedLabel);
String htmlLicenceURL = "<html><a href=\"" + LICENSE_URL + "\">" + LICENSE_URL + "</a></html>";
JLabel licenceURLLabel = new JLabel(htmlLicenceURL);
licenceURLLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
licenceURLLabel.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
BrowserLoader.openWebpage(new URL(LICENSE_URL));
} catch (MalformedURLException e1) {}
}
});
wrapper.add(licenceURLLabel);
// Code source linking
String source = "Code source is avaliable here:";
JLabel sourceLabel = new JLabel(source);
sourceLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
sourceLabel.setBorder(new EmptyBorder(10, 0, 0, 0));
wrapper.add(sourceLabel);
String htmlSourceURL = "<html><a href=\"" + SOURCE_URL + "\">" + SOURCE_URL + "</a></html>";
JLabel sourceURLLabel = new JLabel(htmlSourceURL);
sourceURLLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
sourceURLLabel.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
BrowserLoader.openWebpage(new URL(SOURCE_URL));
} catch (MalformedURLException e1) {}
}
});
wrapper.add(sourceURLLabel);
getContentPane().add(wrapper);
pack();
}
public static void show(JFrame parent) {
instance = new LicenseDialog(parent);
if (instance == null) {
}
instance.setVisible(true);
}
}
package org.cnrs.lam.dis.etc.ui.swing.help;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;