Update of /cvsroot/squirrel-sql/mavenize/thirdparty-non-maven/ilf-gpl-1.6.1/src/main/java/net/infonode/gui/icon/button
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv4128/thirdparty-non-maven/ilf-gpl-1.6.1/src/main/java/net/infonode/gui/icon/button
Added Files:
RestoreIcon.java MaximizeIcon.java TreeIcon.java
ArrowIcon.java WindowIcon.java CloseIcon.java
AbstractButtonIcon.java MinimizeIcon.java BorderIcon.java
Log Message:
pom and Source for thirdparty dependency. Maven central requires a valid source code repository for artifacts that it hosts. This project has none, so we host it here for the time being.
--- NEW FILE: BorderIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
// $Id: BorderIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import javax.swing.*;
import java.awt.*;
public class BorderIcon implements Icon {
private Icon icon;
private Color color;
private Insets insets;
public BorderIcon(Icon icon, int borderSize) {
this(icon, null, new Insets(borderSize, borderSize, borderSize, borderSize));
}
public BorderIcon(Icon icon, Color color, Insets insets) {
this.icon = icon;
this.color = color;
this.insets = insets;
}
public void paintIcon(Component c, Graphics g, int x, int y) {
if (color != null) {
Color oldColor = g.getColor();
g.setColor(color);
g.fillRect(x, y, getIconWidth(), insets.top);
g.fillRect(x, y + getIconHeight() - insets.bottom, getIconWidth(), insets.bottom);
g.fillRect(x, y + insets.top, insets.left, getIconHeight() - insets.top - insets.bottom);
g.fillRect(x + getIconWidth() - insets.right,
y + insets.top,
insets.right,
getIconHeight() - insets.top - insets.bottom);
g.setColor(oldColor);
}
icon.paintIcon(c, g, x + insets.left, y + insets.top);
}
public int getIconWidth() {
return insets.left + insets.right + icon.getIconWidth();
}
public int getIconHeight() {
return insets.top + insets.bottom + icon.getIconHeight();
}
}
--- NEW FILE: ArrowIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
// $Id: ArrowIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import net.infonode.util.Direction;
import java.awt.*;
public class ArrowIcon extends AbstractButtonIcon {
private Direction direction;
public ArrowIcon(Direction direction) {
this.direction = direction;
}
public ArrowIcon(Color color, Direction direction) {
super(color);
this.direction = direction;
}
public ArrowIcon(Color color, int size, Direction direction) {
super(color, size);
this.direction = direction;
}
public ArrowIcon(int size, Direction direction) {
this(size, direction, true);
}
public ArrowIcon(int size, Direction direction, boolean enabled) {
super(size, enabled);
this.direction = direction;
}
public Direction getDirection() {
return direction;
}
protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2) {
int size = (x2 - x1 + 1) + ((x2 - x1 + 1) % 2) - 1;
int offset = (direction.isHorizontal() ? x1 : y1) +
(direction == Direction.RIGHT || direction == Direction.DOWN ?
(size + 1) / 4 : (size - (size + 1) / 2) / 2);
int o2 = direction.isHorizontal() ? y1 : x1;
int[] c1 = direction == Direction.DOWN || direction == Direction.RIGHT ?
new int[]{offset, offset, offset + size / 2 + 1} :
new int[]{offset + size / 2 + 1, offset + size / 2 + 1, offset - (direction == Direction.UP ? 1 : 0)};
int[] c2 = {o2 + (direction == Direction.DOWN ? 0 : -1),
o2 + size + (direction == Direction.UP ? 1 : 0),
o2 + size / 2};
g.fillPolygon(direction.isHorizontal() ? c1 : c2, direction.isHorizontal() ? c2 : c1, 3);
}
}
--- NEW FILE: CloseIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
//$Id: CloseIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import net.infonode.gui.GraphicsUtil;
import java.awt.*;
/**
* @author $Author: manningr $
* @version $Revision: 1.1 $
*/
public class CloseIcon extends AbstractButtonIcon {
private static final long serialVersionUID = 1423301116958557861L;
public CloseIcon() {
super();
}
public CloseIcon(Color c) {
super(c);
}
public CloseIcon(Color c, int size) {
super(c, size);
}
public CloseIcon(int size) {
super(size);
}
protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2) {
GraphicsUtil.drawOptimizedLine(g, x1, y1 + 1, x2 - 1, y2);
GraphicsUtil.drawOptimizedLine(g, x1 + 1, y1 + 1, x2, y2);
GraphicsUtil.drawOptimizedLine(g, x1 + 1, y2, x2, y1 + 1);
GraphicsUtil.drawOptimizedLine(g, x1, y2, x2 - 1, y1 + 1);
}
}
--- NEW FILE: MaximizeIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
//$Id: MaximizeIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import net.infonode.gui.GraphicsUtil;
import java.awt.*;
/**
* @author $Author: manningr $
* @version $Revision: 1.1 $
*/
public class MaximizeIcon extends AbstractButtonIcon {
private static final long serialVersionUID = -5926578998259734919L;
public MaximizeIcon() {
super();
}
public MaximizeIcon(Color color) {
super(color);
}
public MaximizeIcon(Color color, int size) {
super(color, size);
}
public MaximizeIcon(int size) {
super(size);
}
protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2) {
GraphicsUtil.drawOptimizedLine(g, x1, y1, x2, y1);
GraphicsUtil.drawOptimizedLine(g, x1, y1 + 1, x2, y1 + 1);
GraphicsUtil.drawOptimizedLine(g, x1, y1 + 2, x1, y2);
GraphicsUtil.drawOptimizedLine(g, x2, y1 + 2, x2, y2);
GraphicsUtil.drawOptimizedLine(g, x1 + 1, y2, x2 - 1, y2);
}
}
--- NEW FILE: WindowIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
// $Id: WindowIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import java.awt.*;
/**
* @author $Author: manningr $
* @version $Revision: 1.1 $
*/
public class WindowIcon extends AbstractButtonIcon {
public WindowIcon() {
}
public WindowIcon(Color color) {
super(color);
}
public WindowIcon(Color color, int size) {
super(color, size);
}
public WindowIcon(int size) {
super(size);
}
protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2, boolean isShadow) {
g.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
if (!isShadow)
g.setColor(Color.WHITE);
g.fillRect(x1 + 1, y1 + 2, x2 - x1 - 1, y2 - y1 - 2);
}
}
--- NEW FILE: RestoreIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
//$Id: RestoreIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import net.infonode.gui.GraphicsUtil;
import java.awt.*;
/**
* @author $Author: manningr $
* @version $Revision: 1.1 $
*/
public class RestoreIcon extends AbstractButtonIcon {
private static final long serialVersionUID = 4019344427358669254L;
public RestoreIcon() {
super();
}
public RestoreIcon(Color color) {
super(color);
}
public RestoreIcon(Color color, int size) {
super(color, size);
}
public RestoreIcon(int size) {
super(size);
}
protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2) {
int boxHeight = (2 * (y2 - y1 + 1)) / 3 - 1;
int boxWidth = (5 * (x2 - x1 + 1)) / 6 - 1;
// Upper box
GraphicsUtil.drawOptimizedLine(g, x2 - boxWidth, y1, x2, y1);
GraphicsUtil.drawOptimizedLine(g, x2, y1, x2, y1 + boxHeight);
GraphicsUtil.drawOptimizedLine(g, x2 - boxWidth, y1 + 1, x2 - boxWidth, y2 - boxHeight);
GraphicsUtil.drawOptimizedLine(g, x1 + boxWidth + 1, y1 + boxHeight, x2 - 1, y1 + boxHeight);
// Lower box
GraphicsUtil.drawOptimizedLine(g, x1, y2 - boxHeight, x1, y2);
GraphicsUtil.drawOptimizedLine(g, x1 + 1, y2, x1 + boxWidth, y2);
GraphicsUtil.drawOptimizedLine(g, x1 + boxWidth, y2 - 1, x1 + boxWidth, y2 - boxHeight + 1);
GraphicsUtil.drawOptimizedLine(g, x1 + 1, y2 - boxHeight, x1 + boxWidth, y2 - boxHeight);
}
}
--- NEW FILE: TreeIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
// $Id: TreeIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import net.infonode.gui.GraphicsUtil;
import javax.swing.*;
import java.awt.*;
/**
* @author Jesper Nordenberg
* @version $Revision: 1.1 $ $Date: 2010/01/26 21:09:41 $
*/
public class TreeIcon implements Icon {
public static final int PLUS = 1;
public static final int MINUS = 2;
private int type;
private int width;
private int height;
private Color color;
private Color bgColor;
private boolean border = true;
public TreeIcon(int type, int width, int height, boolean border, Color color, Color bgColor) {
this.type = type;
this.width = width;
this.height = height;
this.border = border;
this.color = color;
this.bgColor = bgColor;
}
public TreeIcon(int type, int width, int height) {
this(type, width, height, true, Color.BLACK, null);
}
public void paintIcon(Component c, Graphics g, int x, int y) {
if (bgColor != null) {
g.setColor(bgColor);
g.fillRect(x + 1, y + 1, width - 2, height - 2);
}
g.setColor(color);
if (border) {
g.drawRect(x + 1, y + 1, width - 2, height - 2);
}
GraphicsUtil.drawOptimizedLine(g, x + 3, y + height / 2, x + width - 3, y + height / 2);
if (type == PLUS)
GraphicsUtil.drawOptimizedLine(g, x + width / 2, y + 3, x + width / 2, y + height - 3);
}
public int getIconWidth() {
return width;
}
public int getIconHeight() {
return height;
}
}
--- NEW FILE: AbstractButtonIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
// $Id: AbstractButtonIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import net.infonode.gui.ComponentUtil;
import net.infonode.util.ColorUtil;
import javax.swing.*;
import java.awt.*;
import java.io.Serializable;
public abstract class AbstractButtonIcon implements Icon, Serializable {
private static final long serialVersionUID = 1;
private int size = 10;
private Color defaultColor = null;
private boolean shadowEnabled = true;
private float shadowStrength = 0.3f;
private boolean enabled = true;
public AbstractButtonIcon() {
}
public AbstractButtonIcon(Color color) {
this.defaultColor = color;
}
public AbstractButtonIcon(Color color, int size) {
this(color);
this.size = size;
}
public AbstractButtonIcon(int size) {
this(size, true);
}
public AbstractButtonIcon(int size, boolean enabled) {
this();
this.size = size;
this.enabled = enabled;
}
public int getIconWidth() {
return size;
}
public int getIconHeight() {
return size;
}
public boolean isShadowEnabled() {
return shadowEnabled;
}
public void setShadowEnabled(boolean shadowEnabled) {
this.shadowEnabled = shadowEnabled;
}
public float getShadowStrength() {
return shadowStrength;
}
public void setShadowStrength(float shadowStrength) {
this.shadowStrength = shadowStrength;
}
public void paintIcon(Component c, Graphics g, int x, int y) {
Color oldColor = g.getColor();
Color color = defaultColor == null ?
(enabled ? c.getForeground() : UIManager.getColor("Button.disabledForeground")) :
defaultColor;
if (color == null)
color = ColorUtil.blend(ComponentUtil.getBackgroundColor(c), c.getForeground(), 0.5f);
if (shadowEnabled) {
Color background = ComponentUtil.getBackgroundColor(c);
g.setColor(ColorUtil.blend(background == null ? Color.BLACK : background, Color.BLACK, shadowStrength));
paintIcon(c, g, x + 2, y + 2, x + size - 1, y + size - 1, true);
g.setColor(color);
paintIcon(c, g, x + 1, y + 1, x + size - 2, y + size - 2, false);
}
else {
g.setColor(color);
paintIcon(c, g, x, y, x + size - 1, y + size - 1, false);
}
g.setColor(oldColor);
}
protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2, boolean isShadow) {
paintIcon(c, g, x1, y1, x2, y2);
}
protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2) {
}
}
--- NEW FILE: MinimizeIcon.java ---
/*
* Copyright (C) 2004 NNL Technology AB
* Visit www.infonode.net for information about InfoNode(R)
* products and how to contact NNL Technology AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
//$Id: MinimizeIcon.java,v 1.1 2010/01/26 21:09:41 manningr Exp $
package net.infonode.gui.icon.button;
import net.infonode.gui.GraphicsUtil;
import java.awt.*;
/**
* @author $Author: manningr $
* @version $Revision: 1.1 $
*/
public class MinimizeIcon extends AbstractButtonIcon {
private static final long serialVersionUID = 6993801965272908275L;
public MinimizeIcon() {
super();
}
public MinimizeIcon(Color color) {
super(color);
}
public MinimizeIcon(Color color, int size) {
super(color, size);
}
public MinimizeIcon(int size) {
super(size);
}
protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2) {
GraphicsUtil.drawOptimizedLine(g, x1, y2 - 1, x2, y2 - 1);
GraphicsUtil.drawOptimizedLine(g, x1, y2, x2, y2);
}
}
|