public class ImageMaker
{
+ public static final String SVG_DESCRIPTION = "Scalable Vector Graphics";
+
+ public static final String SVG_EXTENSION = "svg";
+
+ public static final String EPS_DESCRIPTION = "Encapsulated Postscript";
+
+ public static final String EPS_EXTENSION = "eps";
+
+ public static final String PNG_EXTENSION = "png";
+
+ public static final String PNG_DESCRIPTION = "Portable network graphics";
+
+ public static final String HTML_EXTENSION = "html";
+
+ public static final String HTML_DESCRIPTION = "Hypertext Markup Language";
+
EpsGraphics2D pg;
SVGGraphics2D g2;
public enum TYPE
{
EPS("EPS", MessageManager.getString("label.eps_file"), getEPSChooser()),
- PNG("PNG", MessageManager.getString("label.png_image"), getPNGChooser()),
+ PNG("PNG", MessageManager.getString("label.png_image"),
+ getPNGChooser()),
SVG("SVG", "SVG", getSVGChooser());
private JalviewFileChooser chooser;
if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
{
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
- .getSelectedFile().getParent());
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ chooser.getSelectedFile().getParent());
file = chooser.getSelectedFile();
}
else
{
System.out.println("Error creating " + type.getName() + " file.");
- setProgressMessage(MessageManager.formatMessage(
- "info.error_creating_file", type.getName()));
+ setProgressMessage(MessageManager
+ .formatMessage("info.error_creating_file", type.getName()));
}
}
}
out.close();
break;
case PNG:
- ImageIO.write(bi, "png", out);
+ ImageIO.write(bi, PNG_EXTENSION, out);
out.flush();
out.close();
break;
pg.setAccurateTextMode(accurateText);
graphics = pg;
- setProgressMessage(MessageManager.formatMessage(
- "status.export_complete", type.getName()));
+ setProgressMessage(MessageManager
+ .formatMessage("status.export_complete", type.getName()));
} catch (Exception ex)
{
}
Graphics2D ig2 = (Graphics2D) graphics;
ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- setProgressMessage(MessageManager.formatMessage(
- "status.export_complete", type.getName()));
+ setProgressMessage(MessageManager
+ .formatMessage("status.export_complete", type.getName()));
}
SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
}
- setProgressMessage(MessageManager.formatMessage(
- "status.export_complete", type.getName()));
+ setProgressMessage(MessageManager
+ .formatMessage("status.export_complete", type.getName()));
graphics = g2;
}
{
return null;
}
- return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
- new String[] { "png" },
- new String[] { "Portable network graphics" },
- "Portable network graphics");
+ return new JalviewFileChooser(PNG_EXTENSION, PNG_DESCRIPTION);
}
static JalviewFileChooser getEPSChooser()
{
return null;
}
- return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
- new String[] { "eps" },
- new String[] { "Encapsulated Postscript" },
- "Encapsulated Postscript");
+ return new JalviewFileChooser(EPS_EXTENSION, EPS_DESCRIPTION);
}
private void setProgressMessage(String message)
{
return null;
}
- return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
- new String[] { "svg" },
- new String[] { "Scalable Vector Graphics" },
- "Scalable Vector Graphics");
+ return new JalviewFileChooser(SVG_EXTENSION, SVG_DESCRIPTION);
}
}