home *** CD-ROM | disk | FTP | other *** search
- package programinfo;
-
- import devplugin.Plugin;
- import devplugin.PluginInfo;
- import devplugin.Program;
- import devplugin.ProgramInfoHelper;
- import devplugin.SettingsTab;
- import devplugin.Version;
- import java.awt.Dimension;
- import java.awt.Point;
- import java.util.ArrayList;
- import java.util.Properties;
- import java.util.logging.Logger;
- import javax.swing.Icon;
- import util.ui.Localizer;
- import util.ui.UiUtilities;
-
- public class ProgramInfo extends Plugin {
- private static final Localizer mLocalizer;
- private static Logger mLog;
- private Point location = null;
- private Dimension size = null;
- private Properties mSettings;
- private static Plugin mInstance;
- public static final String DEFAULT_STYLE_SHEET = "#title {\n font-size:15px;\n font-family:Dialog;\n text-align:center;\n font-weight:bold;\n}\n\n#time {\n font-size:9px;\n font-family:Dialog;\n text-align:center;\n}\n\n#maininfo {\n font-size:9px;\n font-family:Dialog;\n text-align:right;\n font-weight:bold;\n}\n\n#info {\n font-size:9px;\n font-family:Dialog;\n}\n\n#text {\n font-size:11px;\n font-family:Dialog;\n}\n\n#small {\n font-size:9px;\n font-family:Dialog;\n}\n";
- // $FF: synthetic field
- static Class class$programinfo$ProgramInfo;
-
- public ProgramInfo() {
- mInstance = this;
- }
-
- public String getContextMenuItemText() {
- return mLocalizer.msg("contextMenuText", "Program information");
- }
-
- public static Plugin getInstance() {
- if (mInstance == null) {
- mLog.severe("mInstance is null");
- mInstance = new ProgramInfo();
- }
-
- return mInstance;
- }
-
- public PluginInfo getInfo() {
- String name = mLocalizer.msg("pluginName", "Program information");
- String desc = mLocalizer.msg("description", "Show information about a program");
- String author = "Martin Oberhauser";
- return new PluginInfo(name, desc, author, new Version(1, 7));
- }
-
- public String getButtonText() {
- return null;
- }
-
- public SettingsTab getSettingsTab() {
- return new ProgramInfoSettingsTab(this.mSettings);
- }
-
- public Properties storeSettings() {
- return this.mSettings;
- }
-
- public void loadSettings(Properties settings) {
- if (settings == null) {
- settings = new Properties();
- }
-
- this.mSettings = settings;
- }
-
- public void execute(Program program) {
- String styleSheet = this.mSettings.getProperty("stylesheet_v1", "#title {\n font-size:15px;\n font-family:Dialog;\n text-align:center;\n font-weight:bold;\n}\n\n#time {\n font-size:9px;\n font-family:Dialog;\n text-align:center;\n}\n\n#maininfo {\n font-size:9px;\n font-family:Dialog;\n text-align:right;\n font-weight:bold;\n}\n\n#info {\n font-size:9px;\n font-family:Dialog;\n}\n\n#text {\n font-size:11px;\n font-family:Dialog;\n}\n\n#small {\n font-size:9px;\n font-family:Dialog;\n}\n");
- ProgramInfoDialog dlg = new ProgramInfoDialog(this.getParentFrame(), styleSheet, program, ProgramInfoHelper.mInfoBitArr, ProgramInfoHelper.mInfoIconArr, ProgramInfoHelper.mInfoMsgArr);
- dlg.pack();
- dlg.addComponentListener(new 1(this));
- if (this.size != null) {
- dlg.setSize(this.size);
- }
-
- if (this.location != null) {
- dlg.setLocation(this.location);
- dlg.show();
- } else {
- UiUtilities.centerAndShow(dlg);
- this.size = dlg.getSize();
- this.location = dlg.getLocation();
- }
-
- }
-
- public String getMarkIconName() {
- return "programinfo/Information16.gif";
- }
-
- public String getButtonIconName() {
- return null;
- }
-
- public String getProgramTableIconText() {
- return mLocalizer.msg("programTableIconText", "Movie format");
- }
-
- public Icon[] getProgramTableIcons(Program program) {
- int info = program.getInfo();
- if (info != -1 && info != 0) {
- ArrayList iconList = null;
-
- for(int i = 0; i < ProgramInfoHelper.mInfoBitArr.length; ++i) {
- if (bitSet(info, ProgramInfoHelper.mInfoBitArr[i]) && ProgramInfoHelper.mInfoIconArr[i] != null) {
- if (iconList == null) {
- iconList = new ArrayList();
- }
-
- iconList.add(ProgramInfoHelper.mInfoIconArr[i]);
- }
- }
-
- if (iconList == null) {
- return null;
- } else {
- Icon[] var5 = new Icon[iconList.size()];
- iconList.toArray(var5);
- return var5;
- }
- } else {
- return null;
- }
- }
-
- static boolean bitSet(int num, int pattern) {
- return (num & pattern) == pattern;
- }
-
- // $FF: synthetic method
- static Class class$(String x0) {
- try {
- return Class.forName(x0);
- } catch (ClassNotFoundException x1) {
- throw new NoClassDefFoundError(x1.getMessage());
- }
- }
-
- // $FF: synthetic method
- static Point access$000(ProgramInfo x0) {
- return x0.location;
- }
-
- // $FF: synthetic method
- static Dimension access$100(ProgramInfo x0) {
- return x0.size;
- }
-
- static {
- mLocalizer = Localizer.getLocalizerFor(class$programinfo$ProgramInfo == null ? (class$programinfo$ProgramInfo = class$("programinfo.ProgramInfo")) : class$programinfo$ProgramInfo);
- mLog = Logger.getLogger((class$programinfo$ProgramInfo == null ? (class$programinfo$ProgramInfo = class$("programinfo.ProgramInfo")) : class$programinfo$ProgramInfo).getName());
- }
- }
-