Skip to content

Commit cdb2eb8

Browse files
committed
Rename Context to ProgressContext
- Relates #995
1 parent 192eb5e commit cdb2eb8

File tree

1 file changed

+16
-16
lines changed
  • spring-shell-core/src/main/java/org/springframework/shell/component/view/control

1 file changed

+16
-16
lines changed

spring-shell-core/src/main/java/org/springframework/shell/component/view/control/ProgressView.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ public class ProgressView extends BoxView {
6363
private GridView grid;
6464
private long startTime;
6565
private long updateTime;
66-
private List<TextCell<Context>> cells = new ArrayList<>();
66+
private List<TextCell<ProgressContext>> cells = new ArrayList<>();
6767

68-
private final static Function<Context, TextCell<Context>> DEFAULT_DESCRIPTION_FACTORY =
68+
private final static Function<ProgressContext, TextCell<ProgressContext>> DEFAULT_DESCRIPTION_FACTORY =
6969
(item) -> TextCell.of(item, ctx -> {
7070
return ctx.getDescription();
7171
});
7272

73-
private final static Function<Context, TextCell<Context>> DEFAULT_PERCENT_FACTORY =
73+
private final static Function<ProgressContext, TextCell<ProgressContext>> DEFAULT_PERCENT_FACTORY =
7474
(item) -> {
75-
TextCell<Context> cell = TextCell.of(item, ctx -> {
75+
TextCell<ProgressContext> cell = TextCell.of(item, ctx -> {
7676
ProgressState state = ctx.getState();
7777
int percentAbs = state.tickEnd() - state.tickStart();
7878
int relativeValue = state.tickValue() - state.tickStart();
@@ -82,9 +82,9 @@ public class ProgressView extends BoxView {
8282
return cell;
8383
};
8484

85-
private final static Function<Context, TextCell<Context>> DEFAULT_SPINNER_FACTORY =
85+
private final static Function<ProgressContext, TextCell<ProgressContext>> DEFAULT_SPINNER_FACTORY =
8686
item -> {
87-
TextCell<Context> cell = TextCell.of(item, ctx -> {
87+
TextCell<ProgressContext> cell = TextCell.of(item, ctx -> {
8888
int frame = 0;
8989

9090
// via view setting, then via theming, then fallback default
@@ -166,11 +166,11 @@ public ProgressView(int tickStart, int tickEnd, ProgressViewItem... items) {
166166
*/
167167
public static class ProgressViewItem {
168168

169-
private final Function<Context, TextCell<Context>> factory;
169+
private final Function<ProgressContext, TextCell<ProgressContext>> factory;
170170
private final int size;
171171
private final HorizontalAlign align;
172172

173-
public ProgressViewItem(Function<Context, TextCell<Context>> factory, int size, HorizontalAlign align) {
173+
public ProgressViewItem(Function<ProgressContext, TextCell<ProgressContext>> factory, int size, HorizontalAlign align) {
174174
this.factory = factory;
175175
this.size = size;
176176
this.align = align;
@@ -300,8 +300,8 @@ public void stop() {
300300
}
301301

302302
private static class BoxWrapper extends BoxView {
303-
TextCell<Context> delegate;
304-
BoxWrapper(TextCell<Context> delegate) {
303+
TextCell<ProgressContext> delegate;
304+
BoxWrapper(TextCell<ProgressContext> delegate) {
305305
this.delegate = delegate;
306306
}
307307
@Override
@@ -319,7 +319,7 @@ private void initLayout() {
319319
int index = 0;
320320
for (ProgressViewItem item : items) {
321321
columnSizes[index] = item.size;
322-
TextCell<Context> cell = item.factory.apply(buildContext());
322+
TextCell<ProgressContext> cell = item.factory.apply(buildContext());
323323
cells.add(cell);
324324
cell.setHorizontalAlign(item.align);
325325
grid.addItem(new BoxWrapper(cell), 0, index, 1, 1, 0, 0);
@@ -335,8 +335,8 @@ protected void drawInternal(Screen screen) {
335335
long current = System.currentTimeMillis();
336336

337337
updateTime = current;
338-
Context context = buildContext();
339-
for (TextCell<Context> cell : cells) {
338+
ProgressContext context = buildContext();
339+
for (TextCell<ProgressContext> cell : cells) {
340340
cell.setItem(context);
341341
}
342342

@@ -394,8 +394,8 @@ public ProgressState getState() {
394394
return ProgressState.of(tickStart, tickEnd, tickValue, running, startTime, updateTime);
395395
}
396396

397-
private Context buildContext() {
398-
return new Context() {
397+
private ProgressContext buildContext() {
398+
return new ProgressContext() {
399399

400400
@Override
401401
public String getDescription() {
@@ -432,7 +432,7 @@ public Spinner getSpinner() {
432432
/**
433433
* Context for {@code ProgressView} cell components.
434434
*/
435-
public interface Context {
435+
public interface ProgressContext {
436436

437437
/**
438438
* Get a {@link ProgressView} description.

0 commit comments

Comments
 (0)