Commit 58db6f73 authored by SAPONE Alann's avatar SAPONE Alann

Help link added - link to project - abstracts - new hyperlink class - license in english

parent 50e6a06f
/target/
**/target/
myKeystore
\ No newline at end of file
......@@ -47,6 +47,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -99,6 +100,7 @@ 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.ContributionDialog;
import org.cnrs.lam.dis.etc.ui.swing.help.UtilsLoader;
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;
......@@ -112,11 +114,8 @@ import org.json.JSONObject;
* @author Nikolaos Apostolakos
*/
public class EtcFrame extends javax.swing.JFrame implements org.cnrs.lam.dis.etc.ui.UIManager {
/**
*
*/
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(EtcFrame.class);
private ProgressDialog progressDialog = new ProgressDialog(null, true);
private final ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/cnrs/lam/dis/etc/ui/swing/messages");
......@@ -125,6 +124,8 @@ public class EtcFrame extends javax.swing.JFrame implements org.cnrs.lam.dis.etc
private CommandHistoryPanel commandHistoryPanel = new CommandHistoryPanel();
private ChartsTabbedPane chartsTabbedPane = new ChartsTabbedPane();
public final static String DOCUMENTATION_URL = "http://cesam.lam.fr/Apps/ETC/documentation/";
/** Creates new form EtcFrame */
public EtcFrame() {
initComponents();
......@@ -564,7 +565,9 @@ public class EtcFrame extends javax.swing.JFrame implements org.cnrs.lam.dis.etc
helpMenuItem.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
System.out.println("Help ok");
try {
UtilsLoader.openWebpage(new URL(DOCUMENTATION_URL));
} catch (MalformedURLException e) {}
}
});
helpMenu.add(helpMenuItem);
......
......@@ -26,7 +26,8 @@ public class AboutDialog extends HelpDialog {
private static final long serialVersionUID = -679981628077230532L;
private static AboutDialog instance = null;
public final static String LICENSE_URL = "https://www.cecill.info/licences/Licence_CeCILL_V2.1-fr.html";
public final static String LICENSE_URL = "https://www.cecill.info/licences/Licence_CeCILL_V2.1-en.html";
public final static String PROJECT_URL = "https://projets.lam.fr/projects/etc/news";
public final static String CONTACT_URL = "etc42@lam.fr";
private final static String[] authors = {
......@@ -71,7 +72,7 @@ public class AboutDialog extends HelpDialog {
// 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(120, 120, Image.SCALE_SMOOTH));
ImageIcon logo = new ImageIcon(logoImage.getScaledInstance(180, 180, Image.SCALE_SMOOTH));
JLabel logoLabel = new JLabel(logo);
logoLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
......@@ -118,18 +119,9 @@ public class AboutDialog extends HelpDialog {
// 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) {}
}
});
JLabel distributedLabelEnd = new JLabel(" license");
distributedLabelEnd.setAlignmentX(LEFT_ALIGNMENT);
HyperlinkLabel licenceURLLabel = new HyperlinkLabel("CeCILL", LICENSE_URL);
// Authors
String authorsString = formatList(authors, 3);
......@@ -148,17 +140,19 @@ public class AboutDialog extends HelpDialog {
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 evt)
{
UtilsLoader.openMail(CONTACT_URL);
}
});
HyperlinkLabel contactUrlLabel = new HyperlinkLabel(CONTACT_URL, CONTACT_URL);
// Publication
JLabel publicationLabel = new JLabel("ETC-42 has been published in the following abstracts : ");
HyperlinkLabel publicationUrlLabelA = new HyperlinkLabel("2015ASPC..495..391G", "http://adsabs.harvard.edu/abs/2015ASPC..495..391G");
HyperlinkLabel publicationUrlLabelB = new HyperlinkLabel("2012ASPC..461..885A", "http://adsabs.harvard.edu/abs/2012ASPC..461..885A");
HyperlinkLabel publicationUrlLabelC = new HyperlinkLabel("2011ASPC..442..559S", "http://adsabs.harvard.edu/abs/2011ASPC..442..559S");
// Project webpage
JLabel projectLabel = new JLabel("Project homepage: ");
projectLabel.setAlignmentX(LEFT_ALIGNMENT);
HyperlinkLabel projectUrlLabel = new HyperlinkLabel(PROJECT_URL, PROJECT_URL);
projectUrlLabel.setAlignmentX(LEFT_ALIGNMENT);
// Panels
JPanel wrapper = new JPanel();
......@@ -181,6 +175,7 @@ public class AboutDialog extends HelpDialog {
licensePane.setLayout(new BoxLayout(licensePane, BoxLayout.LINE_AXIS));
licensePane.add(distributedLabel);
licensePane.add(licenceURLLabel);
licensePane.add(distributedLabelEnd);
licensePane.setAlignmentX(LEFT_ALIGNMENT);
JPanel contactPane = new JPanel();
......@@ -190,6 +185,29 @@ public class AboutDialog extends HelpDialog {
contactPane.add(contactUrlLabel);
contactPane.setAlignmentX(LEFT_ALIGNMENT);
JPanel publicationPane = new JPanel();
publicationPane.setLayout(new BoxLayout(publicationPane, BoxLayout.PAGE_AXIS));
publicationPane.setBorder(new EmptyBorder(15, 0, 15, 0));
publicationPane.add(publicationLabel);
JPanel publicationsLinePane = new JPanel();
publicationsLinePane.setLayout(new BoxLayout(publicationsLinePane, BoxLayout.LINE_AXIS));
publicationsLinePane.add(publicationUrlLabelA);
publicationsLinePane.add(new JLabel(", "));
publicationsLinePane.add(publicationUrlLabelB);
publicationsLinePane.add(new JLabel(", "));
publicationsLinePane.add(publicationUrlLabelC);
publicationsLinePane.setAlignmentX(LEFT_ALIGNMENT);
publicationsLinePane.setAlignmentX(Component.LEFT_ALIGNMENT);
publicationPane.add(publicationsLinePane);
JPanel projectWebPagePane = new JPanel();
projectWebPagePane.setLayout(new BoxLayout(projectWebPagePane, BoxLayout.LINE_AXIS));
projectWebPagePane.setBorder(new EmptyBorder(15, 0, 0, 0));
projectWebPagePane.add(projectLabel);
projectWebPagePane.add(projectUrlLabel);
JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
contentPane.setAlignmentY(CENTER_ALIGNMENT);
......@@ -207,6 +225,12 @@ public class AboutDialog extends HelpDialog {
contributorsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(contributorsLabel);
projectWebPagePane.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(projectWebPagePane);
publicationPane.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(publicationPane);
contactPane.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(contactPane);
......
......@@ -36,16 +36,8 @@ public class ContributionDialog extends HelpDialog {
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)
{
UtilsLoader.openMail(AboutDialog.CONTACT_URL);
}
});
HyperlinkLabel contactUrlLabel = new HyperlinkLabel(AboutDialog.CONTACT_URL, AboutDialog.CONTACT_URL, SwingConstants.CENTER);
important.add(contactUrlLabel);
important.setAlignmentX(LEFT_ALIGNMENT);
wrapper.add(important);
......@@ -56,18 +48,7 @@ public class ContributionDialog extends HelpDialog {
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) {}
}
});
HyperlinkLabel sourceURLLabel = new HyperlinkLabel(SOURCE_URL, SOURCE_URL, SwingConstants.CENTER);
wrapper.add(sourceURLLabel);
getContentPane().add(wrapper);
......
package org.cnrs.lam.dis.etc.ui.swing.help;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.font.TextAttribute;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
public class HyperlinkLabel extends JLabel {
private static final long serialVersionUID = 3840694910150135142L;
public HyperlinkLabel(final String text, final String href, int position) {
super(text, position);
if (position == SwingConstants.CENTER) {
this.setText("<html><div style='text-align:center;'><u>" + text + "</u></div></html>");
}
Font font = getFont();
Map attributes = font.getAttributes();
attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
setFont(font.deriveFont(attributes));
setForeground(Color.BLUE);
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
try {
if (isUrlMail(href)) {
UtilsLoader.openMail(href);
} else {
UtilsLoader.openWebpage(new URL(href));
}
} catch (MalformedURLException e1) {}
}
});
}
public HyperlinkLabel(String text, final String href) {
this(text, href, SwingConstants.LEFT);
}
public boolean isUrlMail(String email) {
String ePattern = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$";
java.util.regex.Pattern p = java.util.regex.Pattern.compile(ePattern);
java.util.regex.Matcher m = p.matcher(email);
return m.matches();
}
}
......@@ -17,7 +17,6 @@ public class UtilsLoader {
}
public static void openMail(String urlString) {
System.out.println(urlString);
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
if (desktop != null && desktop.isSupported(Desktop.Action.MAIL)) {
try {
......
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