/** * Применить атрибуты к клифу * * @param glyph Глиф, к которому применяются атрибуты */ protected void applyAttributesToGlyph(Glyph glyph) { HashMap attrMap = attrHolder.getAttrMap(); Set keySet = attrMap.keySet(); for (Object aSet : keySet) { try { AttributeHolder.Attribute attrId = (AttributeHolder.Attribute) aSet; applyAttributeToGlyph(glyph, attrId); } catch (ClassCastException ex) { logger.debug(ex.getMessage(), ex); } } }
/** * Применить атрибут глифу * * @param glyph Глиф * @param attrId Аттрибут */ protected void applyAttributeToGlyph(Glyph glyph, AttributeHolder.Attribute attrId) { HashMap attrMap = attrHolder.getAttrMap(); switch (attrId) { case ATTR_UID: Integer uid = (Integer) attrMap.get(attrId); glyph.setId(uid); break; case ATTR_TYPE: Integer type = (Integer) attrMap.get(attrId); glyph.setType(type); break; case ATTR_COLOR: Color color = (Color) attrMap.get(attrId); glyph.setColor(color); break; case ATTR_TEXT: String text = (String) attrMap.get(attrId); glyph.setText(text); break; case ATTR_STATUS: Integer intVal = (Integer) attrMap.get(attrId); glyph.setStatus(intVal); break; case ATTR_COORDS: Point[] aPoints = (Point[]) attrMap.get(attrId); glyph.setCoo(aPoints); break; case ATTR_EDIT: Boolean b = (Boolean) attrMap.get(attrId); glyph.setEditable(b); break; } }