@Override protected void render(ColoredTreeCellRenderer renderer) { SimpleTextAttributes rootAttributes; SimpleTextAttributes branchAttributes; if (remoteName != null && commits.size() != 0 && remoteCommits != 0 || currentBranch == null) { rootAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES.derive( SimpleTextAttributes.STYLE_BOLD, null, null, null); branchAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES; } else if (remoteName == null || commits.size() == 0) { rootAttributes = SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES; branchAttributes = SimpleTextAttributes.GRAYED_ATTRIBUTES; } else { branchAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES; rootAttributes = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES; } renderer.append(root.getPresentableUrl(), rootAttributes); if (currentBranch != null) { renderer.append(" [" + currentBranch, branchAttributes); if (remoteName != null) { renderer.append(" -> " + remoteName + "#" + remoteBranch, branchAttributes); } renderer.append("]", branchAttributes); } }
public void customizeCellRenderer( final ColoredTreeCellRenderer targetRenderer, CheckedTreeNode node, boolean selected, final boolean checked, boolean expanded, boolean leaf, boolean hasFocus) { targetRenderer.setIcon(PlatformIcons.PACKAGE_ICON); final String displayName; final CheckedTreeNode parent = (CheckedTreeNode) node.getParent(); if (parent != null && parent.getUserObject() instanceof PackageDescriptor) { final String parentPackageInTree = ((PackageDescriptor) parent.getUserObject()).getPackageName() + "."; displayName = myPackageName.startsWith(parentPackageInTree) ? myPackageName.substring(parentPackageInTree.length()) : myPackageName; } else { displayName = myPackageName; } targetRenderer.append( displayName, checked ? SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES); }
@Override protected void render(ColoredTreeCellRenderer renderer) { renderer.append( revision.asString().substring(0, HASH_PREFIX_SIZE), SimpleTextAttributes.GRAYED_ATTRIBUTES); renderer.append(": "); renderer.append(message); if (isMerge) { renderer.append( " " + GitBundle.getString("push.active.commit.node.merge"), SimpleTextAttributes.GRAYED_ATTRIBUTES); } }
protected void customizeCellRenderer( final ColoredTreeCellRenderer targetRenderer, CheckedTreeNode node, boolean selected, final boolean checked, boolean expanded, boolean leaf, boolean hasFocus) { targetRenderer.setIcon(getDisplayIcon()); targetRenderer.append( getDisplayString(), checked ? SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES); }
@Override public Component getTreeCellRendererComponent( JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { invalidate(); final VirtualFile file = getFile(value); final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; if (file == null) { if (value instanceof DefaultMutableTreeNode) { final Object uo = node.getUserObject(); if (uo instanceof String) { myColoredRenderer.getTreeCellRendererComponent( tree, value, selected, expanded, leaf, row, hasFocus); return myColoredRenderer; } } return myEmpty; } myCheckbox.setVisible(true); final TreeNodeState state = mySelectionManager.getState(node); myCheckbox.setEnabled( TreeNodeState.CLEAR.equals(state) || TreeNodeState.SELECTED.equals(state)); myCheckbox.setSelected(!TreeNodeState.CLEAR.equals(state)); myCheckbox.setOpaque(false); myCheckbox.setBackground(null); setBackground(null); myTextRenderer.getListCellRendererComponent(myFictive, file, 0, selected, hasFocus); revalidate(); return this; }
public void decorateChangeList( LocalChangeList changeList, ColoredTreeCellRenderer cellRenderer, boolean selected, boolean expanded, boolean hasFocus) { LocalTask task = getAssociatedTask(changeList); if (task != null && task.isIssue()) { cellRenderer.setIcon(task.getIcon()); } }
@Override protected void render(ColoredTreeCellRenderer renderer) { renderer.append(GitBundle.getString("push.active.status.status")); if (root.currentBranch == null) { myMessage = GitBundle.message("push.active.status.no.branch"); renderer.append(myMessage, SimpleTextAttributes.ERROR_ATTRIBUTES); } else if (root.remoteName == null) { myMessage = GitBundle.message("push.active.status.no.tracked"); renderer.append(myMessage, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES); } else if (root.remoteCommits != 0 && root.commits.size() == 0) { myMessage = GitBundle.message("push.active.status.no.commits.behind", root.remoteCommits); renderer.append(myMessage, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES); } else if (root.commits.size() == 0) { myMessage = GitBundle.message("push.active.status.no.commits"); renderer.append(myMessage, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES); } else if (root.remoteCommits != 0) { myMessage = GitBundle.message("push.active.status.behind", root.remoteCommits); renderer.append(myMessage, SimpleTextAttributes.ERROR_ATTRIBUTES); } else { myMessage = GitBundle.message("push.active.status.push", root.commits.size()); renderer.append(myMessage); } }