本文整理汇总了Java中com.intellij.util.ui.tree.WideSelectionTreeUI类的典型用法代码示例。如果您正苦于以下问题:Java WideSelectionTreeUI类的具体用法?Java WideSelectionTreeUI怎么用?Java WideSelectionTreeUI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WideSelectionTreeUI类属于com.intellij.util.ui.tree包,在下文中一共展示了WideSelectionTreeUI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onDoubleClick
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public boolean onDoubleClick(MouseEvent e) {
final TreePath clickPath = myTree.getUI() instanceof WideSelectionTreeUI ? myTree.getClosestPathForLocation(e.getX(), e.getY())
: myTree.getPathForLocation(e.getX(), e.getY());
if (clickPath == null) return false;
final DataContext dataContext = DataManager.getInstance().getDataContext(myTree);
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) return false;
final TreePath selectionPath = myTree.getSelectionPath();
if (selectionPath == null || !clickPath.equals(selectionPath)) return false;
final Object lastPathComponent = selectionPath.getLastPathComponent();
if (((TreeNode)lastPathComponent).isLeaf() || !expandOnDoubleClick(((TreeNode)lastPathComponent))) {
//Node expansion for non-leafs has a higher priority
processDoubleClick(e, dataContext, (TreeNode) lastPathComponent);
return true;
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:EditSourceOnDoubleClickHandler.java
示例2: updateStyle
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
protected void updateStyle(@NotNull JEditorPane editorPane, @Nullable JTree tree, Object value, boolean selected, boolean hasFocus) {
final HTMLDocument htmlDocument = (HTMLDocument)editorPane.getDocument();
final Style style = htmlDocument.getStyleSheet().getStyle(MSG_STYLE);
if (value instanceof LoadingNode) {
StyleConstants.setForeground(style, JBColor.GRAY);
}
else {
if (selected) {
StyleConstants.setForeground(style, hasFocus ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeTextForeground());
}
else {
StyleConstants.setForeground(style, UIUtil.getTreeTextForeground());
}
}
if (UIUtil.isUnderGTKLookAndFeel() ||
UIUtil.isUnderNimbusLookAndFeel() && selected && hasFocus ||
tree != null && tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
editorPane.setOpaque(false);
}
else {
editorPane.setOpaque(selected && hasFocus);
}
htmlDocument.setCharacterAttributes(0, htmlDocument.getLength(), style, false);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:NotificationMessageElement.java
示例3: doNotFillBackground
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public static void doNotFillBackground(@NotNull final JTree tree, @NotNull final DefaultTreeCellRenderer renderer) {
TreeUI ui = tree.getUI();
if (ui instanceof WideSelectionTreeUI) {
if (((WideSelectionTreeUI)ui).isWideSelection()) {
renderer.setOpaque(false);
try {
final Field fillBackground = DefaultTreeCellRenderer.class.getDeclaredField("fillBackground");
fillBackground.setAccessible(true);
fillBackground.set(renderer, false);
}
catch (Exception e) {
// nothing
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MacUIUtil.java
示例4: onDoubleClick
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public boolean onDoubleClick(MouseEvent e) {
final TreePath clickPath = myTree.getUI() instanceof WideSelectionTreeUI ? myTree.getClosestPathForLocation(e.getX(), e.getY())
: myTree.getPathForLocation(e.getX(), e.getY());
if (clickPath == null) return false;
final DataContext dataContext = DataManager.getInstance().getDataContext(myTree);
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) return false;
final TreePath selectionPath = myTree.getSelectionPath();
if (selectionPath == null || !clickPath.equals(selectionPath)) return false;
final Object lastPathComponent = selectionPath.getLastPathComponent();
if (((TreeNode)lastPathComponent).isLeaf() || !expandOnDoubleClick(((TreeNode)lastPathComponent))) {
//Node expansion for non-leafs has a higher priority
processDoubleClick(e, dataContext, (TreeNode) lastPathComponent);
return true;
}
return false;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:EditSourceOnDoubleClickHandler.java
示例5: onDoubleClick
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public boolean onDoubleClick(MouseEvent e) {
final TreePath clickPath = myTree.getUI() instanceof WideSelectionTreeUI ? myTree.getClosestPathForLocation(e.getX(), e.getY())
: myTree.getPathForLocation(e.getX(), e.getY());
if (clickPath == null) return false;
final DataContext dataContext = DataManager.getInstance().getDataContext(myTree);
final Project project = dataContext.getData(CommonDataKeys.PROJECT);
if (project == null) return false;
final TreePath selectionPath = myTree.getSelectionPath();
if (selectionPath == null || !clickPath.equals(selectionPath)) return false;
final Object lastPathComponent = selectionPath.getLastPathComponent();
if (((TreeNode)lastPathComponent).isLeaf() || !expandOnDoubleClick(((TreeNode)lastPathComponent))) {
//Node expansion for non-leafs has a higher priority
processDoubleClick(e, dataContext, (TreeNode) lastPathComponent);
return true;
}
return false;
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:EditSourceOnDoubleClickHandler.java
示例6: updateStyle
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
protected void updateStyle(@Nonnull JEditorPane editorPane, @javax.annotation.Nullable JTree tree, Object value, boolean selected, boolean hasFocus) {
final HTMLDocument htmlDocument = (HTMLDocument)editorPane.getDocument();
final Style style = htmlDocument.getStyleSheet().getStyle(MSG_STYLE);
if (value instanceof LoadingNode) {
StyleConstants.setForeground(style, JBColor.GRAY);
}
else {
if (selected) {
StyleConstants.setForeground(style, hasFocus ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeTextForeground());
}
else {
StyleConstants.setForeground(style, UIUtil.getTreeTextForeground());
}
}
if (UIUtil.isUnderGTKLookAndFeel() ||
UIUtil.isUnderNimbusLookAndFeel() && selected && hasFocus ||
tree != null && tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
editorPane.setOpaque(false);
}
else {
editorPane.setOpaque(selected && hasFocus);
}
htmlDocument.setCharacterAttributes(0, htmlDocument.getLength(), style, false);
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:NotificationMessageElement.java
示例7: doNotFillBackground
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public static void doNotFillBackground(@Nonnull final JTree tree, @Nonnull final DefaultTreeCellRenderer renderer) {
TreeUI ui = tree.getUI();
if (ui instanceof WideSelectionTreeUI) {
if (((WideSelectionTreeUI)ui).isWideSelection()) {
renderer.setOpaque(false);
try {
final Field fillBackground = DefaultTreeCellRenderer.class.getDeclaredField("fillBackground");
fillBackground.setAccessible(true);
fillBackground.set(renderer, false);
}
catch (Exception e) {
// nothing
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:MacUIUtil.java
示例8: initTree
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
protected void initTree(Tree tree) {
tree.setCellRenderer(new ContactTreeCellRenderer());
tree.setShowsRootHandles(false);
tree.setRootVisible(false);
tree.addMouseListener(new IMContactDoubleClicker(getImPanel()));
tree.setUI(new WideSelectionTreeUI() {
});
}
开发者ID:Jamling,项目名称:SmartQQ4IntelliJ,代码行数:10,代码来源:IMContactView.java
示例9: getTreeCellRendererComponent
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public Component getTreeCellRendererComponent(
JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus
) {
setText(tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus));
setFont(UIUtil.getTreeFont());
setIcon(null);
if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
setOpaque(false);
myIsSelected = false;
myHasFocus = false;
setDoNotHighlight(selected && hasFocus);
setForeground(selected && hasFocus ? UIUtil.getTreeSelectionForeground() : UIUtil.getTreeForeground());
} else {
setOpaque(true);
myIsSelected = selected;
myHasFocus = hasFocus;
setDoNotHighlight(false);
}
myHasFocus = hasFocus;
return this;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:HighlightableCellRenderer.java
示例10: getTreeCellEditorComponent
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) {
myPanel.removeAll();
myPanel.add(myLeft.getTreeCellRendererComponent(tree, value, false, expanded, leaf, row, true), BorderLayout.WEST);
myPanel.add(myRight.getTreeCellEditorComponent(tree, value, selected, expanded, leaf, row), BorderLayout.EAST);
if (UIUtil.isFullRowSelectionLAF()) {
myPanel.setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
}
else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
if (selected) {
myPanel.setBackground(UIUtil.getTreeSelectionBackground());
}
}
else if (selected) {
myPanel.setBackground(UIUtil.getTreeSelectionBackground());
}
else {
myPanel.setBackground(null);
}
if (value instanceof LoadingNode) {
myPanel.setForeground(JBColor.GRAY);
}
else {
myPanel.setForeground(tree.getForeground());
}
if (UIUtil.isUnderGTKLookAndFeel() ||
UIUtil.isUnderNimbusLookAndFeel() && selected ||
tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
myPanel.setOpaque(false);
}
return myPanel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:NewErrorTreeEditor.java
示例11: isOverSelection
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public final boolean isOverSelection(final Point point) {
final TreeUI ui = getUI();
final TreePath path = ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection()
? getClosestPathForLocation(point.x, point.y) : getPathForLocation(point.x, point.y);
if (path == null) return false;
return isPathSelected(path);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DnDAwareTree.java
示例12: ActionsTree
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public ActionsTree() {
myRoot = new DefaultMutableTreeNode(ROOT);
myTree = new Tree(new MyModel(myRoot)) {
@Override
public void paint(Graphics g) {
super.paint(g);
Rectangle visibleRect = getVisibleRect();
Rectangle clip = g.getClipBounds();
for (int row = 0; row < getRowCount(); row++) {
Rectangle rowBounds = getRowBounds(row);
rowBounds.x = 0;
rowBounds.width = Integer.MAX_VALUE;
if (rowBounds.intersects(clip)) {
Object node = getPathForRow(row).getLastPathComponent();
if (node instanceof DefaultMutableTreeNode) {
Object data = ((DefaultMutableTreeNode)node).getUserObject();
Rectangle fullRowRect = new Rectangle(visibleRect.x, rowBounds.y, visibleRect.width, rowBounds.height);
paintRowData(this, data, fullRowRect, (Graphics2D)g);
}
}
}
}
};
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
myTree.putClientProperty(WideSelectionTreeUI.STRIPED_CLIENT_PROPERTY, Boolean.TRUE);
myTree.setCellRenderer(new KeymapsRenderer());
myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
myComponent = ScrollPaneFactory.createScrollPane(myTree,
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:ActionsTree.java
示例13: isOverSelection
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public final boolean isOverSelection(final Point point) {
final TreeUI ui = getUI();
final TreePath path = ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection()
? getClosestPathForLocation(point.x, point.y) : getPathForLocation(point.x, point.y);
if (path == null) return false;
return isPathSelected(path);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:DnDAwareTree.java
示例14: isOverSelection
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public final boolean isOverSelection(final Point point) {
final TreePath path = WideSelectionTreeUI.isWideSelection(this)
? getClosestPathForLocation(point.x, point.y) : getPathForLocation(point.x, point.y);
if (path == null) return false;
return isPathSelected(path);
}
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:DnDAwareTree.java
示例15: JBDefaultTreeCellRenderer
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public JBDefaultTreeCellRenderer(@NotNull final JTree tree) {
MacUIUtil.doNotFillBackground(tree, this);
myMacTreeUI = tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JBDefaultTreeCellRenderer.java
示例16: TreeTableTree
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public TreeTableTree(TreeModel model, TreeTable treeTable) {
super(model);
myTreeTable = treeTable;
setCellRenderer(getCellRenderer());
putClientProperty(WideSelectionTreeUI.TREE_TABLE_TREE_KEY, Boolean.TRUE);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:TreeTableTree.java
示例17: getTreeCellRendererComponent
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
public final Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus){
myTree = tree;
clear();
mySelected = selected;
myFocusedCalculated = false;
// We paint background if and only if tree path is selected and tree has focus.
// If path is selected and tree is not focused then we just paint focused border.
if (UIUtil.isFullRowSelectionLAF()) {
setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
}
else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
setPaintFocusBorder(false);
if (selected) {
setBackground(hasFocus ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground());
}
}
else if (selected) {
setPaintFocusBorder(true);
if (isFocused()) {
setBackground(UIUtil.getTreeSelectionBackground());
}
else {
setBackground(null);
}
}
else {
setBackground(null);
}
if (value instanceof LoadingNode) {
setForeground(JBColor.GRAY);
setIcon(LOADING_NODE_ICON);
}
else {
setForeground(tree.getForeground());
setIcon(null);
}
if (UIUtil.isUnderGTKLookAndFeel()){
super.setOpaque(false); // avoid nasty background
super.setIconOpaque(false);
}
else if (UIUtil.isUnderNimbusLookAndFeel() && selected && hasFocus) {
super.setOpaque(false); // avoid erasing Nimbus focus frame
super.setIconOpaque(false);
}
else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
super.setOpaque(false); // avoid erasing Nimbus focus frame
super.setIconOpaque(false);
}
else {
super.setOpaque(myOpaque || selected && hasFocus || selected && isFocused()); // draw selection background even for non-opaque tree
}
if (tree.getUI() instanceof WideSelectionTreeUI && UIUtil.isUnderAquaBasedLookAndFeel()) {
setMyBorder(null);
setIpad(new Insets(0, 2, 0, 2));
}
customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);
return this;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:74,代码来源:ColoredTreeCellRenderer.java
示例18: paint
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public void paint(Graphics g) {
int height = getHeight();
int width = getWidth();
int borderX = myLabelInsets.left - 1;
int borderY = myLabelInsets.top - 1;
int borderW = width - borderX - myLabelInsets.right + 2;
int borderH = height - borderY - myLabelInsets.bottom + 1;
if (myIcon != null) {
int verticalIconPosition = (height - myIcon.getIconHeight())/2;
myIcon.paintIcon(this, g, 0, verticalIconPosition);
borderX += myIcon.getIconWidth();
borderW -= myIcon.getIconWidth();
}
Color bgColor;
Color fgColor;
if (mySelected && myHasFocus){
bgColor = UIUtil.getTreeSelectionBackground();
fgColor = UIUtil.getTreeSelectionForeground();
}
else{
bgColor = UIUtil.getTreeTextBackground();
fgColor = getForeground();
}
// fill background
if (!(myTree.getUI() instanceof WideSelectionTreeUI) || !((WideSelectionTreeUI)myTree.getUI()).isWideSelection()) {
g.setColor(bgColor);
g.fillRect(borderX, borderY, borderW, borderH);
// draw border
if (mySelected) {
g.setColor(UIUtil.getTreeSelectionBorderColor());
UIUtil.drawDottedRectangle(g, borderX, borderY, borderX + borderW - 1, borderY + borderH - 1);
}
}
// paint text
recalculateWraps();
if (myTooSmall) { // TODO ???
return;
}
int fontHeight = getCurrFontMetrics().getHeight();
int currBaseLine = getCurrFontMetrics().getAscent();
currBaseLine += myTextInsets.top;
g.setFont(getFont());
g.setColor(fgColor);
UISettings.setupAntialiasing(g);
if (!StringUtil.isEmpty(myPrefix)) {
g.drawString(myPrefix, myTextInsets.left - myPrefixWidth + 1, currBaseLine);
}
for (int i = 0; i < myWraps.size(); i++) {
String currLine = (String)myWraps.get(i);
g.drawString(currLine, myTextInsets.left, currBaseLine);
currBaseLine += fontHeight; // first is getCurrFontMetrics().getAscent()
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:63,代码来源:MultilineTreeCellRenderer.java
示例19: getTreeCellRendererComponent
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
public final Component getTreeCellRendererComponent(
JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus
){
myTree = tree;
clear();
mySelected = selected;
myFocusedCalculated = false;
// We paint background if and only if tree path is selected and tree has focus.
// If path is selected and tree is not focused then we just paint focused border.
if (UIUtil.isFullRowSelectionLAF()) {
setBackground(selected ? UIUtil.getTreeSelectionBackground() : null);
}
else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
setPaintFocusBorder(false);
if (selected) {
setBackground(hasFocus ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground());
}
}
else {
if (selected) {
setPaintFocusBorder(true);
if (isFocused()) {
setBackground(UIUtil.getTreeSelectionBackground());
}
else {
setBackground(null);
}
}
else {
setBackground(null);
}
}
if (value instanceof LoadingNode) {
setForeground(JBColor.GRAY);
setIcon(LOADING_NODE_ICON);
}
else {
setForeground(tree.getForeground());
setIcon(null);
}
if (UIUtil.isUnderGTKLookAndFeel()){
super.setOpaque(false); // avoid nasty background
super.setIconOpaque(false);
}
else if (UIUtil.isUnderNimbusLookAndFeel() && selected && hasFocus) {
super.setOpaque(false); // avoid erasing Nimbus focus frame
super.setIconOpaque(false);
}
else if (tree.getUI() instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)tree.getUI()).isWideSelection()) {
super.setOpaque(false); // avoid erasing Nimbus focus frame
super.setIconOpaque(false);
}
else {
super.setOpaque(myOpaque || selected && hasFocus || selected && isFocused()); // draw selection background even for non-opaque tree
}
if (tree.getUI() instanceof WideSelectionTreeUI && UIUtil.isUnderAquaBasedLookAndFeel()) {
setMyBorder(null);
setIpad(new Insets(0, 2, 0, 2));
}
customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);
return this;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:77,代码来源:ColoredTreeCellRenderer.java
示例20: getImageSize
import com.intellij.util.ui.tree.WideSelectionTreeUI; //导入依赖的package包/类
@Override
protected Dimension getImageSize(int width, int height) {
final TreeUI ui = myComponent.getUI();
return new Dimension(width, ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection() ? height - 1 : height);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:TreeExpandableItemsHandler.java
注:本文中的com.intellij.util.ui.tree.WideSelectionTreeUI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论