/* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
privateboolean listenerDisposed[] = newboolean[2]; private String[] Loutput = new String[2];
/** * Listener which added but not removed, and its method must be called * on <code>dispose</code> call.
*/ privateclass MyEventListener implements XEventListener { publicvoid disposing ( EventObject oEvent ) {
Loutput[0] = Thread.currentThread() + " is DISPOSING EV1" + this;
listenerDisposed[0] = true;
}
}
/** * Listener which added and then removed, and its method must <b>not</b> * be called on <code>dispose</code> call.
*/ privateclass MyEventListener2 implements XEventListener { publicvoid disposing ( EventObject oEvent ) {
Loutput[0] = Thread.currentThread() + " is DISPOSING EV2" + this;
listenerDisposed[1] = true;
}
}
privatefinal XEventListener listener1 = new MyEventListener(); privatefinal XEventListener listener2 = new MyEventListener2();
/** * Adds two listeners. <p> * Has OK status if then the first listener will receive an event * on <code>dispose</code> method call.
*/ publicboolean _addEventListener() {
/** * Removes the second of two added listeners. <p> * Method tests to be completed successfully : * <ul> * <li> <code>addEventListener</code> : method must add two listeners. </li> * </ul> <p> * Has OK status if no events will be sent to the second listener on * <code>dispose</code> method call.
*/ publicboolean _removeEventListener() { if (disposed) returntrue; // the second listener should not be called
oObj.removeEventListener( listener2 );
log.println(Thread.currentThread() + " is removing EL " + listener2); returntrue;
} // finished _removeEventListener()
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.