亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jtablebinding.java

?? java屬性邦定的(JSR-295)的一個實現
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/*
 * Copyright (C) 2007 Sun Microsystems, Inc. All rights reserved. Use is
 * subject to license terms.
 */

package org.jdesktop.swingbinding;

import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jdesktop.beansbinding.BindingListener;
import org.jdesktop.beansbinding.Binding.*;
import org.jdesktop.beansbinding.AutoBinding;
import org.jdesktop.beansbinding.Property;
import org.jdesktop.beansbinding.PropertyStateEvent;
import org.jdesktop.beansbinding.PropertyStateListener;
import org.jdesktop.swingbinding.impl.AbstractColumnBinding;
import org.jdesktop.swingbinding.impl.ListBindingManager;
import static org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.*;

/**
 * Binds a {@code List} of objects to act as the rows of a {@code JTable}.
 * Each object in the source {@code List} represents one row in the {@code JTable}.
 * Mappings from properties of the source objects to columns are created by
 * adding {@link org.jdesktop.swingbinding.JTableBinding.ColumnBinding ColumnBindings}
 * to a {@code JTableBinding}. Instances of {@code JTableBinding} are obtained by
 * calling one of the {@code createJTableBinding} methods in the {@code SwingBindings}
 * class.
 * <p>
 * Here is an example of creating a binding from a {@code List} of {@code Person}
 * objects to a {@code JTable}:
 * <p>
 * <pre><code>
 *    // create the person List
 *    List<Person> people = createPersonList();
 *
 *    // create the binding from List to JTable
 *    JTableBinding tb = SwingBindings.createJTableBinding(READ, people, jTable);
 *
 *    // define the properties to be used for the columns
 *    BeanProperty firstNameP = BeanProperty.create("firstName");
 *    BeanProperty lastNameP = BeanProperty.create("lastName");
 *    BeanProperty ageP = BeanProperty.create("age");
 *
 *    // configure how the properties map to columns
 *    tb.addColumnBinding(firstNameP).setColumnName("First Name");
 *    tb.addColumnBinding(lastNameP).setColumnName("Last Name");
 *    tb.addColumnBinding(ageP).setColumnName("Age").setColumnClass(Integer.class);
 *
 *    // realize the binding
 *    tb.bind();
 * </code></pre>
 * <p>
 * The {@code JTable} target of a {@code JTableBinding} acts as a live view of
 * the objects in the source {@code List},
 * regardless of the update strategy (the meaning of the update strategy is
 * <a href="#CLARIFICATION">clarified later</a> in this document). {@code JTableBinding}
 * listens to the properties specified for the {@code ColumnBindings}, 
 * for all objects in the {@code List}, and updates the values
 * displayed in the {@code JTable} in response to change. All successful
 * edits made to {@code JTable} cell values are immediately committed back to
 * corresponding objects in the source {@code List}. If the {@code List} is an
 * instance of {@code ObservableList}, then changes to the {@code List} contents
 * (such as adding, removing or replacing an object) are also reflected in the
 * {@code JTable}. <b>Important:</b> Changing the contents of a non-observable
 * {@code List} while it is participating in a {@code JTableBinding} is unsupported,
 * resulting in undefined behavior and possible exceptions.
 * <p>
 * <a name="EDITABILITY">A cell</a> in the {@code JTable} is editable for any given row and
 * column when all of the following are true: the property specified for that column
 * by its {@code ColumnBinding} is writeable for the object representing that row,
 * the {@code "editable"} property of the {@code JTableBinding} is {@code true}
 * (the default), and the {@code "editable"} property of the {@code ColumnBinding}
 * is {@code true} (the default).
 * <p>
 * <a name="CLARIFICATION">{@code JTableBinding} requires</a>
 * extra clarification on the operation of the
 * {@code refresh} and {@code save} methods and the meaning of the update
 * strategy. The target property of a {@code JTableBinding} is not the
 * target {@code JTable} property provided in the constructor, but rather a
 * private synthetic property representing the {@code List} of objects to show
 * in the target {@code JTable}. This synthetic property is readable/writeable
 * only when the {@code JTableBinding} is bound and the target {@code JTable}
 * property is readable with a {@code non-null} value.
 * <p>
 * It is this private synthetic property on which the {@code refresh} and
 * {@code save} methods operate; meaning that these methods simply cause syncing
 * between the value of the source {@code List} property and the value of the
 * synthetic target property (representing the {@code List} to be shown in the
 * target {@code JTable}). These methods do not, therefore, have anything to do
 * with refreshing or saving <i>values</i> in the {@code JTable}. Likewise, the update
 * strategy, which simply controls when {@code refresh} and {@code save} are
 * automatically called, also has nothing to do with refreshing or saving
 * <i>values</i> in the {@code JTable}.
 * <p>
 * <b>Note:</b> At the current time, the {@code READ_WRITE} update strategy
 * is not useful for {@code JTableBinding}. To prevent unwanted confusion,
 * {@code READ_WRITE} is translated to {@code READ} by {@code JTableBinding's}
 * constructor.
 * <p>
 * {@code JTableBinding} works by installing a custom model on the target
 * {@code JTable}, as appropriate, to represent the source {@code List}. The
 * model is installed on a target {@code JTable} with the first succesful call
 * to {@code refresh} with that {@code JTable} as the target. Subsequent calls
 * to {@code refresh} update the elements in this already-installed model.
 * The model is uninstalled from a target {@code JTable} when either the
 * {@code JTableBinding} is unbound or when the target {@code JTable} property
 * changes to no longer represent that {@code JTable}. Note: When the model is
 * uninstalled from a {@code JTable}, it is replaced with a {@code DefaultTableModel},
 * in order to leave the {@code JTable} functional.
 * <p>
 * Some of the above is easier to understand with an example. Let's consider
 * a {@code JTableBinding} ({@code binding}), with update strategy
 * {@code READ}, between a property representing a {@code List} ({@code listP})
 * and a property representing a {@code JTable} ({@code jTableP}). {@code listP}
 * and {@code jTableP} both start off readable, referring to a {@code non-null}
 * {@code List} and {@code non-null} {@code JTable} respectively. Let's look at
 * what happens for each of a sequence of events:
 * <p>
 * <table border=1>
 *   <tr><th>Sequence</th><th>Event</th><th>Result</th></tr>
 *   <tr valign="baseline">
 *     <td align="center">1</td>
 *     <td>explicit call to {@code binding.bind()}</td>
 *     <td>
 *         - synthetic target property becomes readable/writeable
 *         <br>
 *         - {@code refresh()} is called
 *         <br>
 *         - model is installed on target {@code JTable}, representing list of objects
 *     </td>
 *   </tr>
 *   <tr valign="baseline">
 *     <td align="center">2</td>
 *     <td>{@code listP} changes to a new {@code List}</td>
 *     <td>
 *         - {@code refresh()} is called
 *         <br>
 *         - model is updated with new list of objects
 *     </td>
 *   </tr>
 *   <tr valign="baseline">
 *     <td align="center"><a name="STEP3" href="#NOTICE">3</a></td>
 *     <td>{@code jTableP} changes to a new {@code JTable}</td>
 *     <td>
 *         - model is uninstalled from old {@code JTable}
 *     </td>
 *   </tr>
 *   <tr valign="baseline">
 *     <td align="center">4</td>
 *     <td>explicit call to {@code binding.refresh()}</td>
 *     <td>
 *         - model is installed on target {@code JTable}, representing list of objects
 *     </td>
 *   </tr>
 *   <tr valign="baseline">
 *     <td align="center">5</td>
 *     <td>{@code listP} changes to a new {@code List}</td>
 *     <td>
 *         - {@code refresh()} is called
 *         <br>
 *         - model is updated with new list of objects
 *     </td>
 *   </tr>
 *   <tr valign="baseline">
 *     <td align="center">6</td>
 *     <td>explicit call to {@code binding.unbind()}</td>
 *     <td>
 *         - model is uninstalled from target {@code JTable}
 *     </td>
 *   </tr>
 * </table>
 * <p>
 * <a name="NOTICE">Notice</a> that in <a href="#STEP3">step 3</a>, when the value
 * of the {@code JTable} property changed, the new {@code JTable} did not
 * automatically get the model with the elements applied to it. A change to the
 * target value should not cause an {@code AutoBinding} to sync the target from
 * the source. Step 4 forces a sync by explicitly calling {@code refresh}.
 * Alternatively, it could be caused by any other action that results
 * in a {@code refresh} (for example, the source property changing value, or an
 * explicit call to {@code unbind} followed by {@code bind}).
 * <p>
 * {@code ColumnBindings} are managed by the {@code JTableBinding}. They are not
 * to be explicitly bound, unbound, added to a {@code BindingGroup}, or accessed
 * in a way that is not allowed for a managed binding. {@code BindingListeners}
 * added to a {@code ColumnBinding} are notified at the time an edited {@code JTable} value
 * is to be committed back to the source {@code List}. They receive notification of either
 * {@code synced} or {@code syncFailed}. {@code BindingListeners} added to the
 * {@code JTableBinding} itself are also notified of {@code sync} and {@code syncFailed}
 * for the {@code JTableBinding's ColumnBindings}.
 * <p>
 * In addition to binding the elements of a {@code JTable}, it is possible to
 * bind to the selection of a {@code JTable}. When binding to the selection of a {@code JTable}
 * backed by a {@code JTableBinding}, the selection is always in terms of elements
 * from the source {@code List}. See the list of <a href="package-summary.html#SWING_PROPS">
 * interesting swing properties</a> in the package summary for more details.
 *
 * @param <E> the type of elements in the source {@code List}
 * @param <SS> the type of source object (on which the source property resolves to {@code List})
 * @param <TS> the type of target object (on which the target property resolves to {@code JTable})
 *
 * @author Shannon Hickey
 */
public final class JTableBinding<E, SS, TS> extends AutoBinding<SS, List<E>, TS, List> {

    private Property<TS, ? extends JTable> tableP;
    private ElementsProperty<TS> elementsP;
    private Handler handler = new Handler();
    private JTable table;
    private BindingTableModel model;
    private boolean editable = true;
    private List<ColumnBinding> columnBindings = new ArrayList<ColumnBinding>();

    /**
     * Constructs an instance of {@code JTableBinding}.
     *
     * @param strategy the update strategy
     * @param sourceObject the source object
     * @param sourceListProperty a property on the source object that resolves to the {@code List} of elements
     * @param targetObject the target object
     * @param targetJTableProperty a property on the target object that resolves to a {@code JTable}
     * @param name a name for the {@code JTableBinding}
     * @throws IllegalArgumentException if the source property or target property is {@code null}
     */
    protected JTableBinding(UpdateStrategy strategy, SS sourceObject, Property<SS, List<E>> sourceListProperty, TS targetObject, Property<TS, ? extends JTable> targetJTableProperty, String name) {
        super(strategy == READ_WRITE ? READ : strategy,
              sourceObject, sourceListProperty, targetObject, new ElementsProperty<TS>(), name);

        if (targetJTableProperty == null) {
            throw new IllegalArgumentException("target JTable property can't be null");
        }

        tableP = targetJTableProperty;
        elementsP = (ElementsProperty<TS>)getTargetProperty();
    }

    protected void bindImpl() {
        elementsP.setAccessible(isTableAccessible());
        tableP.addPropertyStateListener(getTargetObject(), handler);
        elementsP.addPropertyStateListener(null, handler);
        super.bindImpl();
    }

    protected void unbindImpl() {
        elementsP.removePropertyStateListener(null, handler);
        tableP.removePropertyStateListener(getTargetObject(), handler);
        elementsP.setAccessible(false);
        cleanupForLast();
        super.unbindImpl();
    }

    private boolean isTableAccessible() {
        return tableP.isReadable(getTargetObject()) && tableP.getValue(getTargetObject()) != null;
    }

    private boolean isTableAccessible(Object value) {
        return value != null && value != PropertyStateEvent.UNREADABLE;
    }

    private void cleanupForLast() {
        if (table == null) {
            return;
        }

        table.setModel(new DefaultTableModel());
        table = null;
        model.setElements(null, true);
        model = null;
    }
    
    /**
     * Sets whether or not the cells of the table should be editable.
     * The default for this property is {@code true}.
     * See this <a href="#EDITABILITY">paragraph</a> in the class level
     * documentation on editability.
     *
     * @param editable whether or not the cells of the table should be editable
     */
    public void setEditable(boolean editable) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区在线电影| 精品国产3级a| 一本大道久久a久久精品综合| 国产一区二区三区在线观看免费视频| 日本视频一区二区三区| 日本不卡123| 久久精品国内一区二区三区| 蜜臀久久99精品久久久久宅男| 日本在线观看不卡视频| 日本不卡的三区四区五区| 青娱乐精品视频在线| 久久精品99久久久| 国产一区三区三区| 国产成a人亚洲精| 成人一区二区三区中文字幕| www.日本不卡| 色先锋资源久久综合| 色婷婷av一区二区三区软件| 欧美午夜精品久久久久久超碰| 欧美怡红院视频| 欧美一区二区视频在线观看2020| 欧美精品18+| 欧美变态tickling挠脚心| 久久亚洲二区三区| 国产精品久久久久久久久免费樱桃 | 亚洲精品ww久久久久久p站| 亚洲免费在线观看视频| 亚洲成在线观看| 精品亚洲成a人| 懂色av一区二区三区免费看| 91一区二区三区在线观看| 在线日韩国产精品| 日韩一区二区三区免费看| 久久亚洲私人国产精品va媚药| 国产精品久久久久aaaa樱花 | 亚洲在线免费播放| 日韩国产欧美在线视频| 激情文学综合丁香| 99re热视频这里只精品| 777a∨成人精品桃花网| 国产日韩精品一区二区三区 | 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 国产成人在线视频网站| 91在线视频观看| 欧美狂野另类xxxxoooo| 国产校园另类小说区| 一个色妞综合视频在线观看| 免费观看一级特黄欧美大片| eeuss国产一区二区三区| 91精选在线观看| 欧美国产精品久久| 日本成人在线一区| 91在线观看视频| 日韩你懂的在线观看| 亚洲欧美在线视频观看| 天堂av在线一区| 白白色 亚洲乱淫| 欧美一区二区三区的| 成人免费在线观看入口| 美女高潮久久久| 在线观看91视频| 国产亚洲一二三区| 天堂va蜜桃一区二区三区漫画版| 成人高清视频在线| 日韩精品一区二区三区蜜臀| 亚洲天堂福利av| 韩国三级电影一区二区| 亚洲欧美日韩中文播放| 麻豆精品在线播放| 色综合久久久久综合体| 久久女同精品一区二区| 日韩极品在线观看| 日本高清免费不卡视频| 国产日韩欧美高清在线| 免费看欧美美女黄的网站| 日本高清无吗v一区| 国产精品免费aⅴ片在线观看| 日韩精品一级中文字幕精品视频免费观看 | 麻豆精品视频在线观看免费| 色av综合在线| 国产精品久久久久一区二区三区| 久久99精品国产.久久久久| 欧美综合欧美视频| 中文字幕一区二区在线播放| 黑人巨大精品欧美一区| 日韩欧美成人一区二区| 日精品一区二区三区| 91国产免费看| 一区二区三区色| 99久久国产综合精品麻豆| 亚洲国产精品高清| 国产成人精品免费在线| 久久先锋影音av鲁色资源网| 蜜桃传媒麻豆第一区在线观看| 欧美做爰猛烈大尺度电影无法无天| 亚洲欧美中日韩| 99久久精品国产毛片| 国产精品美日韩| 福利电影一区二区| 中文字幕va一区二区三区| 国产精品99久久不卡二区| 精品国产免费人成电影在线观看四季| 天天av天天翘天天综合网色鬼国产| 欧美性猛交xxxx乱大交退制版| 亚洲人成影院在线观看| 北条麻妃一区二区三区| 国产精品美女久久久久久久久久久| 国产精品一区二区在线观看网站| 久久免费美女视频| 国产传媒欧美日韩成人| 日本一区二区三区高清不卡| 国产精品伊人色| 亚洲国产成人在线| 不卡一区中文字幕| 亚洲视频在线观看一区| 91国偷自产一区二区三区成为亚洲经典 | 国产福利精品一区二区| 国产亚洲一区二区在线观看| 成人一级黄色片| 国产精品久久99| 欧美综合久久久| 偷窥国产亚洲免费视频| 日韩视频免费观看高清完整版在线观看| 日本欧美韩国一区三区| 久久综合久久久久88| 成人国产精品免费观看动漫| 亚洲精选视频在线| 欧美精品少妇一区二区三区| 美女视频网站久久| 国产日产精品一区| 92精品国产成人观看免费| 亚洲第一福利一区| 欧美精品一区视频| 不卡av免费在线观看| 亚洲va中文字幕| 精品99一区二区| av一区二区三区| 性欧美疯狂xxxxbbbb| 久久久国产精华| 色一区在线观看| 久久99精品网久久| 亚洲欧美日本韩国| 日韩区在线观看| 99精品久久久久久| 男男成人高潮片免费网站| 国产精品免费aⅴ片在线观看| 欧美午夜电影网| 国产黑丝在线一区二区三区| 亚洲色图视频网| 日韩一级大片在线观看| 成年人国产精品| 日韩1区2区日韩1区2区| 国产精品国产三级国产普通话蜜臀| 在线精品视频免费播放| 国产呦萝稀缺另类资源| 一区二区三区免费在线观看| 久久国产生活片100| 日本一区二区三区四区| 在线成人高清不卡| 成人精品高清在线| 日韩电影在线一区二区三区| 国产精品福利一区| 欧美成人在线直播| 日本大香伊一区二区三区| 精品一二三四区| 亚洲国产成人高清精品| 国产日本欧洲亚洲| 欧美一区二区视频观看视频| 成人精品一区二区三区四区| 乱中年女人伦av一区二区| 一区二区三区在线看| 精品久久国产字幕高潮| 欧美性生交片4| 丁香六月久久综合狠狠色| 日韩电影在线一区二区| 亚洲精品免费在线播放| 国产三级精品三级在线专区| 欧美精品一级二级| 91猫先生在线| 国产成人精品亚洲日本在线桃色| 日日嗨av一区二区三区四区| 亚洲精品日韩一| 国产欧美日韩精品在线| 日韩三级视频在线看| 欧美性猛交一区二区三区精品| www.成人在线| 国产一区二区成人久久免费影院| 婷婷亚洲久悠悠色悠在线播放| 中文字幕综合网| 亚洲国产精品精华液ab| 久久一夜天堂av一区二区三区 | 亚洲欧美精品午睡沙发| 久久综合色一综合色88| 欧美一区二区成人6969| 欧美三级欧美一级| 欧美网站一区二区| 在线视频国内一区二区| 91福利在线导航| 色综合天天视频在线观看| av毛片久久久久**hd|