X-Git-Url: https://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2FAbstractBorder.java;fp=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2FAbstractBorder.java;h=0000000000000000000000000000000000000000;hb=f06c81000632cfb5f525ca458f719338f55f9f66;hp=09f8f362f3dc128d908cdc2be63defef8fc18228;hpb=a73a906356c971b080c36368e71a15d87e8b8d31;p=jvcard.git diff --git a/src/com/googlecode/lanterna/gui2/AbstractBorder.java b/src/com/googlecode/lanterna/gui2/AbstractBorder.java deleted file mode 100644 index 09f8f36..0000000 --- a/src/com/googlecode/lanterna/gui2/AbstractBorder.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of lanterna (http://code.google.com/p/lanterna/). - * - * lanterna is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * Copyright (C) 2010-2015 Martin - */ -package com.googlecode.lanterna.gui2; - - -import com.googlecode.lanterna.TerminalPosition; -import com.googlecode.lanterna.TerminalSize; - -/** - * Abstract implementation of {@code Border} interface that has some of the methods filled out. If you want to create - * your own {@code Border} implementation, should should probably extend from this. - * @author Martin - */ -public abstract class AbstractBorder extends AbstractComposite implements Border { - @Override - public void setComponent(Component component) { - super.setComponent(component); - if(component != null) { - component.setPosition(TerminalPosition.TOP_LEFT_CORNER); - } - } - - @Override - public BorderRenderer getRenderer() { - return (BorderRenderer)super.getRenderer(); - } - - @Override - public Border setSize(TerminalSize size) { - super.setSize(size); - getComponent().setSize(getWrappedComponentSize(size)); - return self(); - } - - @Override - public LayoutData getLayoutData() { - return getComponent().getLayoutData(); - } - - @Override - public Border setLayoutData(LayoutData ld) { - getComponent().setLayoutData(ld); - return this; - } - - @Override - public TerminalPosition toBasePane(TerminalPosition position) { - return super.toBasePane(position).withRelative(getWrappedComponentTopLeftOffset()); - } - - @Override - public TerminalPosition toGlobal(TerminalPosition position) { - return super.toGlobal(position).withRelative(getWrappedComponentTopLeftOffset()); - } - - private TerminalPosition getWrappedComponentTopLeftOffset() { - return getRenderer().getWrappedComponentTopLeftOffset(); - } - - private TerminalSize getWrappedComponentSize(TerminalSize borderSize) { - return getRenderer().getWrappedComponentSize(borderSize); - } -}