80 border = BorderFactory.createEmptyBorder(2, 2, 2, 2) |
80 border = BorderFactory.createEmptyBorder(2, 2, 2, 2) |
81 |
81 |
82 var node_name = Document.Node.Name.empty |
82 var node_name = Document.Node.Name.empty |
83 override def paintComponent(gfx: Graphics2D) |
83 override def paintComponent(gfx: Graphics2D) |
84 { |
84 { |
|
85 val size = peer.getSize() |
|
86 val insets = border.getBorderInsets(peer) |
|
87 val w = size.width - insets.left - insets.right |
|
88 val h = size.height - insets.top - insets.bottom |
|
89 |
85 nodes_status.get(node_name) match { |
90 nodes_status.get(node_name) match { |
86 case Some(st) if st.total > 0 => |
91 case Some(st) if st.total > 0 => |
87 val colors = List( |
92 val colors = List( |
88 (st.unprocessed, PIDE.options.color_value("unprocessed1_color")), |
93 (st.unprocessed, PIDE.options.color_value("unprocessed1_color")), |
89 (st.running, PIDE.options.color_value("running_color")), |
94 (st.running, PIDE.options.color_value("running_color")), |
90 (st.warned, PIDE.options.color_value("warning_color")), |
95 (st.warned, PIDE.options.color_value("warning_color")), |
91 (st.failed, PIDE.options.color_value("error_color"))) |
96 (st.failed, PIDE.options.color_value("error_color"))) |
92 |
97 |
93 val size = peer.getSize() |
|
94 val insets = border.getBorderInsets(peer) |
|
95 val w = size.width - insets.left - insets.right |
|
96 val h = size.height - insets.top - insets.bottom |
|
97 var end = size.width - insets.right |
98 var end = size.width - insets.right |
98 |
|
99 for { (n, color) <- colors } |
99 for { (n, color) <- colors } |
100 { |
100 { |
101 gfx.setColor(color) |
101 gfx.setColor(color) |
102 val v = (n * (w - colors.length) / st.total) max (if (n > 0) 4 else 0) |
102 val v = (n * (w - colors.length) / st.total) max (if (n > 0) 4 else 0) |
103 gfx.fillRect(end - v, insets.top, v, h) |
103 gfx.fillRect(end - v, insets.top, v, h) |
104 end = end - v - 1 |
104 end = end - v - 1 |
105 } |
105 } |
106 case _ => |
106 case _ => |
|
107 gfx.setColor(PIDE.options.color_value("unprocessed1_color")) |
|
108 gfx.fillRect(insets.left, insets.top, w, h) |
107 } |
109 } |
108 super.paintComponent(gfx) |
110 super.paintComponent(gfx) |
109 } |
111 } |
110 } |
112 } |
111 |
113 |