Пример #1
0
 /**
  * Updates the TextDescriptor on this NodeInst selected by varKey. The varKey may be a key of
  * variable on this NodeInst or one of the special keys: NodeInst.NODE_NAME NodeInst.NODE_PROTO If
  * varKey doesn't select any text descriptor, no action is performed. The TextDescriptor gives
  * information for displaying the Variable.
  *
  * @param varKey key of variable or special key.
  * @param td new value TextDescriptor
  */
 @Override
 public void setTextDescriptor(Variable.Key varKey, TextDescriptor td) {
   Variable param = getParameter(varKey);
   if (param != null) {
     td = td.withParam(true).withInherit(false).withUnit(param.getUnit());
     addParameter(param.withTextDescriptor(td));
     return;
   }
   super.setTextDescriptor(varKey, td);
 }
Пример #2
0
 //    public void addParam(Variable var) {
 //        assert var.getTextDescriptor().isParam() && var.isInherit();
 //        if (isIcon()) {
 //            // Remove variables with the same name as new parameter
 //            for (Iterator<NodeInst> it = getInstancesOf(); it.hasNext(); ) {
 //                NodeInst ni = it.next();
 //                ni.delVar(var.getKey());
 //            }
 //        }
 //        setD(getD().withoutVariable(var.getKey()).withParam(var));
 //    }
 //
 private static Variable composeInstParam(Variable iconParam, Variable instVar) {
   boolean display = !iconParam.isInterior();
   if (instVar != null) {
     return instVar
         .withParam(true)
         .withInherit(false)
         .withInterior(false)
         .withDisplay(display)
         .withUnit(iconParam.getUnit());
   }
   return iconParam.withInherit(false).withInterior(false).withDisplay(display);
 }