Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to get flex Text element to wrap content in custom view stylesheet?

To all the Nakisa gurus (and wannabes:) out there:

Who knows how you're meant to get the flex <Text> element to wrap its contents instead of adding the ellipses (...) when the content width exceeds the width of the element or bounding container? No matter what I do it always just adds the ellipses and never ever wraps!

Because none of the Nakisa delivered templates (in Templates_Deployed) specify a namespace for the flex tags it is unclear which Adobe Flex specification applies and an exhaustive amount of trial and error have so far failed to deliver the desired outcome.

A number of posts elsewhere seem to indicate that this is a somewhat problematic behaviour in Flex which may be governed by the presence or absence of width and height specifiers all the up the bounding container tree to the Application level, but seeing as one only configures the inside of the rounded-rect box in the Templates_Deployed stylesheet it is unclear what may or may not be happening upwards...

From the Adobe Flex 3 Help page for the Text control it appears that to get contents to wrap you simply need to expressly define the pixel width and the contents should automatically wrap, but in my tests this no workee....

I have the following (pretty straightforward) XSL template "flex-display" code:

  <xsl:template name="flex-display">

    <VBox height="50" style="vertical-gap:0;padding-top:5;{$styleBackgroundFlex}"  width="{$contentwidthWithoutPx}">

      <Text style="{$fontStyleFlex};" type="label" width="{$contentwidth}">

        <xsl:value-of select="$OrgUnitName"/>

      </Text>

      <Text style="{$fontStyleManagerFlex};" type="label" width="{$contentwidth}">

        <xsl:value-of select="$managerNameForLevel"/>

      </Text>

    </VBox>

  </xsl:template>

Note: the {$fontStyleFlex} and {$fontStyleManagerFlex} variables only specifies font-size, font-weight, font-style and color styles, nothing else.

FYI we're talking about Nakisa OrgChart 4.0 SP1 here, but I don't imagine the issue is particularly release-dependent.

So, over to the brains trust...

Cheers,

Francois.

Tags:
Former Member
Former Member replied

Hi Francois,

Please use <Text type="text">...</Text> instead of <Text type="label"/> this will wrap the text.

Also please make sure that the height of the parent elements allow the height you want to achieve. Meaning that any of the parent elements don't have a height set.

   <HBox style="horizontal-gap:0;padding-top:5;" width="235" >

    <xsl:choose>

     <xsl:when test="string-length($AssistantFlag) &gt; 0">

      <Text type="text" width="189" height="30" style="font-size:10;font-weight:bold;">

       Currently the name of this orgunit is <xsl:value-of select="$OrgUnitName"/>

      </Text>

      <Spacer width="100%"/>

      <img tooltip="[Lang TBV_Assistant]" title="[Lang TBV_Assistant]" src="images/Template_based_views/assistant.gif" width="9" height="11"/>

     </xsl:when>

     <xsl:otherwise>

      <Text type="text" width="189" height="30" style="font-size:10;font-weight:bold;">

       Currently the name of this orgunit is <xsl:value-of select="$OrgUnitName"/>

      </Text>

     </xsl:otherwise>

    </xsl:choose>

   </HBox>

If the HBox element has height set to, say, 15 then the text element's height will not take effect.

Please also check the height of the Orgchart node. If the collective height of all you elements exceeds the overall height of the view then UI elements from bottom on the view will be truncated.

2 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question