本文整理汇总了Java中gate.event.StatusListener类的典型用法代码示例。如果您正苦于以下问题:Java StatusListener类的具体用法?Java StatusListener怎么用?Java StatusListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StatusListener类属于gate.event包,在下文中一共展示了StatusListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeStatusListener
import gate.event.StatusListener; //导入依赖的package包/类
/**
* Removes a {@link gate.event.StatusListener} from the list of listeners for
* this processing resource
*/
public synchronized void removeStatusListener(StatusListener l) {
if(statusListeners != null && statusListeners.contains(l)) {
@SuppressWarnings("unchecked")
Vector<StatusListener> v = (Vector<StatusListener>)statusListeners.clone();
v.removeElement(l);
statusListeners = v;
}
}
示例2: addStatusListener
import gate.event.StatusListener; //导入依赖的package包/类
/**
* Adds a {@link gate.event.StatusListener} to the list of listeners for this
* processing resource
*/
public synchronized void addStatusListener(StatusListener l) {
@SuppressWarnings("unchecked")
Vector<StatusListener> v =
statusListeners == null ? new Vector<StatusListener>(2) : (Vector<StatusListener>)statusListeners.clone();
if(!v.contains(l)) {
v.addElement(l);
statusListeners = v;
}
}
示例3: removeStatusListener
import gate.event.StatusListener; //导入依赖的package包/类
public synchronized void removeStatusListener(StatusListener l) {
if (statusListeners != null && statusListeners.contains(l)) {
@SuppressWarnings("unchecked")
Vector<StatusListener> v = (Vector<StatusListener>) statusListeners.clone();
v.removeElement(l);
statusListeners = v;
}
}
示例4: parseJape
import gate.event.StatusListener; //导入依赖的package包/类
protected void parseJape()
throws IOException, ParseException, ResourceInstantiationException
{
ParseCpsl parser = Factory.newJapeParser(grammarURL, encoding);
parser.setSptClass(SinglePhaseTransducerPDA.class);
StatusListener listener = new StatusListener(){
public void statusChanged(String text){
fireStatusChanged(text);
}
};
parser.addStatusListener(listener);
MultiPhaseTransducer intermediate = parser.MultiPhaseTransducer();
parser.removeStatusListener(listener);
singlePhaseTransducersData = new SPTData[intermediate.getPhases().size()];
SPTBuilder builder = new SPTBuilder();
for(int i = 0; i < intermediate.getPhases().size(); i++){
singlePhaseTransducersData[i] = builder.buildSPT(
(SinglePhaseTransducer)intermediate.getPhases().get(i),classLoader);
}
}
示例5: unpackMarkup
import gate.event.StatusListener; //导入依赖的package包/类
/**
* Unpack the markup in the document. This converts markup from the
* native format (e.g. XML) into annotations in GATE format. Uses the
* markupElementsMap to determine which elements to convert, and what
* annotation type names to use. If the document was created from a
* String, then is recomandable to set the doc's sourceUrl to <b>null</b>.
* So, if the document has a valid URL, then the parser will try to
* parse the XML document pointed by the URL.If the URL is not valid,
* or is null, then the doc's content will be parsed. If the doc's
* content is not a valid XML then the parser might crash.
*
* @param doc The gate document you want to parse. If
* <code>doc.getSourceUrl()</code> returns <b>null</b>
* then the content of doc will be parsed. Using a URL is
* recomended because the parser will report errors corectlly
* if the XML document is not well formed.
*/
@Override
public void unpackMarkup(Document doc, RepositioningInfo repInfo,
RepositioningInfo ampCodingInfo) throws DocumentFormatException {
if((doc == null)
|| (doc.getSourceUrl() == null && doc.getContent() == null)) {
throw new DocumentFormatException(
"GATE document is null or no content found. Nothing to parse!");
}// End if
// Create a status listener
StatusListener statusListener = new StatusListener() {
@Override
public void statusChanged(String text) {
// This is implemented in DocumentFormat.java and inherited here
fireStatusChanged(text);
}
};
// determine whether we have a GATE format XML document or another
// kind
String content = doc.getContent().toString();
if(content.length() > 2048) {
content = content.substring(0, 2048);
}
boolean gateFormat = isGateXmlFormat(content);
if(gateFormat) {
unpackGateFormatMarkup(doc, statusListener);
}
else {
unpackGeneralXmlMarkup(doc, repInfo, ampCodingInfo, statusListener);
}
}
示例6: fireStatusChangedEvent
import gate.event.StatusListener; //导入依赖的package包/类
/**
* This methos is called whenever we need to inform the listener about an
* event.
*/
protected void fireStatusChangedEvent(String text) {
Iterator<StatusListener> listenersIter = myStatusListeners.iterator();
while (listenersIter.hasNext()) {
listenersIter.next().statusChanged(text);
}
}
示例7: addStatusListener
import gate.event.StatusListener; //导入依赖的package包/类
public synchronized void addStatusListener(StatusListener l) {
@SuppressWarnings("unchecked")
Vector<StatusListener> v = statusListeners == null ? new Vector<StatusListener>(2) : (Vector<StatusListener>) statusListeners.clone();
if (!v.contains(l)) {
v.addElement(l);
statusListeners = v;
}
}
示例8: removeStatusListener
import gate.event.StatusListener; //导入依赖的package包/类
/**
* Removes a {@link gate.event.StatusListener} from the list of listeners for
* this processing resource
*/
public synchronized void removeStatusListener(StatusListener l) {
if (statusListeners != null && statusListeners.contains(l)) {
@SuppressWarnings("unchecked")
Vector<StatusListener> v = (Vector<StatusListener>)statusListeners.clone();
v.removeElement(l);
statusListeners = v;
}
}
示例9: addStatusListener
import gate.event.StatusListener; //导入依赖的package包/类
/**
* Adds a {@link gate.event.StatusListener} to the list of listeners for
* this processing resource
*/
public synchronized void addStatusListener(StatusListener l) {
@SuppressWarnings("unchecked")
Vector<StatusListener> v = statusListeners == null ? new Vector<StatusListener>(2) : (Vector<StatusListener>)statusListeners.clone();
if (!v.contains(l)) {
v.addElement(l);
statusListeners = v;
}
}
示例10: fireStatusChanged
import gate.event.StatusListener; //导入依赖的package包/类
/**
* Notifies all the {@link gate.event.StatusListener}s of a change of status.
* @param e the message describing the status change
*/
protected void fireStatusChanged(String e) {
if (statusListeners != null) {
Vector<StatusListener> listeners = statusListeners;
int count = listeners.size();
for (int i = 0; i < count; i++) {
listeners.elementAt(i).statusChanged(e);
}
}
}
示例11: fireStatusChanged
import gate.event.StatusListener; //导入依赖的package包/类
/**
* Notifies all the {@link gate.event.StatusListener}s of a change of status.
*
* @param e
* the message describing the status change
*/
protected void fireStatusChanged(String e) {
if(statusListeners != null) {
Vector<StatusListener> listeners = statusListeners;
int count = listeners.size();
for(int i = 0; i < count; i++) {
listeners.elementAt(i).statusChanged(e);
}
}
}
示例12: getPersistentRepresentation
import gate.event.StatusListener; //导入依赖的package包/类
/**
* Recursively traverses the provided object and replaces it and all
* its contents with the appropriate persistent equivalent classes.
*
* @param target the object to be analysed and translated into a
* persistent equivalent.
* @return the persistent equivalent value for the provided target
*/
public static Serializable getPersistentRepresentation(Object target)
throws PersistenceException {
if(target == null) return null;
// first check we don't have it already
Persistence res = existingPersistentReplacements
.get().getFirst().get(new ObjectHolder(target));
if(res != null) return res;
Class<? extends Object> type = target.getClass();
Class<?> newType = getMostSpecificPersistentType(type);
if(newType == null) {
// no special handler
if(target instanceof Serializable)
return (Serializable)target;
else throw new PersistenceException(
"Could not find a serialisable replacement for " + type);
}
// we have a new type; create the new object, populate and return it
try {
res = (Persistence)newType.newInstance();
}
catch(Exception e) {
throw new PersistenceException(e);
}
if(target instanceof NameBearer) {
StatusListener sListener = (StatusListener)Gate.getListeners().get(
"gate.event.StatusListener");
if(sListener != null) {
sListener.statusChanged("Storing " + ((NameBearer)target).getName());
}
}
res.extractDataFromSource(target);
existingPersistentReplacements.get().getFirst().put(new ObjectHolder(target), res);
return res;
}
示例13: XJMenu
import gate.event.StatusListener; //导入依赖的package包/类
public XJMenu(Action a, StatusListener listener){
super(a);
this.description = (String)a.getValue(Action.SHORT_DESCRIPTION);
this.listener = listener;
// stop showing tooltip in the menu, status bar is enough
setToolTipText(null);
initListeners();
getPopupMenu().setLayout(new MenuLayout());
}
示例14: XJMenuItem
import gate.event.StatusListener; //导入依赖的package包/类
public XJMenuItem(Action a, StatusListener listener){
super(a);
this.description = (String) a.getValue(Action.SHORT_DESCRIPTION);
this.listener = listener;
// stop showing tooltip in the menu, status bar is enough
setToolTipText(null);
initListeners();
}
示例15: removeStatusListener
import gate.event.StatusListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void removeStatusListener(StatusListener l) {
if(statusListeners != null && statusListeners.contains(l)) {
Vector<StatusListener> v = (Vector<StatusListener>)statusListeners
.clone();
v.removeElement(l);
statusListeners = v;
}
}