X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2FSeparator.java;fp=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2FSeparator.java;h=0000000000000000000000000000000000000000;hp=e05ceb0a0cd8d75aa29fdd6065a762fa0dcc62a9;hb=f06c81000632cfb5f525ca458f719338f55f9f66;hpb=a73a906356c971b080c36368e71a15d87e8b8d31 diff --git a/src/com/googlecode/lanterna/gui2/Separator.java b/src/com/googlecode/lanterna/gui2/Separator.java deleted file mode 100644 index e05ceb0..0000000 --- a/src/com/googlecode/lanterna/gui2/Separator.java +++ /dev/null @@ -1,88 +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.Symbols; -import com.googlecode.lanterna.TerminalSize; -import com.googlecode.lanterna.graphics.ThemeDefinition; - -/** - * Static non-interactive component that is typically rendered as a single line. Normally this component is used to - * separate component from each other in situations where a bordered panel isn't ideal. By default the separator will - * ask for a size of 1x1 so you'll need to make it bigger, either through the layout manager or by overriding the - * preferred size. - * @author Martin - */ -public class Separator extends AbstractComponent { - - private final Direction direction; - - /** - * Creates a new {@code Separator} for a specific direction, which will decide whether to draw a horizontal line or - * a vertical line - * - * @param direction Direction of the line to draw within the separator - */ - public Separator(Direction direction) { - if(direction == null) { - throw new IllegalArgumentException("Cannot create a separator with a null direction"); - } - this.direction = direction; - } - - /** - * Returns the direction of the line drawn for this separator - * @return Direction of the line drawn for this separator - */ - public Direction getDirection() { - return direction; - } - - @Override - protected DefaultSeparatorRenderer createDefaultRenderer() { - return new DefaultSeparatorRenderer(); - } - - /** - * Helper interface that doesn't add any new methods but makes coding new button renderers a little bit more clear - */ - public static abstract class SeparatorRenderer implements ComponentRenderer { - } - - /** - * This is the default separator renderer that is used if you don't override anything. With this renderer, the - * separator has a preferred size of one but will take up the whole area it is given and fill that space with either - * horizontal or vertical lines, depending on the direction of the {@code Separator} - */ - public static class DefaultSeparatorRenderer extends SeparatorRenderer { - @Override - public TerminalSize getPreferredSize(Separator component) { - return TerminalSize.ONE; - } - - @Override - public void drawComponent(TextGUIGraphics graphics, Separator component) { - ThemeDefinition themeDefinition = graphics.getThemeDefinition(Separator.class); - graphics.applyThemeStyle(themeDefinition.getNormal()); - char character = themeDefinition.getCharacter(component.getDirection().name().toUpperCase(), - component.getDirection() == Direction.HORIZONTAL ? Symbols.SINGLE_LINE_HORIZONTAL : Symbols.SINGLE_LINE_VERTICAL); - graphics.fill(character); - } - } -}