213 lines
5.0 KiB
Java
213 lines
5.0 KiB
Java
/* DO NOT EDIT THIS FILE. THIS FILE WAS GENERATED FROM ../Modules/awtool/AwtNote.zob,
|
|
* EDIT THAT FILE INSTEAD!
|
|
* All changes to this file will be lost.
|
|
*/
|
|
/*
|
|
Awtnote.java
|
|
*
|
|
* Copyright (c) 1999-2000, Ted Nelson and Tuomas Lukka
|
|
*
|
|
* You may use and distribute under the terms of either the GNU Lesser
|
|
* General Public License, either version 2 of the license or,
|
|
* at your choice, any later version. Alternatively, you may use and
|
|
* distribute under the terms of the XPL.
|
|
*
|
|
* See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of
|
|
* the licenses.
|
|
*
|
|
* This software 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 README
|
|
* file for more details.
|
|
*
|
|
*/
|
|
/*
|
|
* Written by Kimmo Wideroos
|
|
*/
|
|
|
|
package org.gzigzag.module;
|
|
import org.gzigzag.*;
|
|
import java.awt.*;
|
|
import java.util.*;
|
|
|
|
/** this is for awt content. change 'AwtNote' => 'AwtContent'
|
|
*/
|
|
|
|
|
|
public class AwtNote extends ZObCellRepr implements ZOb {
|
|
public static boolean dbg = false;
|
|
static final void p(String s) { if(dbg) System.out.println(s); }
|
|
static final void pa(String s) { System.out.println(s); }
|
|
|
|
|
|
/** UNDOCUMENTED.
|
|
|
|
* <p>Default value: <PRE> 0.1;</PRE>.
|
|
|
|
* @structparam 1
|
|
*/
|
|
|
|
public
|
|
double width
|
|
= 0.1;/** UNDOCUMENTED.
|
|
|
|
* <p>Default value: <PRE> 0.07;</PRE>.
|
|
|
|
* @structparam 1
|
|
*/
|
|
|
|
public double height
|
|
= 0.07;
|
|
|
|
|
|
/* AUTOGENERATED! */
|
|
static final private int fullmask = 3;
|
|
|
|
/* AUTOGENERATED! */
|
|
public String readParams(ZZCell start) {
|
|
int m = 0;
|
|
try {
|
|
if(start != null)
|
|
m = readParams(start, 0);
|
|
} catch(Throwable t) {
|
|
ZZLogger.exc(t);
|
|
} finally {
|
|
|
|
}
|
|
if((m & fullmask) != fullmask) {
|
|
// not all parameters present - no problem right now.
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/* AUTOGENERATED! */
|
|
private int readParams(ZZCell start, int mask) {
|
|
ZZCell n = start;
|
|
while(n != null) {
|
|
String s = n.getText();
|
|
// Tests autogenerated from members.
|
|
|
|
if(s.equals("width")) {
|
|
mask |= 1;
|
|
try {
|
|
ZZCell c = n.s("d.1"); s = c.getText(); width = (Double.valueOf(s)).doubleValue();
|
|
} catch(Exception e) {
|
|
ZZLogger.exc(e);
|
|
}
|
|
} else
|
|
|
|
|
|
if(s.equals("height")) {
|
|
mask |= 2;
|
|
try {
|
|
ZZCell c = n.s("d.1"); s = c.getText(); height = (Double.valueOf(s)).doubleValue();
|
|
} catch(Exception e) {
|
|
ZZLogger.exc(e);
|
|
}
|
|
} else
|
|
|
|
|
|
{ } // grab that last "else"
|
|
ZZCell h = n.h("d.3");
|
|
if(h != null && h != n) {
|
|
// recurse
|
|
mask |= readParams(h, mask);
|
|
}
|
|
n = n.s("d.2");
|
|
}
|
|
return mask;
|
|
}
|
|
|
|
|
|
|
|
// category link
|
|
private AwtLink cLink = null;
|
|
double x = Double.NaN;
|
|
double y = Double.NaN;
|
|
|
|
public void setCell(ZZCell c) {
|
|
super.setCell(c);
|
|
ZZCell cc, nCategoryCell = AwtUtil.getNoteCellCategory(c);
|
|
if(nCategoryCell != null) {
|
|
cc = c.s(AwtUtil.d_from, -1);
|
|
if(cc.s("d.1") != null)
|
|
cLink = (AwtLink)AwtUtil.readZObClone(cc);
|
|
else
|
|
cLink = new AwtLink();
|
|
cLink.setCell(cc);
|
|
} else {
|
|
cLink = new AwtLink();
|
|
}
|
|
}
|
|
|
|
public double getWidth() { return width; }
|
|
public double getHeight() { return height; }
|
|
|
|
public double[] getDimension() { return new double[] { width, height }; }
|
|
public void setDimension(double w, double h) {
|
|
width = w;
|
|
height = h;
|
|
}
|
|
|
|
public AwtLink getCategoryLink() {
|
|
return cLink;
|
|
}
|
|
|
|
public void setCategoryLink(AwtLink cl) {
|
|
cLink = cl;
|
|
}
|
|
|
|
public void setCoord(double x, double y) {
|
|
cLink.setX(x);
|
|
cLink.setY(y);
|
|
}
|
|
|
|
public void setX(double x) {
|
|
cLink.setX(x);
|
|
}
|
|
|
|
public void setY(double y) {
|
|
cLink.setY(y);
|
|
}
|
|
|
|
public double[] getCoord() {
|
|
return new double[] { cLink.getX(), cLink.getY() };
|
|
}
|
|
|
|
public double getX() {
|
|
return cLink.getX();
|
|
}
|
|
public double getY() {
|
|
return cLink.getY();
|
|
}
|
|
|
|
public String getZObName() {
|
|
return "Note";
|
|
}
|
|
|
|
/** method for storing ZOb back to structure.
|
|
* @param start quess;)
|
|
* @param clone whether or not to make the new central cell a clone of
|
|
* this.cell (default is true).
|
|
*/
|
|
public String cellRepr(ZZCell start, boolean clone)
|
|
{
|
|
ZZCell c = start.getOrNewCell("d.1");
|
|
c.setText(getZObClassName());
|
|
c.setText("AwtNote");
|
|
c = c.getOrNewCell("d.1");
|
|
c.setText("width");
|
|
c.getOrNewCell("d.1").setText(""+getWidth());
|
|
c = c.getOrNewCell("d.2");
|
|
c.setText("height");
|
|
c.getOrNewCell("d.1").setText(""+getHeight());
|
|
if(clone && !start.equals(getCell())) {
|
|
getCell().connect(AwtUtil.d_clone, start);
|
|
}
|
|
if(cLink.getCell() != null) cLink.cellRepr();
|
|
return "";
|
|
}
|
|
}
|
|
|
|
// vim: set syntax=java :
|