本文整理汇总了Java中ca.odell.glazedlists.event.ListEvent类的典型用法代码示例。如果您正苦于以下问题:Java ListEvent类的具体用法?Java ListEvent怎么用?Java ListEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListEvent类属于ca.odell.glazedlists.event包,在下文中一共展示了ListEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(ListEvent<MyMarketOrder> listChanges) {
double sellOrdersTotal = 0;
double buyOrdersTotal = 0;
double toCoverTotal = 0;
double escrowTotal = 0;
for (MyMarketOrder marketOrder : filterList) {
if (!marketOrder.isBuyOrder()) { //Sell
sellOrdersTotal += marketOrder.getPrice() * marketOrder.getVolRemaining();
} else { //Buy
buyOrdersTotal += marketOrder.getPrice() * marketOrder.getVolRemaining();
escrowTotal += marketOrder.getEscrow();
toCoverTotal += (marketOrder.getPrice() * marketOrder.getVolRemaining()) - marketOrder.getEscrow();
}
}
jSellOrdersTotal.setText(Formater.iskFormat(sellOrdersTotal));
jBuyOrdersTotal.setText(Formater.iskFormat(buyOrdersTotal));
jToCoverTotal.setText(Formater.iskFormat(toCoverTotal));
jEscrowTotal.setText(Formater.iskFormat(escrowTotal));
}
示例2: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(final ListEvent<MyIndustryJob> listChanges) {
int inventionCount = 0;
long count = 0;
double success = 0;
double outputValue = 0;
for (MyIndustryJob industryJob : filterList) {
count++;
if (industryJob.isInvention() && industryJob.isCompleted()) {
inventionCount++;
if (industryJob.isDelivered()) {
success++;
}
}
outputValue += industryJob.getOutputValue();
}
if (inventionCount <= 0) {
jInventionSuccess.setText(Formater.percentFormat(0.0));
} else {
jInventionSuccess.setText(Formater.percentFormat(success / inventionCount));
}
jManufactureOutputValue.setText(Formater.iskFormat(outputValue));
jCount.setText(Formater.itemsFormat(count));
}
示例3: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(ListEvent<OOBibStyle> listEvent) {
if (listEvent.getSourceList().size() == 1) {
OOBibStyle style = listEvent.getSourceList().get(0);
// Enable/disable popup menu items and buttons
if (style.isFromResource()) {
remove.setEnabled(false);
edit.setEnabled(false);
reload.setEnabled(false);
removeButton.setEnabled(false);
} else {
remove.setEnabled(true);
edit.setEnabled(true);
reload.setEnabled(true);
removeButton.setEnabled(true);
}
// Set new preview layout
preview.setLayout(style.getReferenceFormat("default"));
}
}
示例4: setAdditionalListeners
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
/**
* Sets the additional listeners.
*/
private void setAdditionalListeners() {
selectionModel
.addListSelectionListener(new GlyphSelectionChangeHandler(tabPanel
.getInfoLabel(), sortedList, filterList,
selectionDependentActions));
glyphList
.addListEventListener(new ListEventListener<GlyphDefinition>() {
@Override
public void listChanged(ListEvent<GlyphDefinition> e) {
boolean enableActions = !listInSync;
for (Action a : syncDependentActions) {
a.setEnabled(enableActions);
}
}
});
}
示例5: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
public void listChanged(ListEvent listChanges) {
// forward the event to interested listeners
updates.forwardEvent( listChanges );
// And then fire model events based on these changes
while( listChanges.nextBlock() ) {
// get the current change info
int startIndex = listChanges.getBlockStartIndex();
int endIndex = listChanges.getBlockEndIndex();
int changeType = listChanges.getType();
// create a table model event for this block
if( changeType == ListEvent.INSERT )
fireIntervalAdded(this, startIndex, endIndex);
else if( changeType == ListEvent.DELETE )
fireIntervalRemoved(this, startIndex, endIndex);
else if( changeType == ListEvent.UPDATE )
fireContentsChanged(this, startIndex, endIndex);
}
}
示例6: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(final ListEvent<LoadProfileEntity> listChanges) {
treeData.clear();
paths.clear();
for (LoadProfileEntity lpe : loadProfileEnities) {
String key;
if (lpe instanceof CurveAssignment) {
CurveAssignment ca = (CurveAssignment) lpe;
key = ca.getOperation().getName();
} else {
key = "***Markers***";
}
addLoadProfileEnity(lpe, key);
paths.add(new TreePath(new Object[] { ROOT, key, lpe }));
}
for (TreeModelListener listener : listenerList) {
listener.treeStructureChanged(new TreeModelEvent(this, new Object[] { ROOT }));
}
}
示例7: FilterControl
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
protected FilterControl(final JFrame jFrame, final String name, final EventList<E> eventList, final EventList<E> exportEventList, final FilterList<E> filterList, final Map<String, List<Filter>> filters, final Map<String, List<Filter>> defaultFilters) {
this.name = name;
this.eventList = eventList;
this.exportEventList = exportEventList;
this.filterList = filterList;
eventList.addListEventListener(new ListEventListener<E>() {
@Override @SuppressWarnings("deprecation")
public void listChanged(ListEvent<E> listChanges) {
try {
eventList.getReadWriteLock().readLock().lock();
List<E> delete = new ArrayList<E>();
List<E> update = new ArrayList<E>();
while(listChanges.next()) {
switch (listChanges.getType()) {
case ListEvent.DELETE:
addSafe(delete, listChanges.getOldValue());
break;
case ListEvent.UPDATE:
addSafe(eventList, update, listChanges.getIndex());
break;
}
}
cacheDelete(delete);
cacheUpdate(update);
} finally {
eventList.getReadWriteLock().readLock().unlock();
}
}
});
this.filters = filters;
this.defaultFilters = defaultFilters;
ListenerClass listener = new ListenerClass();
filterList.addListEventListener(listener);
gui = new FilterGui<E>(jFrame, this);
cache = new HashMap<E, String>();
}
示例8: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(ListEvent<MyTransaction> listChanges) {
double sellTotal = 0;
double buyTotal = 0;
long sellCount = 0;
long buyCount = 0;
for (MyTransaction transaction : filterList) {
if (transaction.isSell()) { //Sell
sellTotal += transaction.getPrice() * transaction.getQuantity();
sellCount += transaction.getQuantity();
} else { //Buy
buyTotal += transaction.getPrice() * transaction.getQuantity();
buyCount += transaction.getQuantity();
}
}
double sellAvg = 0;
if (sellTotal > 0 && sellCount > 0) {
sellAvg = sellTotal / sellCount;
}
double buyAvg = 0;
if (buyTotal > 0 && buyCount > 0) {
buyAvg = buyTotal / buyCount;
}
double bothTotal = sellTotal + buyTotal;
double bothCount = sellCount + buyCount;
double bothAvg = 0;
if (bothTotal > 0 && bothCount > 0) {
bothAvg = bothTotal / bothCount;
}
jSellOrdersCount.setText(Formater.itemsFormat(sellCount));
jSellOrdersTotal.setText(Formater.iskFormat(sellTotal));
jSellOrdersAverage.setText(Formater.iskFormat(sellAvg));
jBothOrdersCount.setText(Formater.itemsFormat(sellCount + buyCount));
jBothOrdersTotal.setText(Formater.iskFormat(bothTotal));
jBothOrdersAverage.setText(Formater.iskFormat(bothAvg));
jBuyOrdersCount.setText(Formater.itemsFormat(buyCount));
jBuyOrdersTotal.setText(Formater.iskFormat(buyTotal));
jBuyOrdersAverage.setText(Formater.iskFormat(buyAvg));
}
示例9: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(final ListEvent<StockpileItem> listChanges) {
List<StockpileItem> items = new ArrayList<StockpileItem>(filterList);
//Remove StockpileTotal and SeparatorList.Separator
for (int i = 0; i < items.size(); i++) {
Object object = items.get(i);
if ((object instanceof SeparatorList.Separator) || (object instanceof StockpileTotal)) {
items.remove(i);
i--;
}
}
double volumnNow = 0;
double volumnNeeded = 0;
double valueNow = 0;
double valueNeeded = 0;
for (StockpileItem item : items) {
volumnNow = volumnNow + item.getVolumeNow();
if (item.getVolumeNeeded() < 0) { //Only add if negative
volumnNeeded = volumnNeeded + item.getVolumeNeeded();
}
valueNow = valueNow + item.getValueNow();
if (item.getValueNeeded() < 0) { //Only add if negative
valueNeeded = valueNeeded + item.getValueNeeded();
}
}
jVolumeNow.setText(TabsStockpile.get().now() + Formater.doubleFormat(volumnNow));
jValueNow.setText(TabsStockpile.get().now() + Formater.iskFormat(valueNow));
jVolumeNeeded.setText(TabsStockpile.get().needed() + Formater.doubleFormat(volumnNeeded));
jValueNeeded.setText(TabsStockpile.get().needed() + Formater.iskFormat(valueNeeded));
}
示例10: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(ListEvent<T> listChanges) {
// Update the flag
wasNotified.set(true);
// Dump some debug information
System.out.println("TestListComponentListener Message: Updated!");
}
示例11: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(ListEvent<BibEntry> e) {
if (!enabled) {
return;
}
EventList<BibEntry> selected = e.getSourceList();
if (selected.isEmpty()) {
return;
}
final BibEntry newSelected = selected.get(0);
if ((panel.getMode() == BasePanelMode.SHOWING_EDITOR || panel.getMode() == BasePanelMode.WILL_SHOW_EDITOR)
&& panel.getEntryEditor() != null && newSelected == panel.getEntryEditor().getEntry()) {
// entry already selected and currently editing it, do not steal the focus from the selected textfield
return;
}
if (newSelected != null) {
final BasePanelMode mode = panel.getMode(); // What is the panel already showing?
if ((mode == BasePanelMode.WILL_SHOW_EDITOR) || (mode == BasePanelMode.SHOWING_EDITOR)) {
panel.showAndEdit(newSelected);
SwingUtilities.invokeLater(() -> table.ensureVisible(table.getSelectedRow()));
} else if (panel.getMode() == BasePanelMode.SHOWING_NOTHING || panel.getMode() == BasePanelMode.SHOWING_PREVIEW) {
// Either nothing or a preview was shown. Update the preview.
updatePreview(newSelected);
}
}
}
示例12: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(ListEvent<BibEntry> listEvent) {
if (listEvent.getSourceList().size() == 1) {
BibEntry entry = listEvent.getSourceList().get(0);
// Find out which BasePanel the selected entry belongs to:
BasePanel basePanel = entryHome.get(entry);
// Update the preview's database context:
preview.setDatabaseContext(basePanel.getBibDatabaseContext());
// Update the preview's entry:
preview.setEntry(entry);
preview.setBasePanel(entryHome.get(entry));
preview.setDatabaseContext(entryHome.get(entry).getBibDatabaseContext());
contentPane.setDividerLocation(0.5f);
}
}
示例13: listChanged
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
@Override
public void listChanged(ListEvent<BibEntry> listEvent) {
if (listEvent.getSourceList().size() == 1) {
preview.setEntry(listEvent.getSourceList().get(0));
contentPane.setDividerLocation(0.5f);
}
}
示例14: createCountLabel
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
private JLabel createCountLabel()
{
final JLabel label = new JLabel("");
setTextForListSummaryLabel(label);
shownList.addListEventListener(new ListEventListener<Object>()
{
public void listChanged(ListEvent<Object> evt)
{
if (!evt.isReordering())
{
setTextForListSummaryLabel(label);
}
}
});
theTable.getSelectionModel().addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
if (!e.getValueIsAdjusting())
{
setTextForListSummaryLabel(label);
}
}
});
return label;
}
示例15: installListeners
import ca.odell.glazedlists.event.ListEvent; //导入依赖的package包/类
public void installListeners(EventList<StoredSmtpMessage> filterList, final EventList<StoredSmtpMessage> baseList)
{
filterList.addListEventListener(new ListEventListener<StoredSmtpMessage>() {
public void listChanged(ListEvent<StoredSmtpMessage> listChanges)
{
baseList.getReadWriteLock().readLock().lock();
try
{
if (!listChanges.isReordering() && lastCallCount != baseList.size())
updateMessageCounts(baseList);
} finally
{
baseList.getReadWriteLock().readLock().unlock();
}
}
});
baseList.addListEventListener(new ListEventListener<StoredSmtpMessage>() {
public void listChanged(ListEvent<StoredSmtpMessage> evt)
{
boolean notEmpty = !baseList.isEmpty();
clearQueueToolItem.setEnabled(notEmpty);
exportAsMailItem.setEnabled(notEmpty);
exportAsMailBoxItem.setEnabled(notEmpty);
}
});
}