Java Code Examples for org.apache.uima.cas.CAS#getViewName()
The following examples show how to use
org.apache.uima.cas.CAS#getViewName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotationEditor.java From uima-uimaj with Apache License 2.0 | 5 votes |
@Override public void fill(Menu parentMenu, int index) { CAS cas = casEditor.getDocument().getCAS(); for (Iterator<CAS> it = cas.getViewIterator(); it.hasNext(); ) { CAS casView = it.next(); final String viewName = casView.getViewName(); final MenuItem actionItem = new MenuItem(parentMenu, SWT.CHECK); actionItem.setText(viewName); // TODO: Disable non-text views, check mime-type try { actionItem.setEnabled(cas.getDocumentText() != null); } catch (Throwable t) { // TODO: Not nice, discuss better solution on ml actionItem.setEnabled(false); } // TODO: Add support for non text views, editor has // to display some error message if (cas.getViewName().equals(viewName)) actionItem.setSelection(true); // TODO: move this to an action actionItem.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { // Trigger only if view is really changed // TODO: Move this check to the document itself ... if(!casEditor.getDocument().getCAS().getViewName().equals(viewName)) { casEditor.showView(viewName); } } }); } }
Example 2
Source File: CASArtifact.java From biomedicus with Apache License 2.0 | 4 votes |
CASDocument(CAS view, @Nullable LabelAdapters labelAdapters) { super(view.getViewName(), view.getDocumentText()); this.view = view; this.labelAdapters = labelAdapters; }
Example 3
Source File: UimacppEngine.java From uima-uimaj with Apache License 2.0 | 4 votes |
/** * process the document. * @param rs the result specification * @param aCas the CAS * @param casIsEmpty tbd * @throws UimacppException wraps any exception */ public void process(ResultSpecification rs, CAS aCas, boolean casIsEmpty) throws UimacppException { int isTCas=0; String sofaName=aCas.getViewName(); if (sofaName != null) { isTCas=1; } cas = aCas.getCurrentView(); try { resetJNI(); if (!casIsEmpty) { CASSerializer casSerializerIn = Serialization.serializeCAS(cas); /** * fillCASJNI(casSerializerIn.heapArray, casSerializerIn.fsIndex, * casSerializerIn.stringTable); */ fillCASJNI(casSerializerIn.heapArray, casSerializerIn.fsIndex, casSerializerIn.stringTable, casSerializerIn.byteHeapArray, casSerializerIn.shortHeapArray, casSerializerIn.longHeapArray); } IntVector resultSpecTypes = new IntVector(); IntVector resultSpecFeatures = new IntVector(); if (rs != null) { serializeResultSpecification(rs, (CASImpl) cas, resultSpecTypes, resultSpecFeatures); } processJNI(isTCas, sofaName, resultSpecTypes.toArray(), resultSpecFeatures.toArray()); // call hasNext() to see if this returns segments // if there are no segments this will get the // CAS data. if (hasNext()) { return; } } catch (Exception exc) { throwJTafException(exc); } }