1 16 17 package packager.model; 18 19 import Jmc.model.*; 20 import Jmc.baseTools.*; 21 import Jmc.commonGui.*; 22 23 import java.util.*; 24 25 35 48 49 public class MainModel extends base_modelValue 50 { 51 private base_treeNode pem_target = null; 52 private base_treeNode pem_source = null; 53 private base_appl_if pem_appl = null; 54 55 private base_treeNode pem_tmpnodes = null; 56 private base_multipleModelValue_if pem_copyNodes = null; 57 58 public MainModel() 59 { 60 try 61 { 62 this.pem_tmpnodes = new base_treeNode ("tmp", null); 63 } 64 catch (Exception e) 65 { 66 base_treeNode l_message = (base_treeNode)this.pem_appl.pcmf_getGuiObj().pcmf_newModelValue("errorMsg", false); 67 l_message.pcmf_setName("init"); 68 l_message.pcmf_setValue("error during initialisation of MainModel"); 69 this.pcmf_addMessage(l_message); 70 } 71 } 72 73 public void pcmf_setAppl (base_appl_if xAppl) 74 { 75 this.pem_appl = xAppl; 76 }; 77 78 public void pcmf_addTmpNode(base_treeNode xNode) 79 { 80 this.pem_tmpnodes.pcmf_addNode(xNode.pcmf_getName(), xNode); 81 }; 82 83 public void pcmf_removeTmpNode(base_treeNode xNode) 84 { 85 this.pem_tmpnodes.pcmf_removeNode(xNode); 86 }; 87 88 public void pcmf_deleteTmpNodes() 89 { 90 this.pem_tmpnodes.pcmf_clearAndRelease(); 91 }; 92 93 public void pcmf_setTarget(base_treeNode xTr) 94 { 95 this.pem_target =xTr; 96 } 97 98 public void pcmf_setSource(base_treeNode xSr) 99 { 100 this.pem_source =xSr; 101 } 102 103 public base_treeNode pcmf_getTarget() 104 { 105 return (this.pem_target); 106 } 107 108 public base_treeNode pcmf_getSource() 109 { 110 return (this.pem_source); 111 } 112 113 public void pcmf_addCopyNode (base_modelValue_if xCn) 114 { 115 Iterator l_it = this.pem_copyNodes.pcmf_getValues(); 116 base_singleModelValue_if l_ntarget = (base_singleModelValue_if)((base_multipleModelValue_if)xCn).pcmf_getModelValue("target"); 117 base_singleModelValue_if l_nsource = (base_singleModelValue_if)((base_multipleModelValue_if)xCn).pcmf_getModelValue("source"); 118 119 this.pcmf_removeTmpNode((base_treeNode)l_nsource.pcmf_getValue()); 120 121 while (l_it.hasNext()) 122 { 123 base_multipleModelValue_if l_node = (base_multipleModelValue_if)l_it.next(); 124 base_singleModelValue_if l_target = (base_singleModelValue_if)l_node.pcmf_getModelValue("target"); 125 base_singleModelValue_if l_source = (base_singleModelValue_if)l_node.pcmf_getModelValue("source"); 126 127 if (l_target.pcmf_getValue().equals(l_ntarget.pcmf_getValue()) && l_source.pcmf_getValue().equals(l_nsource.pcmf_getValue())) 128 { 129 base_treeNode l_message = (base_treeNode)this.pem_appl.pcmf_getGuiObj().pcmf_newModelValue("infoMsg", false); 130 l_message.pcmf_setName("add node"); 131 l_message.pcmf_setValue("node is already inserted here: " + l_source); 132 133 this.pcmf_addMessage(l_message); 134 135 return; 136 }; 137 } 138 this.pem_copyNodes.pcmf_addValue("", xCn); 139 } 140 141 public void pcmf_removeCopyNode (base_modelValue_if xCn) 142 { 143 ((base_treeNode)this.pem_copyNodes).pcmf_removeNode((base_treeNode)xCn); 144 } 145 146 public void pcmf_setCopyNodes (base_multipleModelValue_if xCns) 147 { 148 this.pem_copyNodes = xCns; 149 } 150 151 public void pcmf_updateTargetView() 152 { 153 base_table_if l_ttable = (base_table_if)base_registredObject.pcmf_getObjByName("targetTable"); 154 155 l_ttable.pcmf_setRowsOnly(new ArrayList()); 157 158 Iterator l_it = this.pem_copyNodes.pcmf_getValues(); 159 while (l_it.hasNext()) 160 { 161 base_multipleModelValue_if l_node = (base_multipleModelValue_if)l_it.next(); 162 base_singleModelValue_if l_target = (base_singleModelValue_if)l_node.pcmf_getModelValue("target"); 163 base_singleModelValue_if l_source = (base_singleModelValue_if)l_node.pcmf_getModelValue("source"); 164 base_singleModelValue_if l_type = (base_singleModelValue_if)l_node.pcmf_getModelValue("type"); 165 166 if (l_target.pcmf_getValue().equals(this.pem_target)) 167 { 168 ArrayList l_row = new ArrayList (4); 169 l_row.add(l_node); 170 l_row.add(l_target.pcmf_getValue()); 171 l_row.add(l_source.pcmf_getValue()); 172 l_row.add(l_type); 173 174 l_ttable.pcmf_addRow(l_row); 175 } 176 } 177 l_ttable.pcmf_commitTable(); 178 l_ttable.pcmf_repaint(); 179 } 180 181 public void pcmf_addMessage (Object xMessage) 182 { 183 base_table_if l_table = (base_table_if)base_registredObject.pcmf_getObjByName("errorTable"); 184 ArrayList l_row = new ArrayList (1); 185 l_row.add(xMessage); 186 187 l_table.pcmf_addRow(l_row); 188 l_table.pcmf_commitTable(); 189 l_table.pcmf_repaint(); 190 191 return; 192 }; 193 } | Popular Tags |