Lines 69-74
Link Here
|
69 |
import java.text.DateFormat; |
69 |
import java.text.DateFormat; |
70 |
import java.util.ArrayList; |
70 |
import java.util.ArrayList; |
71 |
import java.util.logging.Level; |
71 |
import java.util.logging.Level; |
|
|
72 |
import javax.swing.border.LineBorder; |
72 |
import org.netbeans.modules.subversion.FileStatusCache; |
73 |
import org.netbeans.modules.subversion.FileStatusCache; |
73 |
import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; |
74 |
import org.netbeans.modules.subversion.kenai.SvnKenaiAccessor; |
74 |
import org.netbeans.modules.subversion.client.SvnClient; |
75 |
import org.netbeans.modules.subversion.client.SvnClient; |
Lines 610-617
Link Here
|
610 |
} |
611 |
} |
611 |
|
612 |
|
612 |
private class SummaryCellRenderer extends JPanel implements ListCellRenderer { |
613 |
private class SummaryCellRenderer extends JPanel implements ListCellRenderer { |
613 |
|
|
|
614 |
private static final String FIELDS_SEPARATOR = " "; // NOI18N |
614 |
private static final String FIELDS_SEPARATOR = " "; // NOI18N |
|
|
615 |
|
616 |
private ContainerRenderer cr = new ContainerRenderer(); |
617 |
private RevisionRenderer rr = new RevisionRenderer(); |
618 |
|
619 |
@Override |
620 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
621 |
if (value instanceof RepositoryRevision) { |
622 |
return cr.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
623 |
} else { |
624 |
return rr.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
625 |
} |
626 |
} |
627 |
|
628 |
private class ContainerRenderer extends JPanel implements ListCellRenderer { |
629 |
|
615 |
private static final double DARKEN_FACTOR = 0.95; |
630 |
private static final double DARKEN_FACTOR = 0.95; |
616 |
|
631 |
|
617 |
private Style selectedStyle; |
632 |
private Style selectedStyle; |
Lines 635-641
Link Here
|
635 |
private HyperlinkLabel diffLink; |
650 |
private HyperlinkLabel diffLink; |
636 |
private HyperlinkLabel revertLink; |
651 |
private HyperlinkLabel revertLink; |
637 |
|
652 |
|
638 |
public SummaryCellRenderer() { |
653 |
public ContainerRenderer() { |
639 |
selectionBackground = new JList().getSelectionBackground(); |
654 |
selectionBackground = new JList().getSelectionBackground(); |
640 |
selectionForeground = new JList().getSelectionForeground(); |
655 |
selectionForeground = new JList().getSelectionForeground(); |
641 |
|
656 |
|
Lines 688-698
Link Here
|
688 |
|
703 |
|
689 |
@Override |
704 |
@Override |
690 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
705 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
691 |
if (value instanceof RepositoryRevision) { |
|
|
692 |
renderContainer(list, (RepositoryRevision) value, index, isSelected); |
706 |
renderContainer(list, (RepositoryRevision) value, index, isSelected); |
693 |
} else { |
|
|
694 |
renderRevision(list, (RepositoryRevision.Event) value, index, isSelected); |
695 |
} |
696 |
return this; |
707 |
return this; |
697 |
} |
708 |
} |
698 |
|
709 |
|
Lines 802-841
Link Here
|
802 |
revertLink.set(NbBundle.getMessage(SummaryView.class, "CTL_Action_Revert"), foregroundColor, backgroundColor); // NOI18N |
813 |
revertLink.set(NbBundle.getMessage(SummaryView.class, "CTL_Action_Revert"), foregroundColor, backgroundColor); // NOI18N |
803 |
} |
814 |
} |
804 |
|
815 |
|
805 |
private void renderRevision(JList list, RepositoryRevision.Event dispRevision, final int index, boolean isSelected) { |
|
|
806 |
Style style; |
807 |
StyledDocument sd = textPane.getStyledDocument(); |
808 |
|
809 |
Color backgroundColor; |
810 |
Color foregroundColor; |
811 |
|
812 |
if (isSelected) { |
813 |
foregroundColor = selectionForeground; |
814 |
backgroundColor = selectionBackground; |
815 |
style = selectedStyle; |
816 |
} else { |
817 |
foregroundColor = UIManager.getColor("List.foreground"); // NOI18N |
818 |
backgroundColor = UIManager.getColor("List.background"); // NOI18N |
819 |
style = normalStyle; |
820 |
} |
821 |
textPane.setBackground(backgroundColor); |
822 |
actionsPane.setVisible(false); |
823 |
|
824 |
this.index = -1; |
825 |
try { |
826 |
sd.remove(0, sd.getLength()); |
827 |
sd.setParagraphAttributes(0, sd.getLength(), indentStyle, false); |
828 |
|
829 |
sd.insertString(sd.getLength(), String.valueOf(dispRevision.getChangedPath().getAction()), null); |
830 |
sd.insertString(sd.getLength(), FIELDS_SEPARATOR + dispRevision.getChangedPath().getPath(), null); |
831 |
|
832 |
sd.setCharacterAttributes(0, Integer.MAX_VALUE, style, false); |
833 |
resizePane(sd.getText(0, sd.getLength() - 1), list.getFontMetrics(list.getFont())); |
834 |
} catch (BadLocationException e) { |
835 |
Subversion.LOG.log(Level.SEVERE, null, e); |
836 |
} |
837 |
} |
838 |
|
839 |
private void resizePane(String text, FontMetrics fm) { |
816 |
private void resizePane(String text, FontMetrics fm) { |
840 |
if(text == null) { |
817 |
if(text == null) { |
841 |
text = ""; |
818 |
text = ""; |
Lines 871-876
Link Here
|
871 |
|
848 |
|
872 |
} |
849 |
} |
873 |
|
850 |
|
|
|
851 |
private class RevisionRenderer extends DefaultListCellRenderer { |
852 |
@Override |
853 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
854 |
renderRevision(list, (RepositoryRevision.Event) value, index, isSelected); |
855 |
return this; |
856 |
} |
857 |
private void renderRevision(JList list, RepositoryRevision.Event dispRevision, final int index, boolean isSelected) { |
858 |
StringBuilder sb = new StringBuilder(); |
859 |
sb.append(FIELDS_SEPARATOR); |
860 |
sb.append(String.valueOf(dispRevision.getChangedPath().getAction())); |
861 |
sb.append(FIELDS_SEPARATOR); |
862 |
sb.append(dispRevision.getChangedPath().getPath()); |
863 |
super.getListCellRendererComponent(list, sb.toString(), index, isSelected, isSelected); |
864 |
} |
865 |
} |
866 |
} |
867 |
|
874 |
private static class HyperlinkLabel extends JLabel { |
868 |
private static class HyperlinkLabel extends JLabel { |
875 |
|
869 |
|
876 |
public HyperlinkLabel() { |
870 |
public HyperlinkLabel() { |