Package com.eteks.sweethome3d.model

Examples of com.eteks.sweethome3d.model.CatalogPieceOfFurniture


    int column = columnAtPoint(ev.getPoint());
    if (column != -1
        && FurnitureLibrary.FURNITURE_ICON_PROPERTY.equals(getColumnModel().getColumn(column).getIdentifier())) {
      int row = rowAtPoint(ev.getPoint());
      if (row != -1) {
        CatalogPieceOfFurniture piece = (CatalogPieceOfFurniture)getModel().getValueAt(row, 0);
        if (piece.getIcon() instanceof URLContent) {
          String tooltip = "<html><center><img width='128' height='128' src='"
              + ((URLContent)piece.getIcon()).getURL() + "'>";
          return tooltip;
        }
      }
    }
    return null;
View Full Code Here


    }

    private void addFurnitureLibraryListener(final FurnitureLibrary furnitureLibrary) {
      furnitureLibrary.addListener(new CollectionListener<CatalogPieceOfFurniture>() {
        public void collectionChanged(CollectionEvent<CatalogPieceOfFurniture> ev) {
          CatalogPieceOfFurniture piece = ev.getItem();
          int pieceIndex = ev.getIndex();
          switch (ev.getType()) {
            case ADD :
              int insertionIndex = getPieceOfFurnitureInsertionIndex(piece, furnitureLibrary, pieceIndex);
              if (insertionIndex != -1) {
View Full Code Here

    /**
     * Returns the index of <code>piece</code> in furniture table, or -1.
     */
    public int getPieceOfFurnitureIndex(CatalogPieceOfFurniture searchedPiece) {
      for (int i = 0, n = this.sortedFurniture.size(); i < n; i++) {
        CatalogPieceOfFurniture piece = this.sortedFurniture.get(i);
        if (searchedPiece == piece) {
          return i;
        }
      }
      return -1;
View Full Code Here

      } else if (FurnitureLibrary.FURNITURE_NAME_PROPERTY.equals(propertyKey)) {
        return new DefaultTableCellRenderer() {
            @Override
            public Component getTableCellRendererComponent(JTable table, Object value,
                boolean isSelected, boolean hasFocus, int row, int column) {
              CatalogPieceOfFurniture piece = (CatalogPieceOfFurniture)value;
              String pieceName = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
                    piece, controller.getFurnitureLangauge(), propertyKey, piece.getName());
              return super.getTableCellRendererComponent(
                  table, pieceName, isSelected, hasFocus, row, column);
            }
          };
      } else if (FurnitureLibrary.FURNITURE_DESCRIPTION_PROPERTY.equals(propertyKey)) {
        return new DefaultTableCellRenderer() {
            @Override
            public Component getTableCellRendererComponent(JTable table, Object value,
                boolean isSelected, boolean hasFocus, int row, int column) {
              CatalogPieceOfFurniture piece = (CatalogPieceOfFurniture)value;
              String pieceDescription = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
                    piece, controller.getFurnitureLangauge(), propertyKey, piece.getDescription());
              return super.getTableCellRendererComponent(
                  table, pieceDescription, isSelected, hasFocus, row, column);
            }
          };
      } else if (FurnitureLibrary.FURNITURE_CATEGORY_PROPERTY.equals(propertyKey)) {
        return new DefaultTableCellRenderer() {
            @Override
            public Component getTableCellRendererComponent(JTable table, Object value,
                boolean isSelected, boolean hasFocus, int row, int column) {
              CatalogPieceOfFurniture piece = (CatalogPieceOfFurniture)value;
              String pieceCategory = (String)furnitureLibrary.getPieceOfFurnitureLocalizedData(
                    piece, controller.getFurnitureLangauge(), propertyKey, piece.getCategory().getName());
              return super.getTableCellRendererComponent(
                  table, pieceCategory, isSelected, hasFocus, row, column);
            }
          };
      } else if (FurnitureLibrary.FURNITURE_CREATOR_PROPERTY.equals(propertyKey)) {
View Full Code Here

      return new DefaultTableCellRenderer() {
        @Override
        public Component getTableCellRendererComponent(JTable table,
             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();
          }
          if (iconContent != null) {
            label.setIcon(IconManager.getInstance().getIcon(
                iconContent, table.getRowHeight(), table));
            label.setHorizontalAlignment(JLabel.CENTER);
View Full Code Here

      setCreator(null);
      setPrice(null);
      setValueAddedTaxPercentage(null);
      this.editableProperties.remove(Property.PROPORTIONAL);
    } else {
      CatalogPieceOfFurniture firstPiece = this.modifiedFurniture.get(0);
     
      setBackFaceShown(false);
      if (this.modifiedFurniture.size() == 1) {
        setIcon(firstPiece.getIcon());
        setModel(firstPiece.getModel());
        this.editableProperties.add(Property.BACK_FACE_SHOWN);
      } else {
        setIcon(null);
        setModel(null);
        this.editableProperties.remove(Property.BACK_FACE_SHOWN);
      }
     
      // Search the common properties among selected furniture
      String id = firstPiece.getId();
      if (id != null) {
        for (int i = 1; i < this.modifiedFurniture.size(); i++) {
          if (!id.equals(this.modifiedFurniture.get(i).getId())) {
            id = null;
            break;
          }
        }
      }
      setId(id);
     
      String furnitureLanguage = this.furnitureLanguageController.getFurnitureLangauge();
      String name = (String)this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
          firstPiece, furnitureLanguage, FurnitureLibrary.FURNITURE_NAME_PROPERTY, firstPiece.getName());
      if (name != null) {
        for (int i = 1; i < this.modifiedFurniture.size(); i++) {
          CatalogPieceOfFurniture piece = this.modifiedFurniture.get(i);
          if (!name.equals(this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
              piece, furnitureLanguage, FurnitureLibrary.FURNITURE_NAME_PROPERTY, piece.getName()))) {
            name = null;
            break;
          }
        }
      }
      setName(name);
     
      String description = (String)this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
          firstPiece, furnitureLanguage, FurnitureLibrary.FURNITURE_DESCRIPTION_PROPERTY, firstPiece.getDescription());
      if (description != null) {
        for (int i = 1; i < this.modifiedFurniture.size(); i++) {
          CatalogPieceOfFurniture piece = this.modifiedFurniture.get(i);
          if (!description.equals(this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
              piece, furnitureLanguage, FurnitureLibrary.FURNITURE_DESCRIPTION_PROPERTY, piece.getDescription()))) {
            description = null;
            break;
          }
        }
      }
      setDescription(description);
     
      FurnitureCategory category = firstPiece.getCategory();
      String categoryName = (String)this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
          firstPiece, furnitureLanguage, FurnitureLibrary.FURNITURE_CATEGORY_PROPERTY, category.getName());
      if (category != null) {
        for (int i = 1; i < this.modifiedFurniture.size(); i++) {
          CatalogPieceOfFurniture piece = this.modifiedFurniture.get(i);
          if (!categoryName.equals(this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
              piece, furnitureLanguage, FurnitureLibrary.FURNITURE_CATEGORY_PROPERTY, piece.getCategory().getName()))) {
            category = null;
            break;
          }
        }
      }
View Full Code Here

                pieceWidth, pieceDepth, pieceHeight, pieceElevation, pieceMovable,
                1, 0, new Sash [0],
                pieceModelRotation, pieceCreator, pieceResizable, pieceDeformable, piece.isTexturable(),
                piecePrice, pieceValueAddedTaxPercentage);
          } else {
            piece = new CatalogPieceOfFurniture(pieceId, pieceName, pieceDescription,
                pieceIcon, piece.getPlanIcon(), pieceModel,
                pieceWidth, pieceDepth, pieceHeight, pieceElevation, pieceMovable,
                pieceModelRotation, pieceCreator, pieceResizable, pieceDeformable, piece.isTexturable(),
                piecePrice, pieceValueAddedTaxPercentage);
          }
View Full Code Here

  /**
   * Removes <code>piece</code> from selected furniture.
   */
  private void deselectPieceOfFurniture(CatalogPieceOfFurniture piece) {
    for (int i = 0; i < this.selectedFurniture.size(); i++) {
      CatalogPieceOfFurniture selectedPiece = this.selectedFurniture.get(i);
      if (piece == selectedPiece) {
        List<CatalogPieceOfFurniture> selectedItems =
            new ArrayList<CatalogPieceOfFurniture>(getSelectedFurniture());
        selectedItems.remove(i);
        setSelectedFurniture(selectedItems);
View Full Code Here

          ImportFurnitureTaskView importFurnitureView = (ImportFurnitureTaskView)threadedTaskController.getView();
          for (int i = 0; i < furnitureNames.length; i++) {
            String furnitureName = furnitureNames [i];
            try {
              importFurnitureView.setProgress(i, 0, furnitureNames.length);
              final CatalogPieceOfFurniture piece = importFurnitureView.readPieceOfFurniture(
                  contentManager.getContent(furnitureName));
              if (piece != null) {
                importFurnitureView.invokeLater(new Runnable() {
                  public void run() {
                    furnitureLibrary.addPieceOfFurniture(piece);
View Full Code Here

      key += "#" + modelName;
    } else {
      key = null;
    }
    modelName = Character.toUpperCase(modelName.charAt(0)) + modelName.substring(1);
    CatalogPieceOfFurniture piece = new CatalogPieceOfFurniture(key,
        modelName, null, iconContent, null, modelContent,
        size.x, size.z, size.y, 0f, true, null, this.preferences.getDefaultCreator(), true, null, null);
    FurnitureCategory defaultCategory = new FurnitureCategory(
        this.preferences.getLocalizedString(ImportFurnitureTaskPanel.class, "defaultCategory"));
    new FurnitureCatalog() { }.add(defaultCategory , piece);
View Full Code Here

TOP

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

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.