mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
LH: some painting
This commit is contained in:
+17
-16
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.SeparatorWithText;
|
||||
import com.intellij.util.ui.Table;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
@@ -139,7 +140,7 @@ public class RevisionsList {
|
||||
TODAY(LocalHistoryBundle.message("revisions.table.period.today")),
|
||||
YESTERDAY(LocalHistoryBundle.message("revisions.table.period.yesterday")),
|
||||
OLDER(LocalHistoryBundle.message("revisions.table.period.older"));
|
||||
|
||||
|
||||
private final String myDisplayString;
|
||||
|
||||
private Period(String displayString) {
|
||||
@@ -241,21 +242,25 @@ public class RevisionsList {
|
||||
myPeriodLabel.setCaption(p.getDisplayString());
|
||||
}
|
||||
|
||||
myBorder.set(table.getGridColor(), p != null, row == table.getModel().getRowCount() - 1);
|
||||
myBorder.set(row == table.getModel().getRowCount() - 1);
|
||||
|
||||
myDateLabel.setText(ensureString(FormatUtil.formatTimestamp(r.getTimestamp())));
|
||||
myTitleLabel.setText(ensureString(labelsAndColor.titleText));
|
||||
String text = ensureString(labelsAndColor.titleText);
|
||||
if (r.getChangeSetName() != null) {
|
||||
text = "<html><b>" + text + "</b></html>";
|
||||
}
|
||||
myTitleLabel.setText(text);
|
||||
myFilesNumberLabel.setText(ensureString(labelsAndColor.filesNumberText));
|
||||
|
||||
JComponent templ = (JComponent)myTemplate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
JComponent orig = (JComponent)myTemplate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
|
||||
Color bg = isSelected ? templ.getBackground() : labelsAndColor.color;
|
||||
Color fg = isSelected ? templ.getForeground() : Color.GRAY;
|
||||
Color bg = isSelected ? orig.getBackground() : labelsAndColor.color;
|
||||
Color fg = isSelected ? orig.getForeground() : Color.GRAY;
|
||||
myItemPanel.setBackground(bg);
|
||||
myDateLabel.setForeground(fg);
|
||||
myFilesNumberLabel.setForeground(fg);
|
||||
|
||||
myTitleLabel.setForeground(templ.getForeground());
|
||||
myTitleLabel.setForeground(orig.getForeground());
|
||||
myWrapperPanel.setBackground(table.getBackground());
|
||||
|
||||
return myWrapperPanel;
|
||||
@@ -304,26 +309,22 @@ public class RevisionsList {
|
||||
}
|
||||
|
||||
private static class MyBorder extends EmptyBorder {
|
||||
private Color myColor;
|
||||
private boolean isFirstInGroup;
|
||||
private boolean isLast;
|
||||
|
||||
private MyBorder() {
|
||||
super(2, 2, 2, 2);
|
||||
}
|
||||
|
||||
public void set(Color c, boolean isFirstInGroup, boolean isLast) {
|
||||
myColor = c;
|
||||
this.isFirstInGroup = isFirstInGroup;
|
||||
public void set(boolean isLast) {
|
||||
this.isLast = isLast;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
g.setColor(myColor);
|
||||
if (!isFirstInGroup) {
|
||||
g.drawLine(x, y, x + width, y);
|
||||
}
|
||||
g.setColor(UIUtil.getBorderSeparatorColor());
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
g2d.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[]{1}, 1));
|
||||
g.drawLine(x, y, x + width, y);
|
||||
if (isLast) {
|
||||
g.drawLine(x, y + height - 1, x + width, y + height - 1);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public class DiffStatusBar extends JPanel {
|
||||
|
||||
private final Collection<JComponent> myLabels = new ArrayList<JComponent>();
|
||||
|
||||
private final JLabel myTextLabel = new JLabel("", JLabel.CENTER);
|
||||
private static final int COMP_HEIGHT = 40;
|
||||
private final JLabel myTextLabel = new JLabel("");
|
||||
private static final int COMP_HEIGHT = 30;
|
||||
private EditorColorsScheme myColorScheme = null;
|
||||
|
||||
public <T extends LegendTypeDescriptor> DiffStatusBar(List<T> types) {
|
||||
@@ -51,7 +51,6 @@ public class DiffStatusBar extends JPanel {
|
||||
addDiffType(differenceType);
|
||||
}
|
||||
initGui();
|
||||
setBorder(IdeBorderFactory.createSimpleBorder());
|
||||
}
|
||||
|
||||
private void addDiffType(final LegendTypeDescriptor diffType){
|
||||
@@ -112,29 +111,29 @@ public class DiffStatusBar extends JPanel {
|
||||
}
|
||||
|
||||
private void initGui() {
|
||||
setLayout(new GridBagLayout());
|
||||
Border emptyBorder = BorderFactory.createEmptyBorder(3, 20, 5, 20);
|
||||
setBorder(emptyBorder);
|
||||
JComponent filler = new JComponent() {
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
return myTextLabel.getPreferredSize();
|
||||
}
|
||||
};
|
||||
setLayout(new BorderLayout());
|
||||
setBorder(BorderFactory.createCompoundBorder(IdeBorderFactory.createSimpleBorder(),
|
||||
BorderFactory.createEmptyBorder(3, 20, 3, 20)));
|
||||
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridy = 0;
|
||||
c.gridx = 0;
|
||||
c.gridwidth = 0;
|
||||
|
||||
add(myTextLabel, c);
|
||||
add(myTextLabel, BorderLayout.WEST);
|
||||
Box box = Box.createHorizontalBox();
|
||||
box.add(Box.createHorizontalGlue());
|
||||
JPanel panel = new JPanel(new GridLayout(1, myLabels.size(), 0, 0));
|
||||
for (final JComponent myLabel : myLabels) {
|
||||
panel.add(myLabel);
|
||||
}
|
||||
panel.setMaximumSize(panel.getPreferredSize());
|
||||
box.add(panel);
|
||||
box.add(Box.createHorizontalGlue());
|
||||
add(box, BorderLayout.CENTER);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridwidth = 1;
|
||||
add(panel, c);
|
||||
|
||||
c.gridx = 2;
|
||||
c.gridwidth = 0;
|
||||
add(Box.createHorizontalGlue(), c);
|
||||
add(filler, BorderLayout.EAST);
|
||||
}
|
||||
|
||||
public void setColorScheme(EditorColorsScheme colorScheme) {
|
||||
|
||||
Reference in New Issue
Block a user