package com.gpl.rpg.atcontentstudio.ui; import java.awt.BorderLayout; import java.awt.Desktop; import java.io.IOException; import java.net.URISyntaxException; import java.util.List; import java.util.Scanner; import javax.swing.ImageIcon; import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkEvent.EventType; import javax.swing.event.HyperlinkListener; import com.gpl.rpg.atcontentstudio.ATContentStudio; import com.gpl.rpg.atcontentstudio.model.GameDataElement; import com.gpl.rpg.atcontentstudio.model.SaveEvent; import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet; import com.jidesoft.swing.JideTabbedPane; public class AboutEditor extends Editor { private static final long serialVersionUID = 6230549148222457139L; public static final String WELCOME_STRING = "" + "" + "" + "
Welcome to "+ATContentStudio.APP_NAME+" "+ATContentStudio.APP_VERSION+"
" + "
" + "This is a content editor for Andor's Trail.
" + "Right click on the left area or use the \"File\" menu to create a project.
" + "
" + "Play Andor's Trail for free on your Android device.
" + "Visit the official forum to give or receive help.
" + "Open the project's GitHub project page to check out the game's source code.
" + "
" + "For content creation help, make sure to use the following resources:
" + "The contribution guide on the forums
" + "The developer section of the Andor's Trail wiki
" + "The design outline document on Google Drive/Docs
" + "
" + "Credits:
" + "
" + "Author: Zukero
" + "Licence: GPL v3
" + "Sources are included in this package and on GitHub.
" + "
" + "Contributors:
" + "Quentin Delvallet
" + "
" + "This project uses the following libraries:
" + "JSON.simple by Yidong Fang & Chris Nokleberg.
" + "License: Apache License 2.0
" + "
" + "RSyntaxTextArea by Robert Futrell.
" + "License: Modified BSD License (a.k.a. 3-Clause BSD)
" + "
" + "JIDE Common Layer by JIDE Software.
" + "License: GPL v2 with classpath exception
" + "
" + "A modified version of libtiled-java by Adam Turk & Thorbjorn Lindeijer.
" + "License: Simplified BSD License (a.k.a 2-Clause BSD)
" + "Sources of the modified version are included in this package.
" + "
" + "Prefuse by the Berkeley Institue of Design.
" + "License: Modified BSD License (a.k.a 3-Clause BSD)
" + "
" + "BeanShell by Pat Niemeyer.
" + "License: LGPL v3
" + "
" + "A slightly modified version of SipHash for Java by Isaac Whitfield.
" + "License: MIT License
" + "
" + "jsoup by Jonathan Hedley
" + "License: MIT License
" + "
" + "See the tabs below to find the full license text for each of these.
" + "
" + "The Windows installer was created with:
" + "NSIS (Nullsoft Scriptable Install System) v2.46" + "
" + ""; public static final AboutEditor instance = new AboutEditor(); @SuppressWarnings("resource") private AboutEditor() { this.name="About "+ATContentStudio.APP_NAME; this.icon = new ImageIcon(DefaultIcons.getMainIconIcon()); this.target = new GameDataElement(){ private static final long serialVersionUID = -227480102288529682L; @Override public GameDataSet getDataSet() {return null;} @Override public String getDesc() {return null;} @Override public void parse() {} @Override public void link() {} @Override public GameDataElement clone() {return null;} @Override public void elementChanged(GameDataElement oldOne, GameDataElement newOne) {} @Override public String getProjectFilename() {return null;} @Override public void save() {} @Override public List attemptSave() {return null;} }; setLayout(new BorderLayout()); JideTabbedPane editorTabsHolder = new JideTabbedPane(JideTabbedPane.BOTTOM); editorTabsHolder.setTabShape(JideTabbedPane.SHAPE_FLAT); editorTabsHolder.setUseDefaultShowCloseButtonOnTab(false); editorTabsHolder.setShowCloseButtonOnTab(false); add(editorTabsHolder, BorderLayout.CENTER); editorTabsHolder.add("Welcome", getInfoPane(WELCOME_STRING, "text/html")); editorTabsHolder.add("JSON.simple License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.JSON.simple.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); editorTabsHolder.add("RSyntaxTextArea License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/RSyntaxTextArea.License.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); editorTabsHolder.add("JIDE Common Layer License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.JIDE.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); editorTabsHolder.add("libtiled-java License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.libtiled.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); editorTabsHolder.add("prefuse License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/license-prefuse.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); editorTabsHolder.add("BeanShell License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.LGPLv3.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); editorTabsHolder.add("SipHash for Java License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.siphash-zackehh.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); editorTabsHolder.add("jsoup License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.jsoup.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); editorTabsHolder.add("ATCS License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.GPLv3.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text")); } private JPanel getInfoPane(String content, String mime) { JEditorPane welcome = new JEditorPane(); welcome.setContentType(mime); welcome.setText(content); welcome.setEditable(false); welcome.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent arg0) { arg0.getEventType(); if (arg0.getEventType() == EventType.ACTIVATED) { if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { try { Desktop.getDesktop().browse(arg0.getURL().toURI()); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } } } } }); JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); pane.add(new JScrollPane(welcome), BorderLayout.CENTER); return pane; } @Override public void targetUpdated() {} }