本文整理汇总了Java中org.opensourcephysics.controls.XMLControl.getString方法的典型用法代码示例。如果您正苦于以下问题:Java XMLControl.getString方法的具体用法?Java XMLControl.getString怎么用?Java XMLControl.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensourcephysics.controls.XMLControl
的用法示例。
在下文中一共展示了XMLControl.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
DatasetManager dsm = (DatasetManager) obj;
dsm.connected = control.getBoolean("connected"); //$NON-NLS-1$
dsm.sorted = control.getBoolean("sorted"); //$NON-NLS-1$
dsm.markerShape = control.getInt("maker_shape"); //$NON-NLS-1$
dsm.stride = control.getInt("stride"); //$NON-NLS-1$
dsm.linked = control.getBoolean("linked"); //$NON-NLS-1$
dsm.xColumnName = control.getString("x_column_name"); //$NON-NLS-1$
dsm.yColumnName = control.getString("y_column_name"); //$NON-NLS-1$
dsm.setName(control.getString("data_name")); //$NON-NLS-1$
if (control.getPropertyNames().contains("id")) { //$NON-NLS-1$
dsm.setID(control.getInt("id")); //$NON-NLS-1$
}
dsm.removeDatasets();
Collection<?> datasets = Collection.class.cast(control.getObject("datasets")); //$NON-NLS-1$
if(datasets!=null) {
Iterator<?> it = datasets.iterator();
while(it.hasNext()) {
dsm.datasets.add((Dataset) it.next());
}
}
return obj;
}
示例2: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
InteractiveShape interactiveShape = (InteractiveShape) obj;
String type = control.getString("geometry"); //$NON-NLS-1$
double x = control.getDouble("x"); //$NON-NLS-1$
double y = control.getDouble("y"); //$NON-NLS-1$
double theta = control.getDouble("theta"); //$NON-NLS-1$
Shape shape = getShape(type, x, y, control.getDouble("width"), control.getDouble("height")); //$NON-NLS-1$ //$NON-NLS-2$
if(shape==null) { // check for special geometry
interactiveShape.shape = (GeneralPath) control.getObject("general path"); //$NON-NLS-1$
} else {
interactiveShape.shape = shape;
}
// the shape should already be scaled so just set the instatance fields
interactiveShape.width = control.getDouble("width"); //$NON-NLS-1$
interactiveShape.height = control.getDouble("height"); //$NON-NLS-1$
interactiveShape.xoff = control.getDouble("x offset"); //$NON-NLS-1$
interactiveShape.yoff = control.getDouble("y offset"); //$NON-NLS-1$
interactiveShape.x = x;
interactiveShape.y = y;
interactiveShape.setPixelSized(control.getBoolean("pixel sized")); //$NON-NLS-1$
interactiveShape.setEnabled(control.getBoolean("is enabled")); //$NON-NLS-1$
interactiveShape.setMeasured(control.getBoolean("is measured")); //$NON-NLS-1$
interactiveShape.color = (Color) control.getObject("color"); //$NON-NLS-1$
interactiveShape.setTheta(theta); // orient the shape
return obj;
}
示例3: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
Histogram his = (Histogram) obj;
double[] bins = (double[]) control.getObject("bins"); //$NON-NLS-1$
double[] vals = (double[]) control.getObject("vals"); //$NON-NLS-1$
his.name = control.getString("name"); //$NON-NLS-1$
his.xColumnName = control.getString("x_column_name"); //$NON-NLS-1$
his.yColumnName = control.getString("y_column_name"); //$NON-NLS-1$
his.binColumnName = control.getString("bin_column_name"); //$NON-NLS-1$
his.logScale = control.getBoolean("log_scale"); //$NON-NLS-1$
his.discrete = control.getBoolean("discrete"); //$NON-NLS-1$
his.adjustForWidth = control.getBoolean("adjust_for_width"); //$NON-NLS-1$
his.binFillColor = (Color) control.getObject("bin_fill_color"); //$NON-NLS-1$
his.binEdgeColor = (Color) control.getObject("bin_edge_color"); //$NON-NLS-1$
his.binStyle = control.getInt("bin_style"); //$NON-NLS-1$
his.binWidth = control.getDouble("bin_width"); //$NON-NLS-1$
his.binOffset = control.getDouble("bin_offset"); //$NON-NLS-1$
his.adjustForWidth = control.getBoolean("adjust_for_width"); //$NON-NLS-1$
if((bins!=null)&&(vals!=null)) {
for(int i = 0, n = bins.length; i<n; i++) {
his.append(bins[i], vals[i]);
}
}
return obj;
}
示例4: getSearchCacheTargets
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Returns the set of all searchable cache resources.
*
* @return a set of searchable resources
*/
protected Set<LibraryResource> getSearchCacheTargets() {
// set up search targets
Set<LibraryResource> searchTargets = new TreeSet<LibraryResource>();
File cache = ResourceLoader.getSearchCache();
FileFilter xmlFilter = new XMLFilter();
List<File> xmlFiles = ResourceLoader.getFiles(cache, xmlFilter);
for (File file: xmlFiles) {
XMLControl control = new XMLControlElement(file.getAbsolutePath());
if (!control.failedToRead() && LibraryResource.class.isAssignableFrom(control.getObjectClass())) {
LibraryResource resource = (LibraryResource)control.loadObject(null);
resource.collectionPath = control.getString("real_path"); //$NON-NLS-1$
searchTargets.add(resource);
}
}
return searchTargets;
}
示例5: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Loads an object with data from an XMLControl.
*
* @param control the control
* @param obj the object
* @return the loaded object
*/
public Object loadObject(XMLControl control, Object obj) {
GroupControl groupcontrol = (GroupControl) obj;
Hashtable<String, GroupVariable> table = groupcontrol.variableTable;
Iterator<String> it = table.keySet().iterator();
while(it.hasNext()) {
String name = it.next();
if(control.getString(name)!=null) {
groupcontrol.setValue(name, control.getString(name));
} else if(control.getObject(name)!=null) {
Object namedObj = control.getObject(name);
if(namedObj instanceof java.awt.Color) {
groupcontrol.setValue(name, namedObj);
}
if(namedObj.getClass().isArray()) {
groupcontrol.setValue(name, namedObj);
} else {
groupcontrol.setValue(name, namedObj.toString());
}
}
}
return obj;
}
示例6: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
UserFunction f = (UserFunction) obj;
f.setName(control.getString("name")); //$NON-NLS-1$
f.setDescription(control.getString("description")); //$NON-NLS-1$
if(control.getPropertyNames().contains("name_editable")) { //$NON-NLS-1$
f.setNameEditable(control.getBoolean("name_editable")); //$NON-NLS-1$
}
String[] names = (String[]) control.getObject("parameter_names"); //$NON-NLS-1$
if(names!=null) {
double[] values = (double[]) control.getObject("parameter_values"); //$NON-NLS-1$
String[] desc = (String[]) control.getObject("parameter_descriptions"); //$NON-NLS-1$
f.setParameters(names, values, desc);
}
String[] vars = (String[]) control.getObject("variables"); //$NON-NLS-1$
if(vars==null) { // for legacy code
String var = control.getString("variable"); //$NON-NLS-1$
vars = new String[] {var};
}
f.setExpression(control.getString("expression"), vars); //$NON-NLS-1$
double[] coeff = (double[])control.getObject("polynomial"); //$NON-NLS-1$
if (coeff!=null) {
f.polynomial = new KnownPolynomial(coeff);
}
return obj;
}
示例7: createObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Creates a new XuggleVideo.
*
* @param control the control
* @return the new XuggleVideo
*/
public Object createObject(XMLControl control) {
try {
String path = control.getString("path"); //$NON-NLS-1$
String ext = XML.getExtension(path);
XuggleVideo video = new XuggleVideo(path);
VideoType xuggleType = VideoIO.getVideoType(VideoIO.ENGINE_XUGGLE, ext);
if (xuggleType!=null)
video.setProperty("video_type", xuggleType); //$NON-NLS-1$
return video;
} catch(IOException ex) {
OSPLog.fine(ex.getMessage());
return null;
}
}
示例8: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
ComplexDataset data = (ComplexDataset) obj;
double[][] points = (double[][]) control.getObject("points"); //$NON-NLS-1$
if((points!=null)&&(points[0]!=null)) {
data.clear();
for(int i = 0; i<points.length; i++) {
data.append(points[i][0], points[i][1], points[i][2]);
}
}
// for backward compatibility
double[] xPoints = (double[]) control.getObject("x_points"); //$NON-NLS-1$
double[] yPoints = (double[]) control.getObject("y_points"); //$NON-NLS-1$
if((xPoints!=null)&&(yPoints!=null)) {
data.clear();
data.append(xPoints, yPoints);
}
if(control.getPropertyNames().contains("marker_shape")) { //$NON-NLS-1$
data.setMarkerShape(control.getInt("marker_shape")); //$NON-NLS-1$
}
if(control.getPropertyNames().contains("marker_size")) { //$NON-NLS-1$
data.setMarkerSize(control.getInt("marker_size")); //$NON-NLS-1$
}
data.setSorted(control.getBoolean("sorted")); //$NON-NLS-1$
data.setConnected(control.getBoolean("connected")); //$NON-NLS-1$
data.name = control.getString("name"); //$NON-NLS-1$
data.xColumnName = control.getString("x_name"); //$NON-NLS-1$
data.reColumnName = control.getString("re_name"); //$NON-NLS-1$
data.imColumnName = control.getString("im_name"); //$NON-NLS-1$
Color color = (Color) control.getObject("line_color"); //$NON-NLS-1$
if(color!=null) {
data.lineColor = color;
}
data.index = control.getInt("index"); //$NON-NLS-1$
return obj;
}
示例9: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
FitFunctionPanel panel = (FitFunctionPanel) obj;
Parameter[] params = (Parameter[]) control.getObject("user_parameters"); //$NON-NLS-1$
panel.getParamEditor().setParameters(params);
panel.getFitFunctionEditor().parametersValid = false;
panel.getFitFunctionEditor().evaluateAll();
panel.originalName = control.getString("original_name"); //$NON-NLS-1$
return obj;
}
示例10: createObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Creates a PlottingPanel.
*
* @param control the control
* @return the newly created panel
*/
public Object createObject(XMLControl control) {
String title = control.getString("title"); //$NON-NLS-1$
String xlabel = control.getString("x axis label"); //$NON-NLS-1$
String ylabel = control.getString("y axis label"); //$NON-NLS-1$
return new PlottingPanel(xlabel, ylabel, title);
}
示例11: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
Element element = (Element) obj;
String name = control.getString("name"); //$NON-NLS-1$
if(name!=null) {
element.setName(name);
}
element.setXYZ(control.getDouble("x"), control.getDouble("y"), control.getDouble("z")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
element.setSizeXYZ(control.getDouble("x size"), control.getDouble("y size"), control.getDouble("z size")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
element.setVisible(control.getBoolean("visible")); //$NON-NLS-1$
element.setTransformation((Transformation) control.getObject("transformation")); //$NON-NLS-1$
// Subclasses are responsible of loading unmutable elements, such as the style
// this is done by the following method:
element.loadUnmutableObjects(control);
return obj;
}
示例12: createObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Creates a new GifVideo.
*
* @param control the control
* @return the new GifVideo
*/
public Object createObject(XMLControl control) {
try {
String path = control.getString("path"); //$NON-NLS-1$
GifVideo video = new GifVideo(path);
VideoType gifType = VideoIO.getVideoType("gif", null); //$NON-NLS-1$
if (gifType!=null)
video.setProperty("video_type", gifType); //$NON-NLS-1$
return video;
} catch(IOException ex) {
OSPLog.fine(ex.getMessage());
return null;
}
}
示例13: loadObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Loads a filter with data from an XMLControl.
*
* @param control the control
* @param obj the filter
* @return the loaded object
*/
public Object loadObject(XMLControl control, Object obj) {
final RotateFilter filter = (RotateFilter) obj;
String typeName = control.getString("rotation"); //$NON-NLS-1$ // could be null
for (int i = 0; i<RotateFilter.typeNames.length; i++) {
if (RotateFilter.typeNames[i].equals(typeName))
filter.rotationType = RotateFilter.types[i];
}
filter.reverse = control.getBoolean("reverse"); //$NON-NLS-1$
filter.inspectorX = control.getInt("inspector_x"); //$NON-NLS-1$
filter.inspectorY = control.getInt("inspector_y"); //$NON-NLS-1$
return obj;
}
示例14: createObject
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object createObject(XMLControl control) {
String name = control.getString("name"); //$NON-NLS-1$
if(name==null) {
name = LaunchRes.getString("NewNode.Name"); //$NON-NLS-1$
}
return new LaunchNode(name);
}
示例15: send
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Adds frame specified by image file path.
*
* @param job the job
* @param replyTo the tool to reply to
* @throws RemoteException
*/
public void send(Job job, Tool replyTo) throws RemoteException {
if(job==null) {
return;
}
XMLControl control = new XMLControlElement(job.getXML());
String path = control.getString("imagepath"); //$NON-NLS-1$
if(path!=null) {
BufferedImage image = ResourceLoader.getBufferedImage(path);
if(image!=null) {
addFrame(image);
}
}
}