本文整理汇总了Java中com.intellij.ui.TableScrollingUtil类的典型用法代码示例。如果您正苦于以下问题:Java TableScrollingUtil类的具体用法?Java TableScrollingUtil怎么用?Java TableScrollingUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TableScrollingUtil类属于com.intellij.ui包,在下文中一共展示了TableScrollingUtil类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rebuildPopup
import com.intellij.ui.TableScrollingUtil; //导入依赖的package包/类
private void rebuildPopup(@NotNull final UsageViewImpl usageView,
@NotNull final List<Usage> usages, @NotNull List<UsageNode> nodes,
@NotNull final JTable table, @NotNull final JBPopup popup,
@NotNull final UsageViewPresentation presentation, @NotNull final RelativePoint popupPosition,
boolean findUsagesInProgress) {
ApplicationManager.getApplication().assertIsDispatchThread();
boolean shouldShowMoreSeparator = usages.contains(MORE_USAGES_SEPARATOR);
if (shouldShowMoreSeparator) {
nodes.add(MORE_USAGES_SEPARATOR_NODE);
}
String title = presentation.getTabText();
String fullTitle = getFullTitle(usages, title, shouldShowMoreSeparator,
nodes.size() - (shouldShowMoreSeparator ? 1 : 0), findUsagesInProgress);
((AbstractPopup) popup).setCaption(fullTitle);
List<UsageNode> data = collectData(usages, nodes, usageView, presentation);
MyModel tableModel = setTableModel(table, usageView, data);
List<UsageNode> existingData = tableModel.getItems();
int row = table.getSelectedRow();
int newSelection = updateModel(tableModel, existingData, data, row == -1 ? 0 : row);
if (newSelection < 0 || newSelection >= tableModel.getRowCount()) {
TableScrollingUtil.ensureSelectionExists(table);
newSelection = table.getSelectedRow();
} else {
table.getSelectionModel().setSelectionInterval(newSelection, newSelection);
}
TableScrollingUtil.ensureIndexIsVisible(table, newSelection, 0);
setSizeAndDimensions(table, popup, popupPosition, data);
}
示例2: rebuildPopup
import com.intellij.ui.TableScrollingUtil; //导入依赖的package包/类
private void rebuildPopup(@NotNull final UsageViewImpl usageView,
@NotNull final List<Usage> usages,
@NotNull List<UsageNode> nodes,
@NotNull final JTable table,
@NotNull final JBPopup popup,
@NotNull final UsageViewPresentation presentation,
@NotNull final RelativePoint popupPosition,
boolean findUsagesInProgress) {
ApplicationManager.getApplication().assertIsDispatchThread();
boolean shouldShowMoreSeparator = usages.contains(MORE_USAGES_SEPARATOR);
if (shouldShowMoreSeparator) {
nodes.add(MORE_USAGES_SEPARATOR_NODE);
}
String title = presentation.getTabText();
String fullTitle = getFullTitle(usages, title, shouldShowMoreSeparator, nodes.size() - (shouldShowMoreSeparator ? 1 : 0), findUsagesInProgress);
((AbstractPopup)popup).setCaption(fullTitle);
List<UsageNode> data = collectData(usages, nodes, usageView, presentation);
MyModel tableModel = setTableModel(table, usageView, data);
List<UsageNode> existingData = tableModel.getItems();
int row = table.getSelectedRow();
int newSelection = updateModel(tableModel, existingData, data, row == -1 ? 0 : row);
if (newSelection < 0 || newSelection >= tableModel.getRowCount()) {
TableScrollingUtil.ensureSelectionExists(table);
newSelection = table.getSelectedRow();
}
else {
table.getSelectionModel().setSelectionInterval(newSelection, newSelection);
}
TableScrollingUtil.ensureIndexIsVisible(table, newSelection, 0);
setSizeAndDimensions(table, popup, popupPosition, data);
}
示例3: GitTableScrollChangeListener
import com.intellij.ui.TableScrollingUtil; //导入依赖的package包/类
public GitTableScrollChangeListener(final JBTable table,
final DetailsCache detailsCache,
final BigTableTableModel tableModel,
Runnable checkSelection, final Runnable fastListener) {
myDetailsCache = detailsCache;
myTableModel = tableModel;
myCheckSelection = checkSelection;
mySpeedometer = new Speedometer();
myRefreshMark = 0;
myTimer = UIUtil.createNamedTimer("Git table scroll timer",100, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (fastListener != null) {
fastListener.run();
}
final boolean shouldPing = (System.currentTimeMillis() - myRefreshMark) > 300;
//final boolean shouldPing = false;
if (((mySpeedometer.getSpeed() < 0.1) && mySpeedometer.hasData()) || shouldPing) {
myRefreshMark = System.currentTimeMillis();
if (myCheckSelection != null) {
myCheckSelection.run();
}
mySpeedometer.clear();
Pair<Integer,Integer> visibleRows = TableScrollingUtil.getVisibleRows(table);
if (visibleRows.getSecond() < 0) {
// todo check
// we cut the table, so leading/trailing compare number of rows, returned by model, with point and get incorrect results
if (visibleRows.getFirst() < 0) return; // nothing to do
visibleRows = new Pair<Integer, Integer>(visibleRows.getFirst(), myTableModel.getRowCount() - 1);
}
int difference = visibleRows.getSecond() - visibleRows.getFirst();
int start = Math.max(0, visibleRows.getFirst() - difference);
int end = Math.min(myTableModel.getRowCount() - 1, visibleRows.getSecond() + difference);
final MultiMap<VirtualFile,AbstractHash> missing = myTableModel.getMissing(start, end);
if (! missing.isEmpty()) {
myDetailsCache.acceptQuestion(missing);
}
}
}
});
}
示例4: setSizeAndDimensions
import com.intellij.ui.TableScrollingUtil; //导入依赖的package包/类
private void setSizeAndDimensions(@NotNull JTable table, @NotNull JBPopup popup,
@NotNull RelativePoint popupPosition, @NotNull List<UsageNode> data) {
JComponent content = popup.getContent();
Window window = SwingUtilities.windowForComponent(content);
Dimension d = window.getSize();
int width = calcMaxWidth(table);
width = (int) Math.max(d.getWidth(), width);
Dimension headerSize = ((AbstractPopup) popup).getHeaderPreferredSize();
width = Math.max((int) headerSize.getWidth(), width);
width = Math.max(myWidth, width);
if (myWidth == -1) myWidth = width;
int newWidth = Math.max(width, d.width + width - myWidth);
myWidth = newWidth;
int rowsToShow = Math.min(30, data.size());
Dimension dimension = new Dimension(newWidth, table.getRowHeight() * rowsToShow);
Rectangle rectangle = fitToScreen(dimension, popupPosition, table);
dimension = rectangle.getSize();
Point location = window.getLocation();
if (!location.equals(rectangle.getLocation())) {
window.setLocation(rectangle.getLocation());
}
if (!data.isEmpty()) {
TableScrollingUtil.ensureSelectionExists(table);
}
table.setSize(dimension);
//table.setPreferredSize(dimension);
//table.setMaximumSize(dimension);
//table.setPreferredScrollableViewportSize(dimension);
Dimension footerSize = ((AbstractPopup) popup).getFooterPreferredSize();
int newHeight = (int) (dimension.height + headerSize.getHeight() + footerSize.getHeight()) + 4/* invisible borders, margins etc*/;
Dimension newDim = new Dimension(dimension.width, newHeight);
window.setSize(newDim);
window.setMinimumSize(newDim);
window.setMaximumSize(newDim);
window.validate();
window.repaint();
table.revalidate();
table.repaint();
}
示例5: setSizeAndDimensions
import com.intellij.ui.TableScrollingUtil; //导入依赖的package包/类
private void setSizeAndDimensions(@NotNull JTable table,
@NotNull JBPopup popup,
@NotNull RelativePoint popupPosition,
@NotNull List<UsageNode> data) {
JComponent content = popup.getContent();
Window window = SwingUtilities.windowForComponent(content);
Dimension d = window.getSize();
int width = calcMaxWidth(table);
width = (int)Math.max(d.getWidth(), width);
Dimension headerSize = ((AbstractPopup)popup).getHeaderPreferredSize();
width = Math.max((int)headerSize.getWidth(), width);
width = Math.max(myWidth, width);
if (myWidth == -1) myWidth = width;
int newWidth = Math.max(width, d.width + width - myWidth);
myWidth = newWidth;
int rowsToShow = Math.min(30, data.size());
Dimension dimension = new Dimension(newWidth, table.getRowHeight() * rowsToShow);
Rectangle rectangle = fitToScreen(dimension, popupPosition, table);
dimension = rectangle.getSize();
Point location = window.getLocation();
if (!location.equals(rectangle.getLocation())) {
window.setLocation(rectangle.getLocation());
}
if (!data.isEmpty()) {
TableScrollingUtil.ensureSelectionExists(table);
}
table.setSize(dimension);
//table.setPreferredSize(dimension);
//table.setMaximumSize(dimension);
//table.setPreferredScrollableViewportSize(dimension);
Dimension footerSize = ((AbstractPopup)popup).getFooterPreferredSize();
int newHeight = (int)(dimension.height + headerSize.getHeight() + footerSize.getHeight()) + 4/* invisible borders, margins etc*/;
Dimension newDim = new Dimension(dimension.width, newHeight);
window.setSize(newDim);
window.setMinimumSize(newDim);
window.setMaximumSize(newDim);
window.validate();
window.repaint();
table.revalidate();
table.repaint();
}