git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f329f6c
)
Sets USER_DEFINED_COLOUR as property
author
amwaterhouse
<Andrew Waterhouse>
Mon, 21 Feb 2005 17:01:41 +0000
(17:01 +0000)
committer
amwaterhouse
<Andrew Waterhouse>
Mon, 21 Feb 2005 17:01:41 +0000
(17:01 +0000)
src/jalview/gui/UserDefinedColours.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/UserDefinedColours.java
b/src/jalview/gui/UserDefinedColours.java
index
642f473
..
a409549
100755
(executable)
--- a/
src/jalview/gui/UserDefinedColours.java
+++ b/
src/jalview/gui/UserDefinedColours.java
@@
-18,23
+18,38
@@
public class UserDefinedColours extends GUserDefinedColours implements ChangeLis
SequenceGroup seqGroup;
\r
JButton selectedButton;
\r
Vector oldColours = new Vector();
\r
SequenceGroup seqGroup;
\r
JButton selectedButton;
\r
Vector oldColours = new Vector();
\r
+ ColourSchemeI oldColourScheme;
\r
JInternalFrame frame;
\r
\r
JInternalFrame frame;
\r
\r
+
\r
public UserDefinedColours(JInternalFrame f, AlignmentPanel ap, SequenceGroup sg)
\r
{
\r
super();
\r
colorChooser.getSelectionModel().addChangeListener(this);
\r
this.ap = ap;
\r
frame = f;
\r
public UserDefinedColours(JInternalFrame f, AlignmentPanel ap, SequenceGroup sg)
\r
{
\r
super();
\r
colorChooser.getSelectionModel().addChangeListener(this);
\r
this.ap = ap;
\r
frame = f;
\r
- seqGroup = sg;
\r
+ seqGroup = sg;
\r
+
\r
+
\r
+ if (seqGroup != null)
\r
+ oldColourScheme = seqGroup.cs;
\r
+ else
\r
+ oldColourScheme = ap.av.getGlobalColourScheme();
\r
+
\r
+ for (int i = 0; i < 20; i++)
\r
+ makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +
\r
+ "", ResidueProperties.aa[i]);
\r
+
\r
+ makeButton("B", "B");
\r
+ makeButton("Z", "Z");
\r
+ makeButton("X", "X");
\r
+ makeButton("'.','-',' '", "-");
\r
\r
\r
- for(int i=0; i<20; i++)
\r
- makeButton(ResidueProperties.aa2Triplet.get( ResidueProperties.aa[i] )+"", ResidueProperties.aa[i]);
\r
+ if(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR")!=null)
\r
+ {
\r
+ loadColour(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR"));
\r
+ }
\r
\r
\r
- makeButton("B","B");
\r
- makeButton("Z","Z");
\r
- makeButton("X","X");
\r
- makeButton("'.','-',' '", "-");
\r
\r
}
\r
\r
\r
}
\r
\r
@@
-54,15
+69,10
@@
public class UserDefinedColours extends GUserDefinedColours implements ChangeLis
{
\r
final JButton button = new JButton();
\r
Color col = Color.white;
\r
{
\r
final JButton button = new JButton();
\r
Color col = Color.white;
\r
- ColourSchemeI cs = null;
\r
- if(seqGroup!=null)
\r
- cs = seqGroup.cs;
\r
- else
\r
- cs = ap.av.getGlobalColourScheme();
\r
\r
\r
try{
\r
\r
\r
try{
\r
- col = cs.findColour(aa, -1, null);
\r
+ col = oldColourScheme.findColour(aa, -1, null);
\r
}catch(Exception ex){}
\r
\r
button.setBackground( col );
\r
}catch(Exception ex){}
\r
\r
button.setBackground( col );
\r
@@
-121,20
+131,25
@@
public class UserDefinedColours extends GUserDefinedColours implements ChangeLis
{
\r
String choice = chooser.getSelectedFile().getPath();
\r
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
\r
{
\r
String choice = chooser.getSelectedFile().getPath();
\r
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
\r
+ loadColour(choice);
\r
+ }
\r
\r
\r
- try{
\r
- BufferedReader in = new BufferedReader(new FileReader(choice));
\r
- for(int i=0; i<24; i++)
\r
- {
\r
- JButton button = (JButton)buttonPanel.getComponent(i);
\r
- Color c = new Color(Integer.parseInt(in.readLine()));
\r
- button.setBackground(c);
\r
- }
\r
+ }
\r
\r
\r
+ void loadColour(String file)
\r
+ {
\r
+ try
\r
+ {
\r
+ BufferedReader in = new BufferedReader(new FileReader(file));
\r
+ for (int i = 0; i < 24; i++)
\r
+ {
\r
+ JButton button = (JButton) buttonPanel.getComponent(i);
\r
+ Color c = new Color(Integer.parseInt(in.readLine()));
\r
+ button.setBackground(c);
\r
}
\r
}
\r
- catch(Exception ex)
\r
- {}
\r
}
\r
}
\r
+ catch (Exception ex)
\r
+ {}
\r
\r
}
\r
\r
\r
}
\r
\r
@@
-147,7
+162,7
@@
public class UserDefinedColours extends GUserDefinedColours implements ChangeLis
if (value == JFileChooser.APPROVE_OPTION)
\r
{
\r
String choice = chooser.getSelectedFile().getPath();
\r
if (value == JFileChooser.APPROVE_OPTION)
\r
{
\r
String choice = chooser.getSelectedFile().getPath();
\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
\r
+ jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR", choice);
\r
\r
try{
\r
PrintWriter out = new PrintWriter(new FileWriter(choice));
\r
\r
try{
\r
PrintWriter out = new PrintWriter(new FileWriter(choice));
\r