Package edit.VMAD

Source Code of edit.VMAD.ScriptRefHolder

package edit.VMAD;

import edit.HolderInterface;
import edit.StaticRecordHolder;
import skyproc.MajorRecord;
import skyproc.Mod;
import skyproc.ScriptPackage;
import skyproc.ScriptRef;
import skyproc.Type;
import skyproc.exceptions.NotFound;

public class ScriptRefHolder implements HolderInterface {

  private ScriptRef script;
  private int index;

  public ScriptRefHolder(ScriptRef script, int index) {
    this.script = script;
    this.index = index;
  }

  @Override
  public String getDescription() {
    return "Script";
  }

  @Override
  public Object getValueAt(int index) {


    MajorRecord tempRecord = null;
    try {
      tempRecord = StaticRecordHolder.getMasters().get(index).getRecord(StaticRecordHolder.getRecord().getForm());
     
      ScriptPackage sp = (ScriptPackage) tempRecord.getSubRecords().get(Type.VMAD);
     
      if(sp.getScripts().get(this.index) != null) {
        return sp.getScripts().get(this.index).getName();
      }
    } catch (NotFound e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return null;
  }

  @Override
  public boolean isLeaf() {
    // TODO Auto-generated method stub
    return true;
  }

  @Override
  public Object getChild(Object parent, int index) {
    // TODO Auto-generated method stub
    return null;
  }

  @Override
  public int getChildCount() {
    // TODO Auto-generated method stub
    return 0;
  }

  @Override
  public int getIndexOfChild(Object parent, Object child) {
    // TODO Auto-generated method stub
    return 0;
  }

  @Override
  public Object getHeldObject() {
    // TODO Auto-generated method stub
    return null;
  }

}
TOP

Related Classes of edit.VMAD.ScriptRefHolder

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.