本文整理汇总了Java中org.opensourcephysics.controls.XMLControl.toXML方法的典型用法代码示例。如果您正苦于以下问题:Java XMLControl.toXML方法的具体用法?Java XMLControl.toXML怎么用?Java XMLControl.toXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensourcephysics.controls.XMLControl
的用法示例。
在下文中一共展示了XMLControl.toXML方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendReplies
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Replies to tools interested in the specified object.
*
* @param obj the object
*/
public void sendReplies(Object obj) {
Job[] jobs = getJobs(obj);
XMLControl control = new XMLControlElement(obj);
String xml = control.toXML();
for(int i = 0; i<jobs.length; i++) {
try {
jobs[i].setXML(xml);
} catch(RemoteException ex) {
ex.printStackTrace();
}
sendReplies(jobs[i]);
}
}
示例2: launch
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Launches this node from the specified launch panel.
*
* @param tab the launch panel
*/
public void launch(LaunchPanel tab) {
if(!isLeaf()) {
return;
}
launchPanel = tab;
OSPRuntime.launchingInSingleVM = this.isSingleVM();
Launcher.singleAppMode = this.isSingleApp();
Launcher.classPath = getClassPath(); // in node-to-root order
if(isShowLog()&&isSingleVM()) {
OSPLog.setLevel(getLogLevel());
OSPLog log = OSPLog.getOSPLog();
if(isClearLog()) {
log.clear();
}
log.setVisible(true);
}
setMinimumArgLength(1); // trim args if nec
String arg0 = args[0];
if(getLaunchClass()!=null) {
if(arg0.equals("this")) { //$NON-NLS-1$
Object launchObj = getLaunchObject();
if(launchObj!=null) {
// replace with xml from launch object, if any
XMLControl control = new XMLControlElement(launchObj);
args[0] = control.toXML();
} else {
args[0] = ""; //$NON-NLS-1$
}
}
if(args[0].equals("")&&(args.length==1)) { //$NON-NLS-1$
Launcher.launch(getLaunchClass(), null, this);
} else {
Launcher.launch(getLaunchClass(), args, this);
}
}
args[0] = arg0;
}
示例3: copy
import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
* Copies an array of objects to the clipboard.
*
* @param array the array
*/
private void copy(Object[] array) {
if((array!=null)&&(array.length>0)) {
XMLControl control = new XMLControlElement(this);
control.setValue("selected", array); //$NON-NLS-1$
StringSelection ss = new StringSelection(control.toXML());
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(ss, ss);
pasteButton.setEnabled(true);
firePropertyChange("clipboard", null, null); //$NON-NLS-1$
}
}