⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autonode.java

📁 OBPM是一个开源
💻 JAVA
字号:
package cn.myapps.core.workflow.element;

import java.awt.Color;
import java.awt.Graphics;
import java.util.Enumeration;

public class AutoNode extends Node {

	public AutoNode(FlowDiagram owner) {
		super(owner);
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		FlowDiagram fd = new FlowDiagram();
		AutoNode g = new AutoNode(fd);
		// g.namelist =
		// "P1000|赛百威公司/开发部/周志军;A1000|赛百威公司/开发部/部门经理;A1000|赛百威公司/开发部/部门经理;A1000|赛百威公司/开发部/部门经理;A1000|赛百威公司/开发部/部门经理;A1000|赛百威公司/开发部/部门经理";

		System.out.println("str->" + "AutoNode Start");

	}

	public void showTips(Graphics g) {
		StringBuffer tips = new StringBuffer();
		tips.append(this.name);
		// tips.append(shortname);
		tips.append("\n");
		drawTips(g, tips.toString());

	}

	public void paint(Graphics g) {
		if (_img == null) {
			_img = _owner.getImageResource("timer.gif");
		}

		// Call All Sub Elements PAINT METHOD.
		// 保存当前背景颜色...
		Color old = this.bgcolor;
		if (_owner.isCurrentToEdit(this)) {
			bgcolor = DEF_CURREDITCOLOR;
		}

		if (_owner.isCurrentSelected(this)) {
			bgcolor = DEF_SELECTEDCOLOR;
		}

		for (Enumeration e = _subelems.elements(); e.hasMoreElements();) {
			Object te = e.nextElement();

			if (te instanceof PaintElement) {
				PaintElement se = (PaintElement) te;
				se.paint(g);
			}

		}

		// Fill background
		resize();
		g.setColor(bgcolor);
		g.fillRect(this.x, this.y, this.width, this.height);

		// Draw Image
		g.drawImage(_img, _imgrect.x, _imgrect.y, _imgrect.width,
				_imgrect.height, null, this._owner);

		if (this.name != null) {
			java.awt.FontMetrics fm = _owner.getFontMetrics(font);
			int tx = (int) (_txtrect.x + (_txtrect.width - fm.stringWidth(name)) / 2);
			int ty = (int) (_txtrect.y + 2 * _txtrect.height);
			if (this._iscurrent) {
				g.drawImage(_owner.getImageResource("current.gif"), _txtrect.x,
						_txtrect.y, _txtrect.width + 30, 10 + _txtrect.height,
						null, this._owner);
			} else {
				g.drawImage(_owner.getImageResource("background.gif"),
						_txtrect.x, _txtrect.y, _txtrect.width + 30,
						10 + _txtrect.height, null, this._owner);

			}
			g.setColor(java.awt.Color.black);
			g.drawString(name, tx + 13 + this.name.length(), ty - 10);
		}

		// 恢复当前背景颜色
		this.bgcolor = old;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -