Commit 71a9cb3e authored by SAPONE Alann's avatar SAPONE Alann

added help menu

parent b6279dca
......@@ -31,7 +31,7 @@ org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
......@@ -64,7 +64,7 @@ org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariable
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
......@@ -79,7 +79,7 @@ org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
......
......@@ -55,12 +55,12 @@ import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import javax.swing.Box;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import org.apache.log4j.Logger;
import org.cnrs.lam.cesam.vo.dnd.VoTable1DHelper;
......@@ -95,7 +95,10 @@ import org.cnrs.lam.dis.etc.ui.swing.config.ConfigurationDialogTool;
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;
......@@ -121,7 +124,6 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
private ImagesTabbedPane imagesTabbedPane = new ImagesTabbedPane();
private CommandHistoryPanel commandHistoryPanel = new CommandHistoryPanel();
private ChartsTabbedPane chartsTabbedPane = new ChartsTabbedPane();
private ContributionDialog contributionDialog;
/** Creates new form EtcFrame */
public EtcFrame() {
......@@ -569,8 +571,7 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
contributionMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
contributionDialog = new ContributionDialog(EtcFrame.this);
contributionDialog.setVisible(true);
ContributionDialog.show(EtcFrame.this);
}
});
helpMenu.add(contributionMenuItem);
......@@ -579,8 +580,8 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
licenseMenuItem.setName("licenseMenuItem"); // NOI18N
licenseMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
System.out.println("License ok");
public void actionPerformed(java.awt.event.ActionEvent evt) {
LicenseDialog.show(EtcFrame.this);
}
});
helpMenu.add(licenseMenuItem);
......@@ -589,8 +590,8 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
contactMenuItem.setName("contactMenuItem"); // NOI18N
contactMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
System.out.println("Contact ok");
public void actionPerformed(java.awt.event.ActionEvent evt) {
ContactDialog.show(EtcFrame.this);
}
});
helpMenu.add(contactMenuItem);
......@@ -599,10 +600,11 @@ public class EtcFrame extends javax.swing.JFrame implements UIManager {
aboutMenuItem.setName("aboutMenuItem"); // NOI18N
aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
System.out.println("About ok");
public void actionPerformed(java.awt.event.ActionEvent evt) {
AboutDialog.show(EtcFrame.this);
}
});
helpMenu.add(new JSeparator());
helpMenu.add(aboutMenuItem);
......@@ -1042,10 +1044,6 @@ private void OptionsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//G
System.exit(0);
}
private void setResultLevel(Level level) {
ConfigFactory.getConfig().setResultLevel(level.name());
}
@Override
public void pluginListChanged() {
pluginsMenu.removeAll();
......
......@@ -53,8 +53,9 @@ import org.cnrs.lam.dis.etc.ui.generic.SessionModifiedListener;
* @author Nikolaos Apostolakos
*/
public abstract class EtcPanel extends JPanel {
/** The logger of the class.*/
private static final long serialVersionUID = -4256212433176828557L;
/** The logger of the class.*/
private static Logger logger = Logger.getLogger(EtcPanel.class.getName());
private SessionModifiedListener sessionModifiedListener = new SessionModifiedListener() {
......
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.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
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;
private JLabel logoCesamLabel;
public AboutDialog(JFrame parent) {
super(parent, "About ETC-42");
JPanel wrapper = new JPanel();
wrapper.setLayout(new BoxLayout(wrapper, BoxLayout.PAGE_AXIS));
// 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));
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.setAlignmentX(Component.LEFT_ALIGNMENT);
logoLamLabel.setBorder(new EmptyBorder(5, 5, 5, 5 * 3));
logoLamLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
logoLamLabel.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
BrowserLoader.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.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
try {
BrowserLoader.openWebpage(new URL("https://www.lam.fr/cesam/"));
} catch (MalformedURLException e1) {}
}
});
horizontalLogoGroup.add(logoCesamLabel);
wrapper.add(horizontalLogoGroup);
getContentPane().add(wrapper);
pack();
}
public static void show(JFrame parent) {
instance = new AboutDialog(parent);
if (instance == null) {
}
instance.setVisible(true);
}
}
package org.cnrs.lam.dis.etc.ui.swing.help;
import java.awt.Desktop;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
public class BrowserLoader {
public static void openWebpage(URI uri) {
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
try {
desktop.browse(uri);
} catch (Exception e) {}
}
}
public static void openWebpage(URL url) {
try {
openWebpage(url.toURI());
} catch (URISyntaxException e) {}
}
}
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.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class ContributionDialog extends JDialog implements ActionListener {
public class ContributionDialog extends HelpDialog {
private static final long serialVersionUID = 690722433853815375L;
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 JLabel text = new JLabel();
private JButton okButton = new JButton("OK");
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>";
public ContributionDialog(JFrame parent) {
super(parent, "Contributions", true);
JPanel messagePane = new JPanel();
text.setText("Text");
messagePane.add(text);
messagePane.add(okButton);
getContentPane().add(messagePane);
okButton.addActionListener(this);
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>"
);
pack();
setLocationRelativeTo(parent);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
}
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
}
}
\ No newline at end of file
public static void show(JFrame parent) {
instance = new ContributionDialog(parent);
if (instance == null) {
}
instance.setVisible(true);
}
}
package org.cnrs.lam.dis.etc.ui.swing.help;
import java.awt.BorderLayout;
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;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
public class HelpDialog extends JDialog implements ActionListener {
private static final long serialVersionUID = 690722433853815375L;
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);
okButton.addActionListener(this);
pack();
setLocationRelativeTo(parent);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
setResizable(false);
}
public HelpDialog(JFrame parent, String title, String htmlText) {
this(parent, title);
htmlText = "<html>" + htmlText + "</html>";
JPanel textPane = new JPanel();
JLabel textLabel = new JLabel(htmlText, SwingConstants.CENTER);
textLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
textPane.add(textLabel);
getContentPane().add(textPane);
pack();
}
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
}
}
\ No newline at end of file
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);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment