/*
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
-import java.io.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.io.JalviewFileChooser;
+import jalview.jbgui.GUserDefinedColours;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+import jalview.util.MessageManager;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
/**
* DOCUMENT ME!
* Creates a new UserDefinedColours object.
*
* @param ap
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param sg
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)
{
* DOCUMENT ME!
*
* @param evt
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void stateChanged(ChangeEvent evt)
{
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void colourButtonPressed(MouseEvent e)
{
JButton button = (JButton) buttonPanel.getComponent(b);
if (!selectedButtons.contains(button))
{
- button
- .setForeground(button.getBackground().brighter()
- .brighter());
+ button.setForeground(button.getBackground().brighter().brighter());
selectedButtons.add(button);
}
}
}
else
{
- pressed
- .setForeground(pressed.getBackground().brighter()
- .brighter());
+ pressed.setForeground(pressed.getBackground().brighter().brighter());
selectedButtons.addElement(pressed);
}
}
* DOCUMENT ME!
*
* @param label
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param aa
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
JButton makeButton(String label, String aa, Vector caseSensitiveButtons,
int buttonIndex)
caseSensitiveButtons.addElement(button);
col = Color.white;
- if (oldColourScheme!=null)
+ if (oldColourScheme != null)
{
try
{
- col = oldColourScheme.findColour(aa.charAt(0), -1);
+ col = oldColourScheme.findColour(aa.charAt(0), -1, null);
} catch (Exception ex)
{
}
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void okButton_actionPerformed(ActionEvent e)
{
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void applyButton_actionPerformed(ActionEvent e)
{
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void loadbutton_actionPerformed(ActionEvent e)
{
upperCaseButtons = new Vector();
lowerCaseButtons = new Vector();
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache
- .getProperty("LAST_DIRECTORY"), new String[]
- { "jc" }, new String[]
- { "Jalview User Colours" }, "Jalview User Colours");
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+ { "jc" }, new String[]
+ { "Jalview User Colours" }, "Jalview User Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
chooser.setDialogTitle("Load colour scheme");
chooser.setToolTipText("Load");
* DOCUMENT ME!
*
* @param file
- * DOCUMENT ME!
+ * DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void savebutton_actionPerformed(ActionEvent e)
{
if (schemeName.getText().trim().length() < 1)
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "User colour scheme must have a name!",
- "No name for colour scheme", JOptionPane.WARNING_MESSAGE);
+ MessageManager.getString("label.user_colour_scheme_must_have_name"),
+ MessageManager.getString("label.no_name_colour_scheme"), JOptionPane.WARNING_MESSAGE);
return;
}
if (userColourSchemes != null
&& userColourSchemes.containsKey(schemeName.getText()))
{
- int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- "Colour scheme " + schemeName.getText() + " exists."
- + "\nContinue saving colour scheme as "
- + schemeName.getText() + "?",
- "Duplicate scheme name", JOptionPane.YES_NO_OPTION);
+ int reply = JOptionPane.showInternalConfirmDialog(
+ Desktop.desktop,
+ MessageManager.formatMessage("label.colour_scheme_exists_overwrite", new String[]{schemeName.getText(),schemeName.getText()}),
+ MessageManager.getString("label.duplicate_scheme_name"), JOptionPane.YES_NO_OPTION);
if (reply != JOptionPane.YES_OPTION)
{
return;
userColourSchemes.remove(schemeName.getText());
}
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache
- .getProperty("LAST_DIRECTORY"), new String[]
- { "jc" }, new String[]
- { "Jalview User Colours" }, "Jalview User Colours");
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+ { "jc" }, new String[]
+ { "Jalview User Colours" }, "Jalview User Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
chooser.setDialogTitle("Save colour scheme");
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void cancelButton_actionPerformed(ActionEvent e)
{
{
if (coloursFound.toString().length() > 1)
{
- jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS", coloursFound
- .toString());
+ jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS",
+ coloursFound.toString());
}
else
{
userColourSchemes = new Hashtable();
StringBuffer coloursFound = new StringBuffer();
- StringTokenizer st = new StringTokenizer(jalview.bin.Cache
- .getProperty("USER_DEFINED_COLOURS"), "|");
+ StringTokenizer st = new StringTokenizer(
+ jalview.bin.Cache.getProperty("USER_DEFINED_COLOURS"), "|");
while (st.hasMoreElements())
{
if (coloursFound.toString().length() > 1)
{
- jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS", coloursFound
- .toString());
+ jalview.bin.Cache.setProperty("USER_DEFINED_COLOURS",
+ coloursFound.toString());
}
else
{