本文整理汇总了Java中ca.odell.glazedlists.EventList.get方法的典型用法代码示例。如果您正苦于以下问题:Java EventList.get方法的具体用法?Java EventList.get怎么用?Java EventList.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.odell.glazedlists.EventList
的用法示例。
在下文中一共展示了EventList.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePanel
import ca.odell.glazedlists.EventList; //导入方法依赖的package包/类
private void updatePanel() {
EventList<Message> list = TmmUIMessageCollector.instance.getMessages();
list.getReadWriteLock().readLock().lock();
try {
for (int i = 0; i < list.size(); i++) {
Message message = list.get(i);
if (!messageMap.containsKey(message)) {
MessagePanel panel = new MessagePanel(message);
messageMap.put(message, panel);
messagesPanel.add(panel);
}
}
messagesPanel.revalidate();
messagesPanel.repaint();
}
finally {
list.getReadWriteLock().readLock().unlock();
}
}
示例2: updatePreview
import ca.odell.glazedlists.EventList; //导入方法依赖的package包/类
private void updatePreview(final BibEntry toShow, int repeats) {
if (workingOnPreview) {
if (repeats > 0) {
return; // We've already waited once. Give up on this selection.
}
Timer t = new Timer(50, actionEvent -> updatePreview(toShow, 1));
t.setRepeats(false);
t.start();
return;
}
EventList<BibEntry> list = table.getSelected();
// Check if the entry to preview is still selected:
if ((list.size() != 1) || (list.get(0) != toShow)) {
return;
}
workingOnPreview = true;
SwingUtilities.invokeLater(() -> {
panel.showPreview(toShow);
workingOnPreview = false;
});
}
示例3: deleteLoadProfileEntity
import ca.odell.glazedlists.EventList; //导入方法依赖的package包/类
/**
* Deletes the selected load profile entity. This method is registered on the {@link EventBus}
* and called when the specified event is posted.
*
* @param e
* the event that triggers calling of this method when posted on the event bus
*/
@Subscribe
public void deleteLoadProfileEntity(final ToolsDeleteLoadProfileEntityAction.Event e) {
Object obj = tree.getLastSelectedPathComponent();
if (obj instanceof LoadProfileEntity) {
if (JOptionPane.showConfirmDialog(AppFrame.this, "Delete element?", UIManager.getString("OptionPane.titleText"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
LoadProfileEntity selectedLoadProfileEntity = (LoadProfileEntity) obj;
EventList<LoadProfileEntity> treeItems = loadProfilesController.getTreeItems();
// We need to sort in order to find the correct sibling to select next
Collections.sort(treeItems);
int index = treeItems.indexOf(selectedLoadProfileEntity);
treeItems.remove(index);
if (!treeItems.isEmpty()) {
if (index >= 0) {
index = max(0, index - 1);
}
selectedLoadProfileEntity = treeItems.get(index);
expandTreeAndSelect(selectedLoadProfileEntity);
}
updateGraph();
}
}
}
示例4: get
import ca.odell.glazedlists.EventList; //导入方法依赖的package包/类
public static <E> E get(EventList<E> eventList, int index) {
try {
eventList.getReadWriteLock().readLock().lock();
return eventList.get(index);
} finally {
eventList.getReadWriteLock().readLock().unlock();
}
}
示例5: listChanged
import ca.odell.glazedlists.EventList; //导入方法依赖的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);
}
}
}
示例6: findEntry
import ca.odell.glazedlists.EventList; //导入方法依赖的package包/类
public int findEntry(BibEntry entry) {
EventList<BibEntry> tableRows = model.getTableRows();
for (int row = 0; row < tableRows.size(); row++) {
BibEntry bibEntry = tableRows.get(row);
if (entry == bibEntry) { // NOPMD (equals doesn't recognise duplicates)
return row;
}
}
return -1;
}