/** * Get the properties of the mechanism. */ public Properties getProperties() { Properties props = new Properties(); props.addProperty(new Property("responses", ""+responses)); return props; }
public void customResultAvailable(Object result) { props.removeSubproperties(id); props.addSubproperties(id, (Properties)result); crl.resultAvailable(null); } };
/** * Add the complete content of another properties. */ public void addProperties(Properties toadd) { Property[] subprops = toadd.getProperties(); for(int j=0; j<subprops.length; j++) { addProperty(subprops[j]); } Properties[] subpropis = toadd.getSubproperties(); for(int i=0; i<subpropis.length; i++) { // Properties tmp = getSubproperty(subpropis[i].getType()); // if(tmp!=null) // { // tmp.addProperties(subpropis[i]); // } // else { addSubproperties(subpropis[i]); } } }
/** * Add a subproperties to a properties. */ public void addSubproperties(String type, Properties subproperties) { if(subproperties.getType()!=null && !subproperties.getType().equals(type)) throw new IllegalArgumentException("Incompatible types: "+subproperties.getType()+", "+type); subproperties.setType(type); addSubproperties(subproperties); }
/** * Advices the the panel to restore its properties from the argument */ public IFuture<Void> setProperties(Properties props) { cbshowchars.setSelected(props.getBooleanProperty("showchars")); ((JTabbedPane)inner).setSelectedIndex(props.getIntProperty("selected_tab")); if(props.getProperty("sph")!=null) sph.setDividerLocation(props.getDoubleProperty("sph")); if(props.getProperty("spv")!=null) spv.setDividerLocation(props.getDoubleProperty("spv")); return IFuture.DONE; }
fis.close(); Properties windowprops = props.getSubproperty("window"); if(windowprops != null) int w = windowprops.getIntProperty("width"); int h = windowprops.getIntProperty("height"); int x = windowprops.getIntProperty("x"); int y = windowprops.getIntProperty("y"); window.setBounds(x, y, w, h); int es = windowprops.getIntProperty("extendedState"); window.setExtendedState(es); jccexit = windowprops.getStringProperty("jccexit"); saveonexit = saveonexit && windowprops.getBooleanProperty("saveonexit"); props = new Properties();
Properties windowprops = new Properties(); windowprops.addProperty(new Property("width", Integer.toString(window.getWidth()))); windowprops.addProperty(new Property("height", Integer.toString(window.getHeight()))); windowprops.addProperty(new Property("x", Integer.toString(window.getX()))); windowprops.addProperty(new Property("y", Integer.toString(window.getY()))); windowprops.addProperty(new Property("extendedState", Integer.toString(window.getCachedState()))); windowprops.addProperty(new Property("jccexit", jccexit != null? jccexit : JCC_EXIT_ASK)); windowprops.addProperty(new Property("saveonexit", Boolean.toString(saveonexit))); props.removeSubproperties("window"); props.addSubproperties("window", windowprops);
teststable.setAllowDuplicates(props.getBooleanProperty("allowduplicates")); allowduplicates.setSelected(props.getBooleanProperty("allowduplicates")); if(props.getProperty("timeout")!=null) timeout = props.getStringProperty("timeout"); tfto.setText(timeout); if(props.getProperty("concurrency")!=null) concurrency = props.getIntProperty("concurrency"); if(concurrency==-1) tfpar.getModel().setSelectedItem("all"); Properties[] entries = props.getSubproperties("entry"); final CollectionResultListener<Tuple2<String, IResourceIdentifier>> crl = new CollectionResultListener<Tuple2<String, IResourceIdentifier>>(entries.length, false, for(int i=0; i<entries.length; i++) final String name = entries[i].getStringProperty("model"); String ridurl = entries[i].getStringProperty("ridurl"); String globalrid = entries[i].getStringProperty("globalrid"); SRemoteGui.createResourceIdentifier(plugin.getJCC().getPlatformAccess(), ridurl, globalrid) .addResultListener(new ExceptionDelegationResultListener<IResourceIdentifier, Void>(ret)
long delay = props.getLongProperty("delay"); if(delay>0) setDelay(delay); setFastAwareness(props.getProperty("fast")!=null ? props.getBooleanProperty("fast") : true); setAutoCreateProxy(props.getProperty("autocreate")!=null ? props.getBooleanProperty("autocreate") : true); setAutoDeleteProxy(props.getProperty("autodelete")!=null ? props.getBooleanProperty("autodelete") : true); Property[] pincs = props.getProperties("include"); String[] incs = new String[pincs.length]; for(int i=0; i<pincs.length; i++) setIncludes(incs); Property[] pexcs = props.getProperties("exclude"); String[] excs = new String[pexcs.length]; for(int i=0; i<pexcs.length; i++)
public void customResultAvailable(IResourceIdentifier rid) { lastrid = rid; Property[] aargs = props.getProperties("argument"); loadargs = new String[aargs.length]; for(int i=0; i<aargs.length; i++) { loadargs[i] = aargs[i].getValue(); } final String mo = props.getStringProperty("model"); if(mo!=null) { lastfile = mo; loadconfig = props.getStringProperty("config"); loadname = props.getStringProperty("name"); reloadModel(); } setStartSuspended(props.getBooleanProperty("startsuspended")); setAutoGenerate(props.getBooleanProperty("autogenerate")); numcomponents.setValue(Integer.valueOf(props.getIntProperty("number"))); ret.setResult(null); } });
public void customResultAvailable(Properties subprops) { // Properties subprops = (Properties)result; props.addSubproperties(PANELPROPERTIES, subprops!=null ? subprops : new Properties()); ret.setResult(props); }; });
/** * Update from given properties. */ public IFuture<Void> setProperties(Properties props) { // Do not change clock when explicitly started in specific mode if(simulation==null) { String type = props.getStringProperty("type"); long delta = props.getLongProperty("delta"); double dilation = props.getDoubleProperty("dilation"); setClock(type, threadpool); clock.setDelta(delta); if(clock instanceof ContinuousClock) ((ContinuousClock)clock).setDilation(dilation); } return IFuture.DONE; }
String last = type.substring(idx+1); Properties[] subprops = getSubproperties(first); for(int i=0; i<subprops.length; i++) Property[] ps = subprops[i].getProperties(last); for(int j=0; j<ps.length; j++) ret.add(ps[j]);
/** * Get the latest property by type. * @param type The type name. */ public Property getLatestProperty(String type) { Property[] props = getProperties(type); // System.out.println("here: "+type+" "+SUtil.arrayToString(props)); return props.length>0? props[props.length-1]: null; }
/** * Get the properties for a given id. * @param id A unique id to identify the properties (e.g. component or service name). * @return A future containing the properties (if any). */ public IFuture<Properties> getProperties(String id) { return new Future<Properties>(props.getSubproperty(id)); }
public void customResultAvailable(Properties sub) { // Properties sub = (Properties)result; props.removeSubproperties(panel.getId()); if(sub!=null) { sub.setType(panel.getId()); props.addSubproperties(sub); } ret.setResult(props); }; });
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 from given properties. */ public IFuture<Void> setProperties(Properties props) { String tmp = props.getStringProperty("nickname"); if(tmp!=null) setNickName(tmp); tmp = props.getStringProperty("image"); if(tmp!=null) setImage(Base64.decode(tmp.getBytes(Charset.forName("UTF-8")))); called.setResultIfUndone(null); return IFuture.DONE; }
Properties[] links = props.getSubproperties("link"); for(int i=0; i<links.length; i++) Properties pa = links[i].getSubproperty("a"); Properties pb = links[i].getSubproperty("b");
String ar = props.getStringProperty("autorefresh"); if(ar!=null) updateRefreshTimer(); String snd = props.getStringProperty("sound"); if(snd!=null) double lp = props.getDoubleProperty("listpan"); if(lp!=0) double hs = props.getDoubleProperty("horsplit"); if(hs!=0) snd = props.getStringProperty(NOTIFICATION_FILE_ABORT); if(snd!=null) snd = props.getStringProperty(NOTIFICATION_FILE_COMPLETE); if(snd!=null) snd = props.getStringProperty(NOTIFICATION_NEW_FILE); if(snd!=null) snd = props.getStringProperty(NOTIFICATION_NEW_MSG); if(snd!=null) snd = props.getStringProperty(NOTIFICATION_NEW_USER); if(snd!=null)