Search in sources :

Example 1 with ImageResourceDimension

use of com.agiletec.plugins.jacms.aps.system.services.resource.model.ImageResourceDimension in project entando-core by entando.

the class ImageDimensionDOM method getDimensions.

/**
 * Restitusce la mappa delle dimensioni di resize previste.
 * @return La mappa delle dimensioni di resize previste.
 */
public Map<Integer, ImageResourceDimension> getDimensions() {
    Map<Integer, ImageResourceDimension> dimensions = new HashMap<Integer, ImageResourceDimension>();
    List<Element> dimensionElements = _doc.getRootElement().getChildren(TAB_DIMENSION);
    if (null != dimensionElements && dimensionElements.size() > 0) {
        Iterator<Element> dimensionElementsIter = dimensionElements.iterator();
        while (dimensionElementsIter.hasNext()) {
            Element currentElement = (Element) dimensionElementsIter.next();
            ImageResourceDimension dimension = new ImageResourceDimension();
            Element idElement = currentElement.getChild(TAB_ID);
            if (null != idElement) {
                String id = idElement.getText();
                dimension.setIdDim(Integer.parseInt(id));
            }
            Element dimxElement = currentElement.getChild(TAB_DIMX);
            if (null != dimxElement) {
                String dimx = dimxElement.getText();
                dimension.setDimx(Integer.parseInt(dimx));
            }
            Element dimyElement = currentElement.getChild(TAB_DIMY);
            if (null != dimyElement) {
                String dimy = dimyElement.getText();
                dimension.setDimy(Integer.parseInt(dimy));
            }
            dimensions.put(new Integer(dimension.getIdDim()), dimension);
            _logger.debug("Definita dimensione di resize: {}", dimension.getIdDim());
        }
    }
    return dimensions;
}
Also used : HashMap(java.util.HashMap) Element(org.jdom.Element) ImageResourceDimension(com.agiletec.plugins.jacms.aps.system.services.resource.model.ImageResourceDimension)

Example 2 with ImageResourceDimension

use of com.agiletec.plugins.jacms.aps.system.services.resource.model.ImageResourceDimension in project entando-core by entando.

the class ResourceFinderAction method getImageDimensions.

public List<ImageResourceDimension> getImageDimensions() {
    Map<Integer, ImageResourceDimension> master = this.getImageDimensionManager().getImageDimensions();
    List<ImageResourceDimension> dimensions = new ArrayList<ImageResourceDimension>(master.values());
    BeanComparator comparator = new BeanComparator("dimx");
    Collections.sort(dimensions, comparator);
    return dimensions;
}
Also used : ArrayList(java.util.ArrayList) ImageResourceDimension(com.agiletec.plugins.jacms.aps.system.services.resource.model.ImageResourceDimension) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Aggregations

ImageResourceDimension (com.agiletec.plugins.jacms.aps.system.services.resource.model.ImageResourceDimension)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 BeanComparator (org.apache.commons.beanutils.BeanComparator)1 Element (org.jdom.Element)1