# Copyright (c) 1999-2001 bivio Software, Inc. All rights reserved. # # Visit http://www.bivio.biz for more info. # # This library 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 2.1 of the # License, or (at your option) any later version. # # This library 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 library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: LineCell.pm,v 2.5 2008/09/15 20:58:25 moeller Exp $ package Bivio::UI::HTML::Widget::LineCell; use strict; $Bivio::UI::HTML::Widget::LineCell::VERSION = sprintf('%d.%02d', q$Revision: 2.5 $ =~ /\d+/g); $_ = $Bivio::UI::HTML::Widget::LineCell::VERSION; =head1 NAME Bivio::UI::HTML::Widget::LineCell - renders a double line cell =head1 RELEASE SCOPE bOP =head1 SYNOPSIS use Bivio::UI::HTML::Widget::LineCell; Bivio::UI::HTML::Widget::LineCell->new($attrs); =cut =head1 EXTENDS L =cut use Bivio::UI::Widget; @Bivio::UI::HTML::Widget::LineCell::ISA = qw(Bivio::UI::Widget); =head1 DESCRIPTION C draws a double line within a table cell (C tag not rendered). The color of the space between the lines is C. =head1 ATTRIBUTES =over 4 =item color : string [table_separator] Color of the line(s). =item count : int [1] Number of lines. =item height : int [1] The height of a single line of the two lines and the space in between in pixels. =back =cut #=IMPORTS use Bivio::UI::HTML::ViewShortcuts; #=VARIABLES my($_VS) = 'Bivio::UI::HTML::ViewShortcuts'; my($_IDI) = __PACKAGE__->instance_data_index; =head1 FACTORIES =cut =for html =head2 static new(hash_ref attributes) : Bivio::UI::HTML::Widget::LineCell Creates a new LineCell widget. =cut sub new { my($self) = shift->SUPER::new(@_); $self->[$_IDI] = {}; return $self; } =head1 METHODS =cut =for html =head2 initialize() Initializes static information. =cut sub initialize { my($self) = @_; my($fields) = $self->[$_IDI]; return if exists($fields->{value}); my($h) = $self->get_or_default('height', 1); my($count) = $self->get_or_default('count', 1); my($line) = "".$_VS->vs_clear_dot_as_html(1, $h).""; $fields->{value} = qq{\n} . ((qq{$line\n$line\n}) x --$count) . qq{$line
}; } =for html =head2 render(any source, string_ref buffer) Render the object. =cut sub render { my($self, $source, $buffer) = @_; my($fields) = $self->[$_IDI]; my($value) = $fields->{value}; my($req) = $source->get_request; my($c) = $self->get_or_default('color', 'table_separator'); $c = $c ? Bivio::UI::Color->format_html($c, 'bgcolor', $req) : ''; $value =~ s/!COLOR!/$c/g; $c = Bivio::UI::Color->format_html('page_bg', 'bgcolor', $req); $value =~ s/!PAGE_BG!/$c/g if $c; $$buffer .= $value; return; } #=PRIVATE METHODS =head1 COPYRIGHT Copyright (c) 1999-2001 bivio Software, Inc. All rights reserved. Visit http://www.bivio.biz for more info. This library 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 2.1 of the License, or (at your option) any later version. This library 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 library; If not, you may get a copy from: http://www.opensource.org/licenses/lgpl-license.html =head1 VERSION $Id: LineCell.pm,v 2.5 2008/09/15 20:58:25 moeller Exp $ =cut 1;