All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.terminaldriver.tn5250j.obj.ScreenTextBlock Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package com.terminaldriver.tn5250j.obj;

import com.terminaldriver.tn5250j.TerminalDriver;
import com.terminaldriver.tn5250j.exceptions.FieldNotEditableException;

public class ScreenTextBlock extends ScreenElement {

	final String value;
	final int startRow;
	final int startColumn;
	final int length;
	final String attr;
	
	final char color;
	final char attribute;

	final TerminalDriver driver;

	public ScreenTextBlock(final TerminalDriver driver, final String value, final int startRow, final int startColumn,
			final int length, final String attr) {
		super();
		this.value = value;
		this.startRow = startRow;
		this.startColumn = startColumn;
		this.length = length;
		this.attr = attr;
		this.driver = driver;
		
		this.color = '\\';
		this.attribute = '\\';
	}

	public ScreenTextBlock(final TerminalDriver driver, final String value, final int startRow, final int startColumn,
			final int length, final String attr, final char attribute, final char color) {
		super();
		this.value = value;
		this.startRow = startRow;
		this.startColumn = startColumn;
		this.length = length;
		this.attr = attr;
		this.driver = driver;
		
		this.color = color;
		this.attribute = attribute;
	}	
	
	public TerminalDriver getDriver() {
		return driver;
	}
	
	@Override
	public String getString() {
		return value;
	}

	@Override
	public int startRow() {
		return startRow;
	}

	@Override
	public int startCol() {
		return startColumn;
	}

	@Override
	public int getLength() {
		return length;
	}

	@Override
	public String getAttr() {
		return attr;
	}

	@Override
	public int startPos() {
		return (startRow - 1) * driver.getScreenColumns() + startColumn;
	}

	@Override
	public int endPos() {
		return startPos() + length;
	}

	@Override
	public void setString(final String value) {
		throw new FieldNotEditableException(this);
	}

	@Override
	public boolean isEditable() {
		return false;
	}
	
	public char getAttribute() {
		return this.attribute;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy