@Override public Object clone(){ return new VersionProperty(myName, myNumber); } }
/** * Returns the current FileSystemAdapter. * @return current FileSystemAdapter */ public static FileSystemAdapter getFileSystemAdapter(){ if(theFileSystemAdapter == null){ theFileSystemAdapter = new FileSystemAdapterImpl(); } return theFileSystemAdapter; }
/** * Set the version name * @param name new version name */ public void setName(String name){ if(name == null){ throw new NullPointerException(); } String old = myName; myName = name; firePropertyChange(PROP_NAME, old, myName); }
private DependencyDescriptor buildFactoryDescriptor(Class<T> serviceClass, Class<C> configClass, VersionProperty serviceVersion){ DescriptorBuilder descs = new DescriptorBuilder(theServiceFactory, ServiceFactory.class) .with(Constants.SERVICE_CLASS, serviceClass.getName()) .with(Constants.SERVICE_VERSION, serviceVersion.toString()); if(configClass != null){ descs.with(Constants.CONFIG_CLASS, configClass.getName()); } return descs.getDescriptor(); }
private File predfinedFile(String path){ return ConfigUtils.getFileSystemAdapter().openFile(path); }
/** * * @return */ public static Icon[] getFileIcons(){ Icon[] icons = new Icon[3]; String path = UIConfigHelper.getImagePath(); icons[0] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "new24.png"); icons[1] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "open24.png"); icons[2] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "save24.png"); return icons; }
/** * Returns a XML node for the given VersionProperty. * @param version VersionProperty to write * @param type type attribute for the VersionProperty * @return XML node for the given VersionProperty */ public static ConfigurationNode writeVersion(VersionProperty version, String type){ ConfigurationNode node = node(XML_VERSION); node.addAttribute(node(XML_VERSION_TYPE, type)); node.addChild(node(XML_VERSION_NAME, version.getName())); node.addChild(node(XML_VERSION_NUMBER, version.getNumber())); return node; }
/** * * @return */ public VersionProperty getVersion(){ String name = myVersionNameTxtBox.getText(); String number = myVersionNumberTxtBox.getText(); VersionProperty version = new VersionProperty(name, number); return version; } /** This method is called from within the constructor to
private DependencyDescriptor buildLoaderDescriptor(Class<C> configClass, Class<P> paramClass, VersionProperty configFormat){ DescriptorBuilder descs = new DescriptorBuilder( theConfigLoader, ConfigurationLoader.class) .with(Constants.CONFIG_FORMAT_VERSION, configFormat.toString()); if(configClass != null){ descs.with(Constants.CONFIG_CLASS, configClass.getName()); }if(paramClass != null){ descs.with(Constants.CONFIG_PARAM_CLASS, paramClass.getName()); } return descs.getDescriptor(); }
private ManagedService launchRobot( BundleContext context, Robot.Id robotId, String path){ File file = ConfigUtils.getFileSystemAdapter().openFile(path); if(file == null){ return null; } String paramId = "robot/" + robotId + "/config/param/xml"; launchRobotConfig(context, file, paramId); return loadRobotService(context, robotId, paramId); }
/** * * @return */ public static Icon[] getPlayerIcons(){ Icon[] icons = new Icon[3]; String path = UIConfigHelper.getImagePath(); icons[0] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "Play24.gif"); icons[1] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "Pause24.gif"); icons[2] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "Stop24.gif"); return icons; }
/** * Set the version number * @param num new version number */ public void setNumber(String num){ if(num == null){ throw new NullPointerException(); } String old = myNumber; myNumber = num; firePropertyChange(PROP_NUMBER, old, myNumber); }
private static VersionProperty getVersion(Property p) throws IllegalAccessException, InvocationTargetException{ if(p == null){ return new VersionProperty("", ""); } Object val = p.getValue(); if(val instanceof VersionProperty){ return (VersionProperty)val; } return new VersionProperty("", ""); } }
private DependencyDescriptor buildParamDescriptor( Class<P> paramClass, VersionProperty configFormat, String paramId){ DescriptorBuilder descs = new DescriptorBuilder(theLoaderParam, paramClass) .with(Constants.CONFIG_FORMAT_VERSION, configFormat.toString()); if(paramId != null){ descs.with(Constants.CONFIG_PARAM_ID, paramId); } return descs.getDescriptor(); }
/** * * @return */ public static Icon[] getPlayStatusIcons(){ Icon[] icons = new Icon[4]; String path = UIConfigHelper.getImagePath(); icons[0] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "PlayStatus12.png"); icons[1] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "PauseStatus12.png"); icons[2] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "StopStatus12.png"); icons[3] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "CompleteStatus12.png"); return icons; }
/** * Reads a VersionProperty from a XML node. * @param config XML node of the VersionProperty * @return VersionProperty from a XML node */ public static VersionProperty readVersion(HierarchicalConfiguration config){ String name = config.getString(XML_VERSION_NAME); String num = config.getString(XML_VERSION_NUMBER); return new VersionProperty(name, num); }
/** * * @return */ public static Icon[] getHistoryIcons(){ Icon[] icons = new Icon[2]; String path = UIConfigHelper.getImagePath(); icons[0] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "undo24.gif"); icons[1] = ConfigUtils.getFileSystemAdapter().openImageIcon(path + "redo24.gif"); return icons; }
/** * * @return */ public static Icon getDefaultHeaderIcon(){ String path = UIConfigHelper.getImagePath(); return ConfigUtils.getFileSystemAdapter().openImageIcon(path + "DefaultHeader12.png"); }
/** * * @return */ public static Icon getCompletedHeaderIcon(){ String path = UIConfigHelper.getImagePath(); return ConfigUtils.getFileSystemAdapter().openImageIcon(path + "CompleteStatus12.png"); }