List of usage examples for java.util Vector addAll
public boolean addAll(Collection<? extends E> c)
From source file:edu.ku.brc.specify.config.SpecifyAppContextMgr.java
/** * Returns a Default Object from Prefs if there is one. *///from ww w. ja v a2 s. c om @SuppressWarnings("cast") //$NON-NLS-1$ public PickListItemIFace getDefaultPickListItem(final String pickListName, final String title) { PickListItemIFace dObj = null; Collection collection = getClassObject(Collection.class); String prefName = (collection != null ? collection.getIdentityTitle() : "") + pickListName + "_DefaultId"; //$NON-NLS-1$ //$NON-NLS-2$ AppPreferences appPrefs = AppPreferences.getRemote(); String idStr = appPrefs.get(prefName, null); if (StringUtils.isNotEmpty(idStr)) { DataProviderSessionIFace session = null; try { session = DataProviderFactory.getInstance().createSession(); dObj = (PickListItemIFace) session.get(PickListItem.class, Integer.valueOf(idStr)); } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifyAppContextMgr.class, ex); log.error(ex); } finally { if (session != null) { session.close(); } } if (dObj != null) { return dObj; } } DataProviderSessionIFace session = DataProviderFactory.getInstance().createSession(); try { PickList pickList = (PickList) session.getData(PickList.class, "name", pickListName, //$NON-NLS-1$ DataProviderSessionIFace.CompareType.Equals); if (pickList != null) { Vector<PickListItemIFace> list = new Vector<PickListItemIFace>(); for (PickListItem itm : pickList.getPickListItems()) { itm.getTitle(); } list.addAll(pickList.getItems()); ChooseFromListDlg<PickListItemIFace> plDlg = new ChooseFromListDlg<PickListItemIFace>((Frame) null, getLocalizedMessage(L10N + "CHS_DEF_OBJ", title), list); //$NON-NLS-1$ plDlg.setModal(true); plDlg.setVisible(true); if (!plDlg.isCancelled()) { appPrefs.put(prefName, plDlg.getSelectedObject().getId().toString()); return plDlg.getSelectedObject(); } return null; } // error dialog "Unable load the PickList and it's items." throw new RuntimeException("PickList name[" + pickListName + "] doesn't exist."); //$NON-NLS-1$ //$NON-NLS-2$ } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifyAppContextMgr.class, ex); log.error(ex); // error dialog "Unable load the PickList and it's items." } finally { session.close(); } return dObj; }
From source file:ucar.unidata.idv.flythrough.Flythrough.java
/** * _more_//from w ww. j a va 2s . com * * @param pt _more_ * * @return _more_ */ private boolean showProperties(FlythroughPoint pt) { try { DateTime[] times = viewManager.getAnimationWidget().getTimes(); JComboBox timeBox = null; JLabel timeLabel = GuiUtils.rLabel("Time:"); Vector timesList = new Vector(); timesList.add(0, new TwoFacedObject("None", null)); if ((times != null) && (times.length > 0)) { timesList.addAll(Misc.toList(times)); } if ((pt.getDateTime() != null) && !timesList.contains(pt.getDateTime())) { timesList.add(pt.getDateTime()); } timeBox = new JComboBox(timesList); if (pt.getDateTime() != null) { timeBox.setSelectedItem(pt.getDateTime()); } LatLonWidget llw = new LatLonWidget("Latitude: ", "Longitude: ", "Altitude: ", null) { protected String formatLatLonString(String latOrLon) { return latOrLon; } }; EarthLocation el = pt.getEarthLocation(); llw.setLatLon(el.getLatitude().getValue(CommonUnit.degree), el.getLongitude().getValue(CommonUnit.degree)); llw.setAlt(getAlt(el)); JTextArea textArea = new JTextArea("", 5, 100); if (pt.getDescription() != null) { textArea.setText(pt.getDescription()); } JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setPreferredSize(new Dimension(400, 300)); JComponent contents = GuiUtils.formLayout(new Component[] { GuiUtils.rLabel("Location:"), llw, timeLabel, GuiUtils.left(timeBox), GuiUtils.rLabel("Description:"), scrollPane }); if (!GuiUtils.showOkCancelDialog(frame, "Point Properties", contents, null)) { return false; } pt.setDescription(textArea.getText()); pt.setEarthLocation(makePoint(llw.getLat(), llw.getLon(), llw.getAlt())); Object selectedDate = timeBox.getSelectedItem(); if (selectedDate instanceof TwoFacedObject) { pt.setDateTime(null); } else { pt.setDateTime((DateTime) selectedDate); } return true; } catch (Exception exc) { logException("Showing point properties", exc); return false; } }
From source file:org.openflexo.foundation.wkf.FlexoProcess.java
/** * Return a vector of all embedded objects on which the validation will be performed * // w w w.j ava2 s . c o m * @return a Vector of Validable objects */ @Override public Vector<Validable> getAllEmbeddedValidableObjects() { Vector<Validable> returned = new Vector<Validable>(); returned.addAll(getAllEmbeddedWKFObjects()); for (Enumeration en = getAllEmbeddedOperationNodes().elements(); en.hasMoreElements();) { OperationNode next = (OperationNode) en.nextElement(); if (next.getComponentInstance() != null) { returned.add(next.getComponentInstance()); } } return returned; }
From source file:org.openflexo.foundation.wkf.FlexoProcess.java
public Vector<PetriGraphNode> getAllAbstractActivityNodesAndActivityOperators() { if (_petriGraph != null) { Vector<PetriGraphNode> v = new Vector<PetriGraphNode>(); v.addAll(_petriGraph.getAllEmbeddedAbstractActivityNodes()); v.addAll(_petriGraph.getAllEmbeddedOperatorsOfSameLevel()); return v; } else {/*from ww w . jav a 2 s. c o m*/ return new Vector<PetriGraphNode>(); } }
From source file:org.openflexo.foundation.wkf.FlexoProcess.java
public Vector<PetriGraphNode> getAllAbstractActivityNodesAndActivityOperatorsWithEvents() { if (_petriGraph != null) { Vector<PetriGraphNode> v = new Vector<PetriGraphNode>(); v.addAll(_petriGraph.getAllEmbeddedNodesOfClass(AbstractActivityNode.class)); v.addAll(_petriGraph.getAllEmbeddedNodesOfClassOfSameLevel(OperatorNode.class)); v.addAll(_petriGraph.getAllEmbeddedNodesOfClassOfSameLevel(EventNode.class)); return v; } else {// ww w .j a v a 2 s . co m return new Vector<PetriGraphNode>(); } }
From source file:org.openflexo.foundation.wkf.FlexoProcess.java
@Override public List<ApplicationHelpEntryPoint> getChildsHelpObjects() { Vector<ApplicationHelpEntryPoint> reply = new Vector<ApplicationHelpEntryPoint>(); reply.addAll(getAllActivityNodes()); return reply; }
From source file:org.openflexo.foundation.wkf.FlexoProcess.java
private void appendAllNodes(WKFNode node, Vector<WKFNode> returned) { returned.add(node);/*from w ww . jav a 2 s . c o m*/ if (node instanceof FlexoNode) { returned.addAll(((FlexoNode) node).getPreConditions()); } if (node instanceof SubProcessNode) { if (((SubProcessNode) node).getPortMapRegistery() != null) { returned.addAll(((SubProcessNode) node).getPortMapRegistery().getPortMaps()); } } if (node instanceof AbstractActivityNode && ((AbstractActivityNode) node).hasContainedPetriGraph()) { appendAllNodesOfPetriGraph(((AbstractActivityNode) node).getContainedPetriGraph(), returned); } if (node instanceof OperationNode && ((OperationNode) node).hasContainedPetriGraph()) { appendAllNodesOfPetriGraph(((OperationNode) node).getContainedPetriGraph(), returned); } if (node instanceof SelfExecutableNode && ((SelfExecutableNode) node).hasExecutionPetriGraph()) { appendAllNodesOfPetriGraph(((SelfExecutableNode) node).getExecutionPetriGraph(), returned); } if (node instanceof LOOPOperator && ((LOOPOperator) node).hasExecutionPetriGraph()) { appendAllNodesOfPetriGraph(((LOOPOperator) node).getExecutionPetriGraph(), returned); } }
From source file:org.openflexo.foundation.wkf.FlexoProcess.java
private void buildNameForNodeMap() { Vector<AbstractNode> nodes = getActivityPetriGraph().getAllEmbeddedNodesOfClass(AbstractNode.class); nodes.addAll(getPortRegistery().getAllPorts()); Collections.sort(nodes, new Comparator<FlexoModelObject>() { @Override/*w ww . jav a2 s .co m*/ public int compare(FlexoModelObject o1, FlexoModelObject o2) { return o1.compareTo(o2); } }); for (FlexoProcess process : getWorkflow().getAllLocalFlexoProcesses()) { nameForNodeMap.put(ToolBox.uncapitalize(ToolBox.getJavaName(process.getName())), process); } for (FlexoProcess process : getWorkflow().getAllImportedFlexoProcesses()) { nameForNodeMap.put(ToolBox.uncapitalize(ToolBox.getJavaName(process.getName())), process); } if (getProcessDMEntity() != null) { for (DMObject obj : getProcessDMEntity().getOrderedChildren()) { nameForNodeMap.put(ToolBox.uncapitalize(ToolBox.getJavaName(obj.getName())), obj); } } for (AbstractNode node : nodes) { computeAndStoreNameForNode(node); } }
From source file:org.openflexo.foundation.wkf.FlexoProcess.java
private void appendAllAbstractNodes(AbstractNode node, Vector<AbstractNode> returned) { returned.add(node);//from www.j a v a 2s. c om if (node instanceof FlexoNode) { returned.addAll(((FlexoNode) node).getPreConditions()); } if (node instanceof SubProcessNode) { if (((SubProcessNode) node).getPortMapRegistery() != null) { returned.addAll(((SubProcessNode) node).getPortMapRegistery().getPortMaps()); } } if (node instanceof AbstractActivityNode && ((AbstractActivityNode) node).hasContainedPetriGraph()) { appendAllAbstractNodesOfPetriGraph(((AbstractActivityNode) node).getContainedPetriGraph(), returned); } if (node instanceof OperationNode && ((OperationNode) node).hasContainedPetriGraph()) { appendAllAbstractNodesOfPetriGraph(((OperationNode) node).getContainedPetriGraph(), returned); } if (node instanceof SelfExecutableNode && ((SelfExecutableNode) node).hasExecutionPetriGraph()) { appendAllAbstractNodesOfPetriGraph(((SelfExecutableNode) node).getExecutionPetriGraph(), returned); } if (node instanceof LOOPOperator && ((LOOPOperator) node).hasExecutionPetriGraph()) { appendAllAbstractNodesOfPetriGraph(((LOOPOperator) node).getExecutionPetriGraph(), returned); } }
From source file:org.openflexo.foundation.wkf.FlexoProcess.java
private void appendAllNodesOfPetriGraph(FlexoPetriGraph pg, Vector<WKFNode> returned) { for (AbstractNode n : pg.getNodes()) { appendAllNodes(n, returned);/*from w w w .j a va 2 s. com*/ } returned.addAll(pg.getArtefacts()); }