Posted on 2008-04-22 20:31
guanminglin@gmail.com 阅读(1909)
评论(6) 编辑 收藏 所属分类:
NetBeans
今天试着翻译了一点SwingApplicationFramework 的其中一个源代码的注释,感觉翻译的不怎么样(这是我第一次翻译API)。现在把它贴出来,大家看看,希望大家能够给点意见,批评指正一下,有什么翻译不妥的地方尽管提出来,好让我改进改进,先谢谢了!
下面是部分代码注释的翻译:
package org.jdesktop.application;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import javax.swing.SwingUtilities;
/**
*
* An encapsulation of the PropertyChangeSupport methods based on
* java.beans.PropertyChangeSupport.PropertyChangeListeners are fired
* on the event dispatching thread.
*中文翻译:
*一个封装的PropertyChangeSupport方法基于java.beans.PropertyChangeSupport
*当事件调度线程的时候PropertyChangeListeners将被激活
*
*
* <p>
* Note: this class is only public because the so-called "fix"
* for javadoc bug
* <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4780441">4780441</a>
* still fails to correctly document public methods inherited from a package
* private class.
* 中文:
* 提示:这个类只能是public 因为所谓的用来“fix”(修复)javadoc 的bug。
* <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4780441">4780441</a>
* 仍然不能得体的书写 public 方法 继承于私有类包
*/
public class AbstractBean {
private final PropertyChangeSupport pcs;
public AbstractBean() {
pcs = new EDTPropertyChangeSupport(this);
}
/**
* Add a PropertyChangeListener to the listener list.
* The listener is registered for all properties and its
* {@code propertyChange} method will run on the event dispatching
* thread.
* <p>
* If {@code listener} is null, no exception is thrown and no action
* is taken.
* 中文:
* 添加一个PropertyChangeListener到监听器列表中
* 监听器为所有的属性都进行了注册,并且他的{@code propertyChange} 方法将会在
* 事件调度线程的时候运行。
* <p>
* 如果{@code listener} 为空,则不会抛出异常,也不会有动作执行(发生)
* @param listener the PropertyChangeListener to be added.
* 中文:PropertyChangeListener 将会被添加到监听器列表中。
* @see #removePropertyChangeListener 中文:移除PropertyChangeListener
* @see java.beans.PropertyChangeSupport#addPropertyChangeListener
*/
public void addPropertyChangeListener(PropertyChangeListener listener) {
pcs.addPropertyChangeListener(listener);
}
/**
* Remove a PropertyChangeListener from the listener list.
*
* <p>
* If {@code listener} is null, no exception is thrown and no action
* is taken.
*
* 从监听器列表中移除一个PropertyChangeListener
* 如果{@code listener} 为空,则不会抛出异常,也不会有动作执行(发生)
*
* @param listener the PropertyChangeListener to be removed.
中文:PropertyChangeListener 将会被添加到监听器列表中
* @see #addPropertyChangeListener 中文:添加事件监听器
* @see java.beans.PropertyChangeSupport#removePropertyChangeListener
*/
public void removePropertyChangeListener(PropertyChangeListener listener) {
pcs.removePropertyChangeListener(listener);
}
/**
* Add a PropertyChangeListener for a specific property. The listener
* will be invoked only when a call on firePropertyChange names that
* specific property.
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
* If <code>propertyName</code> or <code>listener</code> is null, no
* exception is thrown and no action is taken.
* 中文:为一个具体的属性添加PropertyChangeListener(属性变化监听器)。
* 这个监听器只会在特殊属性被命名的时候被调用
* 同样的监听器也许会被添加多次。对于不同的属性,监听器将会被他所监听的属性调用多次
* 如果<code>propertyName</code>或<code>listener</code>为空,则不会抛出异常,
* 也不会有动作被执行(发生)
* @param propertyName The name of the property to listen on. 中文:被监听的属性名字
* @param listener the PropertyChangeListener to be added 中文:PropertyChangeListener将会被添加
* @see java.beans.PropertyChangeSupport#addPropertyChangeListener(String, PropertyChangeListener)
*/
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
pcs.addPropertyChangeListener(propertyName, listener);
}
/**
* Remove a PropertyChangeListener for a specific property.
* If <code>listener</code> was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
* If <code>propertyName</code> is null, no exception is thrown and no
* action is taken.
* If <code>listener</code> is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
中文:为具体的属性移除一个PropertyChangeListener。如果<code>listener</code>
被多次的添加的同一个事件源中,它将会在移除的时候一次也不少的被通知到
如果<code>propertyName</code> 为空,则则不会抛出异常,
* 也不会有动作被执行(发生)
如果<code>listener</code> 为空或者根本没有被添加到特定的属性中,则不会抛出异常,
* 也不会有动作被执行(发生)
* @param propertyName The name of the property that was listened on. 中文:被监听的属性名字
* @param listener The PropertyChangeListener to be removed PropertyChangeListener将被移除
* @see java.beans.PropertyChangeSupport#removePropertyChangeListener(String, PropertyChangeListener)
*/
public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
pcs.removePropertyChangeListener(propertyName, listener);
}
…………