public IFuture<jadex.commons.Properties> execute(IInternalAccess ia) { jadex.commons.Properties props = new jadex.commons.Properties(); // props.addProperty(new Property("address", address.getHostAddress())); // props.addProperty(new Property("port", ""+port)); // props.addProperty(new Property("delay", ""+delay)); props.addProperty(new Property("fast", ""+fast)); props.addProperty(new Property("autocreate", ""+autocreate)); props.addProperty(new Property("autodelete", ""+autodelete)); for(int i=0; i<includes.size(); i++) props.addProperty(new Property("include", includes.get(i).toString())); for(int i=0; i<excludes.size(); i++) props.addProperty(new Property("exclude", excludes.get(i).toString())); return new Future<jadex.commons.Properties>(props); } });
/** * Get an int property. * @param type The type. * @return Returns the parsed int value, 0 if not set. */ public static int getIntProperty(Properties[] props, String type) { Property prop = getLatestProperty(props, type); return prop==null? 0: Integer.parseInt(prop.getValue()); }
private static void savePropertiesAsPreferences(Properties props, IPreferences prefs, String path) { String appendType = props.getType(); if (appendType != null) { path = path + appendType + "."; } for (Property prop : props.getProperties()) { String name = prop.getName(); String type = prop.getType(); String value = prop.getValue(); String prefKey = path + type; prefs.setString(prefKey, value); } for (Properties subprops : props.getSubproperties()) { savePropertiesAsPreferences(subprops, prefs, path); } } }
/** * Update tool from given properties. */ public IFuture<Void> setProperties(final Properties props) { if(props!=null) { Property[] mps = props.getProperties(); Set<String> selected = new HashSet<String>(); for(int i=0; i<mps.length; i++) { if(Boolean.parseBoolean(mps[i].getValue())) selected.add(mps[i].getType()); } setSelectedComponentTypes(selected); } return IFuture.DONE; }
private static void loadPreferencesIntoProperties(Properties props, IPreferences preferences, boolean preferFileProperties) { Map<String, ?> prefs = preferences.getAll(); for (Entry<String, ?> pref : prefs.entrySet()) { String[] key = pref.getKey().split("\\."); String targetPropValue = (String) pref.getValue(); Properties parentProps = props; for (int i = 0; i < key.length - 1; i++) { String id = key[i]; Properties childProps = parentProps.getSubproperty(id); if (childProps == null) { childProps = new Properties(null, id, null); parentProps.addSubproperties(childProps); } parentProps = childProps; } String targetPropId = key[key.length - 1]; Property targetProp = parentProps.getProperty(targetPropId); if (targetProp == null) { targetProp = new Property(targetPropId, targetPropValue); parentProps.addProperty(targetProp); } else if (!preferFileProperties){ parentProps.getProperty(targetPropId).setValue(targetPropValue); } } }
if(type.equals(prop.getType())) ret.add(prop);
public IFuture<jadex.commons.Properties> execute(IInternalAccess ia) { jadex.commons.Properties props = new jadex.commons.Properties(); // props.addProperty(new Property("address", address.getHostAddress())); // props.addProperty(new Property("port", ""+port)); // props.addProperty(new Property("delay", ""+delay)); props.addProperty(new Property("fast", ""+fast)); props.addProperty(new Property("autocreate", ""+autocreate)); props.addProperty(new Property("autodelete", ""+autodelete)); for(int i=0; i<includes.size(); i++) props.addProperty(new Property("include", includes.get(i))); for(int i=0; i<excludes.size(); i++) props.addProperty(new Property("exclude", excludes.get(i))); return new Future<jadex.commons.Properties>(props); } });
/** * Get a double property. * @param type The type. * @return Returns the parsed double value, 0 if not set. */ public double getDoubleProperty(String type) { Property prop = getLatestProperty(type); return prop==null? 0: Double.parseDouble(prop.getValue()); }
public IFuture<jadex.commons.Properties> execute(IInternalAccess ia) { jadex.commons.Properties props = new jadex.commons.Properties(); // props.addProperty(new Property("address", address.getHostAddress())); // props.addProperty(new Property("port", ""+port)); // props.addProperty(new Property("delay", ""+delay)); props.addProperty(new Property("fast", ""+fast)); props.addProperty(new Property("autocreate", ""+autocreate)); props.addProperty(new Property("autodelete", ""+autodelete)); for(int i=0; i<includes.size(); i++) props.addProperty(new Property("include", includes.get(i))); for(int i=0; i<excludes.size(); i++) props.addProperty(new Property("exclude", excludes.get(i))); return new Future<jadex.commons.Properties>(props); } });
/** * Get a boolean property. * @param type The type. * @return Returns false if the property is not set. */ public static boolean getBooleanProperty(Properties[] props, String type) { Property prop = getLatestProperty(props, type); return prop!=null && Boolean.valueOf(prop.getValue()).booleanValue(); }
/** * Advices the panel provide its setting as properties (if any). * This is done on project close or save. */ public IFuture<Properties> getProperties() { Properties props = new Properties(); props.addProperty(new Property("showchars", Boolean.toString(cbshowchars.isSelected()))); props.addProperty(new Property("selected_tab", ""+((JTabbedPane)inner).getSelectedIndex())); props.addProperty(new Property("sph", ""+sph.getProportionalDividerLocation())); props.addProperty(new Property("spv", ""+spv.getProportionalDividerLocation())); return new Future<Properties>(props); }
/** * Get a string property. * @param type The type. * @return Returns the string value or null if not set. */ public static String getStringProperty(Properties[] props, String type) { Property prop = getLatestProperty(props, type); return prop==null? null: prop.getValue(); }
/** * Advices the panel provide its setting as properties (if any). * This is done on project close or save. */ public IFuture<Properties> getProperties() { Properties props = new Properties(); props.addProperty(new Property("showchars", Boolean.toString(cbshowchars.isSelected()))); props.addProperty(new Property("selected_tab", ""+((JTabbedPane)inner).getSelectedIndex())); props.addProperty(new Property("sph", ""+sph.getProportionalDividerLocation())); props.addProperty(new Property("spv", ""+spv.getProportionalDividerLocation())); return new Future<Properties>(props); }
/** * Get a boolean property. * @param type The type. * @return Returns false if the property is not set. */ public boolean getBooleanProperty(String type) { Property prop = getLatestProperty(type); //return prop!=null && Boolean.parseBoolean(prop.getValue()); return prop!=null && Boolean.valueOf(prop.getValue()).booleanValue(); }
/** * Get the properties of the mechanism. */ public Properties getProperties() { Properties props = new Properties(); props.addProperty(new Property("responses", ""+responses)); return props; }
/** * Get a long property. * @param type The type. * @return Returns the parsed long value, 0 if not set. */ public static long getLongProperty(Properties[] props, String type) { Property prop = getLatestProperty(props, type); return prop==null? 0: Long.parseLong(prop.getValue()); }
/** * Get the properties of the mechanism. */ public Properties getProperties() { Properties props = new Properties(); if(ttpcid!=null) props.addProperty(new Property("ttpcid", ttpcid.getName())); // props.addProperty(new Property("ttpcid", JavaWriter.objectToXML(ttpcid, null))); props.addProperty(new Property("verify", ""+verify)); return props; }
/** * Get an int property. * @param type The type. * @return Returns the parsed int value, 0 if not set. */ public int getIntProperty(String type) { Property prop = getLatestProperty(type); return prop==null? 0: Integer.parseInt(prop.getValue()); }