/* AbstractColorableVob.java * * Copyright (c) 2003 by Asko Soukka * * This file is part of libvob. * * libvob 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 of the License, or * (at your option) any later version. * * libvob 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 libvob; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * */ /* * Written by Asko Soukka */ package org.nongnu.libvob; import java.util.Iterator; import java.util.List; import java.awt.Color; import java.lang.CloneNotSupportedException; /** Colorable Vob is a very basic vob type, which enhances the regular * Vob with interface for placing multiple solid colors on its * background. The multiple solid colors are used a lot in basic views * i.e. to show cursor location and node properties. In the current * implementations multiple solid colors are shown as parallel vertical * stripes or sectors. */ public abstract class AbstractColorableVob extends AbstractVob implements ColorableVob, Cloneable { public static final String rcsid = "$Id: AbstractColorableVob.java,v 1.1 2003/04/10 20:01:48 humppake Exp $"; public static boolean dbg = false; static final void p(String s) { if(dbg) System.out.println(s); } /** An array to store colors. The default value is null, but * otherwise the array contains never null values. */ protected Color[] colors = null; /** Create a multi-colored clone of the vob. Replace existing colors. * @param colors An array of colors to show inside the vob. * Reading of the array will stop at the first null. * @return A multi-colored vob. */ public ColorableVob cloneColorReplace(Color[] colors) { AbstractColorableVob clone; try { clone = (AbstractColorableVob) this.clone(); } catch (CloneNotSupportedException e) { /* if (dbg) */ e.printStackTrace(); return null; } if (colors != null) { int n; for (n=0; n