Sends a job to this tool and specifies a tool to reply to. @param job the Job @param replyTo the tool to notify when the job is complete (may be null)
(Job job, Tool replyTo)
| 850 | * @param replyTo the tool to notify when the job is complete (may be null) |
| 851 | */ |
| 852 | @Override |
| 853 | public void send(Job job, Tool replyTo) { |
| 854 | XMLControlElement control = new XMLControlElement(job.getXML()); |
| 855 | if (control.failedToRead() || (control.getObjectClass() == Object.class)) { |
| 856 | return; |
| 857 | } |
| 858 | // if control defines Data, construct the Data |
| 859 | if (Data.class.isAssignableFrom(control.getObjectClass())) { |
| 860 | Data data = (Data) control.loadObject(null, true, true); |
| 861 | // if self-contained, then send job to an existing tab or create a new tab |
| 862 | if (isSelfContained(data)) { |
| 863 | DataToolTab tab = getTab(data); // may be null |
| 864 | if (tab == null) { |
| 865 | tab = createTab(null); |
| 866 | String name = data.getName(); |
| 867 | if ((name != null) && !name.equals("")) { //$NON-NLS-1$ ) |
| 868 | tab.setName(name); |
| 869 | } |
| 870 | addTab(tab); |
| 871 | } else { |
| 872 | setSelectedTab(tab); |
| 873 | } |
| 874 | tab.receiveJobControl(job, replyTo, control); |
| 875 | } else { |
| 876 | // if data is a container, then send a new job to an existing tab |
| 877 | // or create a new tab |
| 878 | for (Data next : getSelfContainedData(data)) { |
| 879 | DataToolTab tab = getTab(next); // may be null |
| 880 | if (tab == null) { |
| 881 | tab = createTab(null); |
| 882 | String name = next.getName(); |
| 883 | if ((name != null) && !name.equals("")) { //$NON-NLS-1$ ) |
| 884 | tab.setName(name); |
| 885 | } |
| 886 | addTab(tab); |
| 887 | } |
| 888 | tab.send(new LocalJob(next), replyTo); |
| 889 | } |
| 890 | } |
| 891 | } else { |
| 892 | // else add tabs based on child Data objects, if any, within the control |
| 893 | addTabs(control, null); // adds Data objects found in XMLControl |
| 894 | } |
| 895 | toFront(); |
| 896 | } |
| 897 | |
| 898 | /** |
| 899 | * Sets the useChooser flag. |
nothing calls this directly
no test coverage detected