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

📄 listitem.java

📁 一个简单的visio程序。
💻 JAVA
字号:
package webide.itools;

import java.beans.Beans;
import java.util.Vector;

public class ListItem
{
  /*---------------------------------------------------------------------*/
  /*Private Data Members-------------------------------------------------*/
  private String text;
  private String Key;
  private String Tag;
  private int Index;
  private double Top;
  private double Left;
  private ListItems   listitems;
  private boolean ideState =false;
  private boolean selected =false;
  private boolean ghosted = false;
  private int icon = 0;
  private int smallicon = 0;
  private String saveName;
  private Vector subitems;
  private boolean isDir    = false;
  /*----------------------------------------------------------------------*/
  /*Constructor-----------------------------------------------------------*/
  public ListItem()
  {
    this.text="";
    this.Key="";
    this.Tag="";
    this.Index=-1;
    this.listitems=null;
	subitems = new Vector();
  }


  public ListItem(String text,String key,String tag,int index,int icon,int smallicon,boolean isdir,ListItems t)
  {
   this.text=new String(text);
   this.Key=new String(key);
   this.Tag=new String(tag);
   this.Index=index;
   this.listitems=t;
   this.isDir = isdir;
   subitems = new Vector();
  }

  public ListItem(int index,String key,String text,int icon ,int smallicon,boolean isdir,ListItems t)
  {
   this(text,key,"",index,icon,smallicon,isdir,t);
  }


  /*----------------------------------------------------------------------*/
  /*Get / Set Properties Method ------------------------------------------*/

   // Text
   public void setText(String value) throws Exception
   {
     if (this.listitems==null) throw new Exception("91:Object variable or with block variable not set");
     if (value==null) throw new Exception("94:Invalid use of Null");
     this.text=new String(value);
     PaintListItems();
    }

   public String getText()
    {
      return this.text;
    }

  // Index     // read only at run time
   public void setIndex(int value) throws Exception
   {
     this.Index=value;
   }

   public int getIndex()
   {
    return this.Index;
   }

   // Key

   public void setKey(String value) throws Exception
   {

    if (this.listitems==null) throw new Exception("91:Object variable or with block variable not set");
     if (value==null) throw new Exception("94:Invalid use of Null");
    int returnvalue=listitems.findUnique(value,this.Index);
    if (returnvalue==0) this.Key=new String(value);
    else
      {
        if (returnvalue==1) throw new Exception("35600:Index out of bounds");
        else if (returnvalue==2)  throw new Exception("35602:Key is not unique in collection");
      }
   }

   public String getKey()
   {
    return new String(this.Key);
   }


   // Tag

   public void setTag(String value) throws Exception
   {
    if (this.listitems==null) throw new Exception("91:Object variable or with block variable not set");
    this.Tag=new String(value);
   }

   public String getTag()
   {
    return new String(this.Tag);
   }



   public void setname(String name)
   {
	 this.saveName=name;
   }

   public String getname()
   {
	 // Error return this.saveName
     return "ListItem"+this.Index;
   }

   public void setSelected(boolean b){
	   this.selected = b;
   }

   public boolean getSelected(){
		return selected;
   }

   public void setGhosted(boolean b){
	   this.ghosted = b;
	   try{
	   PaintListItems();
	   }catch(Exception e){
	   }
   }

   public boolean getGhosted(){
	   return ghosted;
   }

   public void setIcon(int c){
		this.icon = c;
   }

   public int getIcon(){
	   return this.icon;
   }

   public void setSmallIcon(int s){
	   this.smallicon = s;
   }

   public int getSmallIcon(){
	   return this.smallicon;
   }

   // Property.SubItems
   public void setSubItems(String value[])
   {
   }

   public String[] getSubItems()
   {
		String[] returnvalue = new String[subitems.size()];
		for (int n = 0; n < subitems.size(); n++)
		{
			if(this.subitems.elementAt(n) != null)
				returnvalue[n] = (String)(this.subitems.elementAt(n));
			else
				returnvalue[n] = "";
		}

		return returnvalue;
   }

   public void setSubItemsWithIndex(int i,String v) throws Exception
   {
	   if((i > subitems.size()))
	   {
		   while(i > subitems.size())
		   {
			   this.subitems.addElement("");
		   }
		   this.subitems.setElementAt(new String(v),i-1);
	   }else
	   {
		   this.subitems.setElementAt(new String(v),i-1);
	   }
   }

   public String getSubItemsWithIndex(int i)
   {
		return  new String((String)(subitems.elementAt(i-1)));
   }

   public boolean getIsDir(){
       return isDir;
    }

   public ListItem getObject()
   {
     return this;
   }
/*------------------------------------------------------------------------------------------*/
   public void ChangeIndex(int newindex)
   {
     this.Index=newindex;
   }

  public void  ChangeObject(ListItems newvalue)
  {
    this.listitems=newvalue;
  }

  private void PaintListItems() throws Exception
  {
    if (this.listitems==null) throw new Exception("91:Object variable or with block variable not set");
    this.listitems.PaintListView();
  }

 public void ChangeIDEState(boolean value)
 {
    this.ideState=value;
 }

 public String ReturnName()
 {
   return this.saveName;
 }

 /*--------------------------------------------------------------------------*/
 /*-EnsureVisible Method-------------------------------------------------------------*/
 public void EnsureVisible(){
 }
 /*---------------------------------------------------------------------------*/
} // end of Class ListItem

⌨️ 快捷键说明

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