Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.pivot.wtk;
import java.io.IOException;
import java.net.URL;
import java.util.Comparator;
import org.apache.pivot.beans.DefaultProperty;
import org.apache.pivot.collections.ArrayList;
import org.apache.pivot.collections.List;
import org.apache.pivot.collections.ListListener;
import org.apache.pivot.collections.Sequence;
import org.apache.pivot.json.JSON;
import org.apache.pivot.json.JSONSerializer;
import org.apache.pivot.serialization.SerializationException;
import org.apache.pivot.util.Filter;
import org.apache.pivot.util.ListenerList;
import org.apache.pivot.wtk.ListView.ListDataBindMapping;
import org.apache.pivot.wtk.content.ListButtonDataRenderer;
import org.apache.pivot.wtk.content.ListViewItemRenderer;
/**
* Component that allows a user to select one of several list options. The
* options are hidden until the user pushes the button.
*/
@DefaultProperty("listData")
public class ListButton extends Button {
private static class ListButtonListenerList extends WTKListenerList
implements ListButtonListener {
@Override
public void listDataChanged(ListButton listButton, List> previousListData) {
for (ListButtonListener listener : this) {
listener.listDataChanged(listButton, previousListData);
}
}
@Override
public void itemRendererChanged(ListButton listButton, ListView.ItemRenderer previousItemRenderer) {
for (ListButtonListener listener : this) {
listener.itemRendererChanged(listButton, previousItemRenderer);
}
}
@Override
public void repeatableChanged(ListButton listButton) {
for (ListButtonListener listener : this) {
listener.repeatableChanged(listButton);
}
}
@Override
public void disabledItemFilterChanged(ListButton listButton, Filter> previousDisabledItemFilter) {
for (ListButtonListener listener : this) {
listener.disabledItemFilterChanged(listButton, previousDisabledItemFilter);
}
}
@Override
public void listSizeChanged(ListButton listButton, int previousListSize) {
for (ListButtonListener listener : this) {
listener.listSizeChanged(listButton, previousListSize);
}
}
}
private static class ListButtonItemListenerList extends WTKListenerList
implements ListButtonItemListener {
@Override
public void itemInserted(ListButton listButton, int index) {
for (ListButtonItemListener listener : this) {
listener.itemInserted(listButton, index);
}
}
@Override
public void itemsRemoved(ListButton listButton, int index, int count) {
for (ListButtonItemListener listener : this) {
listener.itemsRemoved(listButton, index, count);
}
}
@Override
public void itemUpdated(ListButton listButton, int index) {
for (ListButtonItemListener listener : this) {
listener.itemUpdated(listButton, index);
}
}
@Override
public void itemsCleared(ListButton listButton) {
for (ListButtonItemListener listener : this) {
listener.itemsCleared(listButton);
}
}
@Override
public void itemsSorted(ListButton listButton) {
for (ListButtonItemListener listener : this) {
listener.itemsSorted(listButton);
}
}
}
private static class ListButtonSelectionListenerList extends WTKListenerList
implements ListButtonSelectionListener {
@Override
public void selectedIndexChanged(ListButton listButton, int previousSelectedIndex) {
for (ListButtonSelectionListener listener : this) {
listener.selectedIndexChanged(listButton, previousSelectedIndex);
}
}
@Override
public void selectedItemChanged(ListButton listButton, Object previousSelectedItem) {
for (ListButtonSelectionListener listener : this) {
listener.selectedItemChanged(listButton, previousSelectedItem);
}
}
}
private static class ListButtonBindingListenerList extends WTKListenerList
implements ListButtonBindingListener {
@Override
public void listDataKeyChanged(ListButton listButton, String previousListDataKey) {
for (ListButtonBindingListener listener : this) {
listener.listDataKeyChanged(listButton, previousListDataKey);
}
}
@Override
public void listDataBindTypeChanged(ListButton listButton, BindType previousListDataBindType) {
for (ListButtonBindingListener listener : this) {
listener.listDataBindTypeChanged(listButton, previousListDataBindType);
}
}
@Override
public void listDataBindMappingChanged(ListButton listButton,
ListView.ListDataBindMapping previousListDataBindMapping) {
for (ListButtonBindingListener listener : this) {
listener.listDataBindMappingChanged(listButton, previousListDataBindMapping);
}
}
@Override
public void selectedItemKeyChanged(ListButton listButton, String previousSelectedItemKey) {
for (ListButtonBindingListener listener : this) {
listener.selectedItemKeyChanged(listButton, previousSelectedItemKey);
}
}
@Override
public void selectedItemBindTypeChanged(ListButton listButton, BindType previousSelectedItemBindType) {
for (ListButtonBindingListener listener : this) {
listener.selectedItemBindTypeChanged(listButton, previousSelectedItemBindType);
}
}
@Override
public void selectedItemBindMappingChanged(ListButton listButton, ListView.ItemBindMapping previousSelectedItemBindMapping) {
for (ListButtonBindingListener listener : this) {
listener.selectedItemBindMappingChanged(listButton, previousSelectedItemBindMapping);
}
}
}
/**
* ListButton skin interface. ListButton skins must implement
* this interface to facilitate additional communication between the
* component and the skin.
*/
public interface Skin {
public Window getListViewPopup();
}
private List> listData;
private ListView.ItemRenderer itemRenderer;
private boolean repeatable = false;
private int selectedIndex = -1;
private Filter> disabledItemFilter = null;
private int listSize = -1;
private String listDataKey = null;
private BindType listDataBindType = BindType.BOTH;
private ListDataBindMapping listDataBindMapping = null;
private String selectedItemKey = null;
private BindType selectedItemBindType = BindType.BOTH;
private ListView.ItemBindMapping selectedItemBindMapping = null;
private ListListener