 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.log;
25 import java.util.Collection;
26 import org.jetbrains.annotations.NotNull;
41 private final Object
sync =
new Object();
89 final int bufferHeight = buffer.getTotalHeight();
91 final int oldHeight =
height;
93 if (bufferHeight <=
height) {
99 }
else if (topOffset < 0 || scrollPos > bufferHeight-
height ||
scrollPos == bufferHeight-oldHeight) {
110 public void update(@NotNull
final Buffer buffer,
final int oldBufferHeight) {
111 final int bufferHeight = buffer.getTotalHeight();
112 synchronized (
sync) {
113 if (bufferHeight <=
height) {
119 }
else if (topOffset < 0 || scrollPos > bufferHeight-
height ||
scrollPos == oldBufferHeight-
height) {
131 synchronized (
sync) {
148 synchronized (
sync) {
162 final int bufferHeight = buffer.getTotalHeight();
163 synchronized (
sync) {
164 if (bufferHeight <=
height) {
172 for (
Line line : lines) {
196 synchronized (
sync) {
206 synchronized (
sync) {
216 synchronized (
sync) {
226 synchronized (
sync) {
236 synchronized (
sync) {
246 synchronized (
sync) {
259 synchronized (
sync) {
272 final int bufferHeight = buffer.getTotalHeight();
273 synchronized (
sync) {
274 if (bufferHeight >
height) {
279 final int lineHeight = buffer.getLine(
topIndex).getHeight();
280 if (yPos < lineHeight) {
302 final int bufferHeight = buffer.getTotalHeight();
303 synchronized (
sync) {
304 if (bufferHeight <=
height) {
316 y -= buffer.getLine(
topIndex).getHeight();
void linesReplaced(@NotNull final Buffer buffer)
Some lines have been replaced at the end of the buffer.
void linesAdded(@NotNull final Buffer buffer)
Some lines have been added to the buffer.
boolean canScrollUp
Whether scrolling up is possible.
int topIndex
The first line to display in the viewable area.
boolean mustRepaint()
Returns whether the view should be repainted even if no other values have changed.
boolean mustRepaint
Whether the view has to be repainted even if no other value has changed.
Manages the contents of one text line.
void setHeight(@NotNull final Buffer buffer, final int h)
Sets the viewable height in pixel.
int getTopOffset()
Returns the number of pixels to shift the first displayed line.
int height
The height of the viewable area.
int getHeight()
Returns the height of the viewable area.
boolean canScrollDown
Whether scrolling down is possible.
Manages the contents of the contents of a log window.
void scrollTo(@NotNull final Buffer buffer, final int y)
Scrolls to the given pixel location.
void update(@NotNull final Buffer buffer, final int oldBufferHeight)
Updates the internal state after the buffer has changed.
Encapsulates the state for a scroll bar.
boolean canScrollDown()
Returns whether scrolling down is possible.
final Object sync
Synchronization object for accesses to all fields.
int getTopIndex()
Returns the index of the first line to display.
void scrollToBottom(@NotNull final Buffer buffer)
Sets the view area to the bottom-most value.
void linesRemoved(@NotNull final Buffer buffer, @NotNull final Collection< Line > lines)
Some lines have been removed from the buffer.
int getScrollPos()
Returns the location of the view area in pixels.
int topOffset
The number of pixels to shift the first displayed line (topIndex.
int scrollPos
The location of the view area relative to the buffer's total height.
boolean canScrollUp()
Returns whether scrolling up is possible.