Cancel
Showing results for 
Search instead for 
Did you mean: 

Item Revision multiple release status icon

Legend
Legend

How can I display more than one release status icon in an item revision if the revision of the element has multiple release statuses?

8 REPLIES

Re: Item Revision multiple release status icon

Legend
Legend

Example:

 

Example.jpg

 

 

Re: Item Revision multiple release status icon

Legend
Legend

посмотри ответ на сапр2000)

Re: Item Revision multiple release status icon

Legend
Legend

Я там то же создал тему, мне нужно не просто поменять иконки статусов, а еще сделать и так, чтобы возле ревизии отображались иконки нескольких назначенных на ревизию статусов. Как просто изменить иконки у статусов под ревизией я то уже знаю. А у ревизии справа, насколько я знаю отображается только иконка последнего назначенного статуса, а мне нужно отобразить иконки двух статусов или больше

Re: Item Revision multiple release status icon

Legend
Legend
да,по умолчанию иконка отображается одна. есть еще один финт через BMIDE чтобы иконки под ревизией тоже менялись(т.к по умолчанию там всегда флажки).Может это поможет,но не факт

Re: Item Revision multiple release status icon

Legend
Legend

Да, про это то же читал, но там насколько я понял, там изменяются сами иконки статусов, в зависимости от их имени, находил тут же на https://community.plm.automation.siemens.com

 

Например:

https://community.plm.automation.siemens.com/t5/Teamcenter-Administrators-Forum/According-to-the-dif...

 

 

Re: Item Revision multiple release status icon

Legend
Legend

We still have no solution for subject, so any ideas are greeting

Re: Item Revision multiple release status icon

Experimenter
Experimenter

Even if it's a bit late, here a possible solution: working in RichClient, one could implement a custom label provider in java.

 

The example shows how to add custom icons based on specific property values.

It also demonstarates a way to set the font for assemblies bold and/or to a custom color .

 

For a start, look at appendTrailingImages, insert code to search for release statuses and add images based on the search results.

 

Hope that helps...

 

com\teamcenter\rac\mycust\ui\labelprovider\TClabelProvider.java

 

package com.teamcenter.rac.mycust.ui.labelprovider;
import com.teamcenter.rac.engelcust.Activator;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.providers.delegates.property.NameTypeLabelProviderDelegate;
import java.util.List;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

public class TCLabelProvider
  extends NameTypeLabelProviderDelegate
{

  private static final String TRANSFERRED = "com/teamcenter/rac/mycust/images/transferred.png";
  private static final String TRANSFERRED_ERROR = "com/teamcenter/rac/mycust/images/transferred_error.png";
  private static final String BLOCKED = "com/teamcenter/rac/mycust/images/_blocked.png";
  private static final String UI_ASSEMBLY_COLOR = "UI_ASSEMBLY_COLOR";
  private static final String UI_ASSEMBLY_BOLD = "UI_ASSEMBLY_BOLD";
  private Image imageTransferred;
  private Image imageTransferredError;
  private Image imageBlocked;
  
  private Font boldFont;
  private Color color;

  @SuppressWarnings("static-access")
public TCLabelProvider()
  {
    try
    {
      this.imageTransferred = Activator.getDefault().getImageDescriptor(TRANSFERRED).createImage();
      this.imageTransferredError = Activator.getDefault().getImageDescriptor(TRANSFERRED_ERROR).createImage();
      this.imageBlocked = Activator.getDefault().getImageDescriptor(BLOCKED).createImage();
    }
    catch (Exception ex) {}
    
    try
    {
      Font localFont = JFaceResources.getDefaultFont();
      FontData[] arrayOfFontData = localFont.getFontData();   
      this.boldFont = new Font(Display.getDefault(), new FontData(arrayOfFontData[0].getName(), arrayOfFontData[0].getHeight(), SWT.BOLD));
      boolean  fontBold = ((TCSession)AIFUtility.getDefaultSession()).getPreferenceService().getLogicalValue(UI_ASSEMBLY_BOLD);
      if (this.boldFont != null) this.boldFont.dispose();	
      this.boldFont = new Font(Display.getDefault(), new FontData(arrayOfFontData[0].getName(), arrayOfFontData[0].getHeight(), (fontBold)?SWT.BOLD:SWT.NORMAL));
    }
    catch (Exception ex) {}
    
    try
    {
      String colorPreference = ((TCSession)AIFUtility.getDefaultSession()).getPreferenceService().getStringValue(UI_ASSEMBLY_COLOR);
      String[] colorValues = colorPreference.split(";");      
      this.color = new Color(Display.getCurrent(), Integer.parseInt(colorValues[0]), Integer.parseInt(colorValues[1]), Integer.parseInt(colorValues[2]));
    }
    catch (Exception ex)
    {
      this.color = new Color(Display.getCurrent(), 255, 0, 0);
    }
  }
  
  protected boolean isPrimaryColumn()
  {
    return true;
  }
  
  public Font getFont(Object paramObject)
  {
    try
    {
      if (hasBomView(paramObject)) {
        return this.boldFont;
      }
    }
    catch (Exception localException) {}
    return super.getFont(paramObject);
  }
  
  public Color getForeground(Object paramObject)
  {
    try
    {
      if (hasBomView(paramObject)) {
        return this.color;
      }
    }
    catch (Exception localException) {}
    return super.getForeground(paramObject);
  }
  
  protected void appendLeadingImages(List<Image> paramList, Object paramObject)
  {
    super.appendLeadingImages(paramList, paramObject);
  }
  
  protected void appendTrailingImages(List<Image> paramList, Object paramObject)
  {
    TCComponent localTCComponent = getTCComponent(paramObject);

    try
    {
      if (localTCComponent.isValidPropertyName("BlockingState"))
      {
        String blStat = localTCComponent.getStringProperty("BlockingState");
        if ((blStat != null) && (!blStat.isEmpty())) paramList.add(this.imageBlocked);
      } 
/*
* search for release status and add icons here ? .... */ } catch (TCException localTCException) {} super.appendTrailingImages(paramList, paramObject); } private boolean hasBomView(Object paramObject) throws Exception { TCComponent localTCComponent = getTCComponent(paramObject); if ((((localTCComponent instanceof TCComponentItemRevision)) && (localTCComponent.getRelatedComponent("structure_revisions") != null)) || ( ((localTCComponent instanceof TCComponentItem)) && (localTCComponent.getRelatedComponent("bom_view_tags") != null))) { return true; } return false; } public boolean isLabelProperty(Object paramObject, String paramString) { return super.isLabelProperty(paramObject, paramString); } public void dispose() { if (this.boldFont != null) this.boldFont.dispose(); if (this.imageTransferred != null) this.imageTransferred.dispose(); if (this.imageTransferredError != null) this.imageTransferredError.dispose(); if (this.imageBlocked != null) this.imageBlocked.dispose(); if (this.color != null) this.color.dispose(); } }

 

Re: Item Revision multiple release status icon

Legend
Legend

Thanks for the answer, the task is no longer relevant. Although I did not manage to return the behavior in Teamcenter 10 as in Teamcenter 8, when the icon around the object and the status icon changed through OverlayIcon, if the status differs from the English localization, then the icon changes only about the object.

In any case, I am grateful for your reply.