This commit is contained in:
Janne Valkealahti
2023-10-20 09:03:08 +01:00
parent 92eb7dd2b7
commit 4871b19c58
3 changed files with 2 additions and 79 deletions

View File

@@ -1,79 +0,0 @@
/*
* Copyright 2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.shell.component.view.control;
import org.springframework.shell.component.view.screen.Screen;
/**
* Base interface for all cells. Typically a {@link Cell} is a building block in
* a {@link View} not needing to be aware of how it is drawn into a {@link Screen}
* but needs to aware of its "item", bounds via {@link Control} and other
* properties like {@code background}.
*
* @author Janne Valkealahti
*/
public interface Cell<T> extends Control {
/**
* Get item bound to a cell.
*
* @return item bound to a cell
*/
T getItem();
/**
* Sets an item to bound into a cell.
*
* @param item item to bound into a cell
*/
void setItem(T item);
/**
* Sets a style.
*
* @param style the style
*/
void setStyle(int style);
/**
* Sets a foreground color.
*
* @param foregroundColor the background color
*/
void setForegroundColor(int foregroundColor);
/**
* Sets a background color.
*
* @param backgroundColor the background color
*/
void setBackgroundColor(int backgroundColor);
/**
* Return if cell is selected.
*
* @return true if cell is selected
*/
boolean isSelected();
/**
* Update selected status.
*
* @param selected true if cell is selected
*/
void updateSelected(boolean selected);
}

View File

@@ -16,6 +16,7 @@
package org.springframework.shell.component.view.control;
import org.springframework.lang.Nullable;
import org.springframework.shell.component.view.control.cell.Cell;
import org.springframework.shell.component.view.screen.Screen;
import org.springframework.shell.geom.Rectangle;
import org.springframework.shell.style.ThemeResolver;

View File

@@ -16,6 +16,7 @@
package org.springframework.shell.component.view.control.cell;
import org.springframework.shell.component.view.control.Control;
import org.springframework.shell.component.view.control.View;
import org.springframework.shell.component.view.screen.Screen;
/**