move(0, fieldRowHeight*difference);
moveAsMuchAsPossibleTopUp(0, fieldRowHeight*difference);
protected void validate() {  double scale = getRscale();  int rwidth = (int)(getWidth()*scale);  int rheight = (int)(Constants.RECORD_HEIGHT*scale);  setRheight(rheight);  setRwidth(rwidth);  // set appropriate font size  final int x0 = (int)(8*scale);		// insets  final int y0 = (int)(4*scale);  final int fieldRowHeight = (int)((Constants.RECORD_HEIGHT-2*4)*0.375);  Font font;    // translate name  if (PluginDebugManager.isDebugState())  {	Map macroSet = PluginDebugManager.getDebugPlugin().getMacroSet();	if (macroSet != null)		setLabel(VDBTemplateInstance.applyProperties(recordData.getName(), macroSet));	else		setLabel(recordData.getName());  }  else	  setLabel(recordData.getName());    if (rwidth<(2*x0)) font = null;  else	  font = FontMetricsBuffer.getInstance().getAppropriateFont(		  			Constants.DEFAULT_FONT, Font.PLAIN, 	 	 			getLabel(), rwidth-x0, (rheight-y0)/2);  if (font!=null) {	  FontMetrics fm = FontMetricsBuffer.getInstance().getFontMetrics(font);	  setRlabelX((rwidth-fm.stringWidth(getLabel()))/2); 	  setRlabelY(rheight/2+(rheight/2-fm.getHeight())/2+fm.getAscent());  }  setFont(font);    label2 = recordData.getType();  if (rwidth<(2*x0)) typeFont = null;  else	  typeFont = FontMetricsBuffer.getInstance().getAppropriateFont(		  			 Constants.DEFAULT_FONT, Font.PLAIN, 	 	 			 label2, rwidth-x0, (rheight-y0)/2);  if (typeFont!=null) {	  FontMetrics fm = FontMetricsBuffer.getInstance().getFontMetrics(typeFont);	  rtypeLabelX = (rwidth-fm.stringWidth(label2))/2; 	  rtypeLabelY = (rheight/2-fm.getHeight())/2+fm.getAscent();  } // !!! optimize - static   rfieldRowHeight = (rheight-2*y0)*0.375;  // code moves record up, when fields are added and down when deleted   if (oldNumOfFields != changedFields.size()) {  	int difference = oldNumOfFields - changedFields.size(); 	oldNumOfFields = changedFields.size();  	move(0, fieldRowHeight*difference);  }    // increase record size for VAL value and timestamp  if (PluginDebugManager.isDebugState())  {	VDBFieldData fld = getField(VAL_FIELD);	if (fld != null)	{		validateDebug(fld);		inDebugMode = true;		rheight *= 2;	}	else		inDebugMode = false;  }  else	inDebugMode = false;	  if (rwidth<(2*x0)) fieldFont = null;  else	  fieldFont = FontMetricsBuffer.getInstance().getAppropriateFont(		  			 Constants.DEFAULT_FONT, Font.PLAIN, 	 	 			 fieldMaxStr, rwidth-x0, (int)rfieldRowHeight);  int ascent = 0;  //rfieldRowHeight = 0;  if (fieldFont!=null) {	  FontMetrics fm = FontMetricsBuffer.getInstance().getFontMetrics(fieldFont);	  rfieldLabelX = x0; 	  rfieldLabelY = rheight+2*fm.getAscent();	  //rfieldRowHeight = fm.getHeight();	  ascent = fm.getAscent();  }  rheight += y0+rfieldRowHeight*changedFields.size()+ascent;  setHeight((int)(rheight/scale));  // round fix  rheight = (int)((getY()+getHeight())*scale)-(int)(getY()*scale);  setRheight(rheight);  // sub-components  revalidatePosition();		// rec's height can be different  validateFields(); }