Package com.eteks.sweethome3d.model

Examples of com.eteks.sweethome3d.model.Content


             Object value, boolean isSelected, boolean hasFocus,
             int row, int column) {
          CatalogPieceOfFurniture piece = (CatalogPieceOfFurniture)value;
          JLabel label = (JLabel)super.getTableCellRendererComponent(
            table, "", isSelected, hasFocus, row, column);
          Content iconContent;
          if (FurnitureLibrary.FURNITURE_ICON_PROPERTY.equals(propertyKey)) {
            iconContent = piece.getIcon();
          } else {
            iconContent = piece.getPlanIcon();
          }
View Full Code Here


  /**
   * Sets the edited icon.
   */
  public void setIcon(Content icon) {
    if (icon != this.icon) {
      Content oldIcon = this.icon;
      this.icon = icon;
      this.propertyChangeSupport.firePropertyChange(Property.ICON.name(), oldIcon, icon);
    }
  }
View Full Code Here

  /**
   * Sets the edited model.
   */
  public void setModel(Content model) {
    if (model != this.model) {
      Content oldModel = this.model;
      this.model = model;
      this.propertyChangeSupport.firePropertyChange(Property.MODEL.name(), oldModel, model);
    }
  }
View Full Code Here

    if (!this.modifiedFurniture.isEmpty()) {
      String id = getId();
      String name = getName();
      String description = getDescription();
      FurnitureCategory category = getCategory();
      Content model = getModel();
      Content icon = getIcon();
      Float width = getWidth();
      Float depth = getDepth();
      Float height = getHeight();
      Float elevation = getElevation();
      Boolean movable = getMovable();
      Boolean resizable = getResizable();
      Boolean deformable = getDeformable();
      Boolean doorOrWindow = getDoorOrWindow();
      float [][] modelRotation = getModelRotation();
      String creator = getCreator();
      BigDecimal price = getPrice();
      BigDecimal valueAddedTaxPercentage = getValueAddedTaxPercentage();
      boolean defaultFurnitureLanguage = FurnitureLibrary.DEFAULT_LANGUAGE.equals(this.furnitureLanguageController.getFurnitureLangauge());
     
      // Apply modification
      int piecesCount = this.modifiedFurniture.size();
      for (CatalogPieceOfFurniture piece : this.modifiedFurniture) {
        int index = this.furnitureLibrary.getPieceOfFurnitureIndex(piece);
        // Retrieve localized data
        Map<String, Object> localizedNames = new HashMap<String, Object>();
        Map<String, Object> localizedDescriptions = new HashMap<String, Object>();
        Map<String, Object> localizedCategories = new HashMap<String, Object>();
        for (String language : this.furnitureLibrary.getSupportedLanguages()) {
          Object pieceName = this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
              piece, language, FurnitureLibrary.FURNITURE_NAME_PROPERTY);
          if (pieceName != null) {
            localizedNames.put(language, pieceName);
          }
          Object pieceDescription = this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
              piece, language, FurnitureLibrary.FURNITURE_DESCRIPTION_PROPERTY);
          if (pieceDescription != null) {
            localizedDescriptions.put(language, pieceDescription);
          }
          Object categoryName = this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
              piece, language, FurnitureLibrary.FURNITURE_CATEGORY_PROPERTY);
          if (categoryName != null) {
            localizedCategories.put(language, categoryName);
          }
        }
        this.furnitureLibrary.deletePieceOfFurniture(piece);
       
        String pieceId = id != null || piecesCount == 1 ? id : piece.getId();
        String pieceName = name != null && defaultFurnitureLanguage ? name : piece.getName();
        String pieceDescription = description != null && defaultFurnitureLanguage ? description : piece.getDescription();
        FurnitureCategory pieceCategory = category != null && defaultFurnitureLanguage ? category : piece.getCategory();
        Content pieceModel = model != null ? model : piece.getModel();
        Content pieceIcon = icon != null ? icon : piece.getIcon();
        float pieceWidth = width != null ? width : piece.getWidth();
        float pieceDepth = depth != null ? depth : piece.getDepth();
        float pieceHeight = height != null ? height : piece.getHeight();
        float pieceElevation = elevation != null ? elevation : piece.getElevation();
        boolean pieceMovable = movable != null ? movable : piece.isMovable();
View Full Code Here

    if (Thread.interrupted()) {
      throw new InterruptedException();
    }

    Vector3f size = ModelManager.getInstance().getSize(model);
    Content iconContent;
    try {
      // Generate icon image
      this.iconPreviewComponent.setModel(model);
      Thread.sleep(this.firstRendering ? 1000 : 100);
      this.firstRendering = false;
View Full Code Here

      writer.newLine();
      writeProperty(writer, DefaultFurnitureCatalog.PropertyKey.ID, i, piece.getId());
      writeProperty(writer, DefaultFurnitureCatalog.PropertyKey.NAME, i, piece.getName());
      writeProperty(writer, DefaultFurnitureCatalog.PropertyKey.DESCRIPTION, i, piece.getDescription());
      writeProperty(writer, DefaultFurnitureCatalog.PropertyKey.CATEGORY, i, piece.getCategory().getName());
      Content pieceModel = piece.getModel();
      String contentBaseName;
      if (contentMatchingFurnitureName
          || !(pieceModel instanceof URLContent)
          || ((URLContent)pieceModel).getURL().getFile().toString().endsWith("model.obj")) {
        contentBaseName = piece.getName();
View Full Code Here

      }
    }
   
    Map<String, List<ZipEntry>> zipUrlsEntries = new HashMap<String, List<ZipEntry>>();
    for (Map.Entry<Content, String> contentEntry : contentEntries.entrySet()) {
      Content content = contentEntry.getKey();
      if (content instanceof URLContent) {
        URLContent urlContent = (URLContent)content;
        String entryName = contentEntry.getValue();
        if (entryName.indexOf('/') != -1) {
          writeZipEntries(zipOut, offlineFurnitureLibrary, furnitureResourcesLocalDirectory,
View Full Code Here

      } catch (MissingResourceException ex) {
        // Stop the loop when a key name# doesn't exist
        break;
      }
      String category = resource.getString(PropertyKey.CATEGORY.getKey(index));
      Content image  = getContent(resource, PropertyKey.IMAGE.getKey(index),
          texturesUrl, texturesResourcesUrlBase);
      float width = Float.parseFloat(resource.getString(PropertyKey.WIDTH.getKey(index)));
      float height = Float.parseFloat(resource.getString(PropertyKey.HEIGHT.getKey(index)));
      String creator = getOptionalString(resource, PropertyKey.CREATOR.getKey(index));
      String id = getOptionalString(resource, PropertyKey.ID.getKey(index));
View Full Code Here

      if (NAME.equals(key)) {
        return this.pluginAction.getPropertyValue(PluginAction.Property.NAME);
      } else if (SHORT_DESCRIPTION.equals(key)) {
        return this.pluginAction.getPropertyValue(PluginAction.Property.SHORT_DESCRIPTION);
      } else if (SMALL_ICON.equals(key)) {
        Content smallIcon = (Content)this.pluginAction.getPropertyValue(PluginAction.Property.SMALL_ICON);
        return smallIcon != null
            ? IconManager.getInstance().getIcon(smallIcon, DEFAULT_SMALL_ICON_HEIGHT, HomePane.this)
            : null;
      } else if (MNEMONIC_KEY.equals(key)) {
        Character mnemonic = (Character)this.pluginAction.getPropertyValue(PluginAction.Property.MNEMONIC);
View Full Code Here

    objectOut.writeObject(home);
    objectOut.flush();
    zipOut.closeEntry();
    // Write Content objects in files "0" to "n"
    for (int i = 0, n = contents.size(); i < n; i++) {
      Content content = contents.get(i);
      String entryNameOrDirectory = String.valueOf(i);
      if (content instanceof ResourceURLContent) {
        writeResourceZipEntries(zipOut, entryNameOrDirectory, (ResourceURLContent)content);
      } else if (content instanceof URLContent
                 && ((URLContent)content).isJAREntry()) {
View Full Code Here

TOP

Related Classes of com.eteks.sweethome3d.model.Content

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.