Skip to Content
avatar image
Former Member

Change look of Time Type

Hi Guru's!

I have a question regarding the type Time.

I have a table in my application which is bound to a ModelNode (rfc)

the Time Attribute is bound to my table editor of type (TextView), and the representation is: hh:mm:ss fx(12:00:00).

Is it possible to remove the seconds in an easy way?

Help is apreciated.

Br

Ronni

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Mar 28, 2007 at 10:24 AM

    Ronni,

    For value node try add the following to wdDoInit of controller where attribute defined (i.e. if it's defined in component controller and mapped in view controller then place code to component controller; if it's defined in view -- then in view controller):

    final ISimpleTypeModifiable mtype = wdConext
      .node<YourNode>
        .getNodeInfo()
          .getAttribute("YourTimeAttr")
            .getModifiableSimpleType();
    mtype.setFormat("HH:mm");
    

    Unfortunately, this doesn't work for model attributes. As a workaround:

    1. Create 1..1 non-singleton value sub-node, selection 1..1, initializeLeadSelection=true

    2. Add attribute TimeFormatted of type time, mark this attribute as calculated

    3. In generated getter/setter just return/apply value from/to corresponding attribute of parent element:

    <getter> --

    return (Time)element.node().parentElement().getAttribute("YourTimeAttr");

    <setter> --

    element.node().parentElement().setAttribute("YourTimeAttr", value);

    4. Apply format to calculated attribute (as described in the beginning of this post.

    5. Bind TextView in table to calculated attribute.

    Valery Silaev

    SaM Solutions

    http://www.sam-solutions.net

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Valery!

      it is a model node, so i will try you solution with the 1:1 node.

      Thanks for your quick reply!

      Best regards

      Ronni Hostrup