import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
import jalview.jbgui.GUserDefinedColours;
-import jalview.schemabinding.version2.Colour;
-import jalview.schemabinding.version2.JalviewUserColours;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeLoader;
import jalview.schemes.ColourSchemes;
import jalview.util.ColorUtils;
import jalview.util.Format;
import jalview.util.MessageManager;
+import jalview.xml.binding.jalview.JalviewUserColours;
+import jalview.xml.binding.jalview.JalviewUserColours.Colour;
+import jalview.xml.binding.jalview.ObjectFactory;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JInternalFrame;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
/**
* This panel allows the user to assign colours to Amino Acid residue codes, and
Colour col = new Colour();
col.setName(button.getText());
col.setRGB(Format.getHexString(button.getBackground()));
- ucs.addColour(col);
+ ucs.getColour().add(col);
}
- ucs.marshal(out);
+ JAXBContext jaxbContext = JAXBContext
+ .newInstance(JalviewUserColours.class);
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
+ jaxbMarshaller.marshal(
+ new ObjectFactory().createJalviewUserColours(ucs), out);
+ // ucs.marshal(out);
out.close();
} catch (Exception ex)
{
*/
package jalview.schemes;
-import jalview.binding.JalviewUserColours;
+import jalview.xml.binding.jalview.JalviewUserColours;
import java.awt.Color;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
-import org.exolab.castor.xml.Unmarshaller;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
public class ColourSchemeLoader
{
InputStreamReader in = new InputStreamReader(
new FileInputStream(file), "UTF-8");
- jalview.schemabinding.version2.JalviewUserColours jucs = new jalview.schemabinding.version2.JalviewUserColours();
-
- org.exolab.castor.xml.Unmarshaller unmar = new org.exolab.castor.xml.Unmarshaller(
- jucs);
- jucs = (jalview.schemabinding.version2.JalviewUserColours) unmar
- .unmarshal(in);
+ JAXBContext jc = JAXBContext
+ .newInstance("jalview.xml.binding.jalview");
+ javax.xml.bind.Unmarshaller um = jc.createUnmarshaller();
+ XMLStreamReader streamReader = XMLInputFactory.newInstance()
+ .createXMLStreamReader(in);
+ JAXBElement<JalviewUserColours> jbe = um.unmarshal(streamReader,
+ JalviewUserColours.class);
+ JalviewUserColours jucs = jbe.getValue();
/*
* non-case-sensitive colours are for 20 amino acid codes,
String name;
int index;
- for (int i = 0; i < jucs.getColourCount(); i++)
+ for (int i = 0; i < jucs.getColour().size(); i++)
{
- name = jucs.getColour(i).getName();
+ name = jucs.getColour().get(i).getName();
if (ResidueProperties.aa3Hash.containsKey(name))
{
index = ResidueProperties.aa3Hash.get(name).intValue();
}
Color color = new Color(
- Integer.parseInt(jucs.getColour(i).getRGB(), 16));
+ Integer.parseInt(jucs.getColour().get(i).getRGB(), 16));
if (name.toLowerCase().equals(name))
{
caseSensitive = true;
jalview.binding.JalviewUserColours jucs = new jalview.binding.JalviewUserColours();
- jucs = JalviewUserColours.unmarshal(in);
+ jucs = jalview.binding.JalviewUserColours.unmarshal(in);
newColours = new Color[jucs.getColourCount()];