Maixmo custom control, maximo add control attributes, maximo decimal formatting display

Source: Internet
Author: User

The file path of the Maximo 7 control is improved to 6 and the files are put together in a centralized manner.

JSP file location:

Maximo \ applications \ Maximo \ maximouiweb \ webmodule \ WebClient \ Components \

XML file location:

Maximo \ applications \ Maximo \ properties \


Today, the customer raised a nasty demand to change the practical form of small and medium numbers in Maximo. (The following uses the number field as an example)

The default value of Maximo is: the number of decimal places displayed on the page is the length of the number of digits in the database. (For example, if the number of decimal places in the database is 4, the actual number of decimal places on the page is 4 decimal places, 1.0000, 0.1200 ).

The customer thought: if the database contains a few decimal places, the page displays a few decimal places. (For example, 1.2300 is displayed on the database 1.23/Page and 2 is displayed on the database 2.0000/page ).

One way is to modify the underlying things of Maximo. The second method is to add a virtual location for the field to be realistic.

Because you only need to change the number of tables to display, use the second method:


1. Add a virtual field to the table. The data type is: A1.

2. Bind the field class to format the data display format. (I won't bother formatting the field class. I can use decimalformat .)

Each time the page is initialized, the data is formatted and displayed.

At this point, two problems need to be pointed out:

A. The text in maximo is left aligned and needs to be modified.

B. fields not displayed on the maixmo page. During page initialization, The init Method for modifying fields is not run.


Solve B. assign a value to the virtual field during datebean initialization.

To solve a problem, you need to modify the maixmo control. My method is to add an attribute to the textbox Control. Text Box on its way, we should modify the jsp file textbox. jsp and xml file component-registry.xml and control-registry.xml.

Modify textbox. jsp as follows:

String input4align = "";if (!"".equals(component.getProperty("input4align"))){if("right".equals(component.getProperty("input4align"))){input4align = "text-align: right";}if("left".equals(component.getProperty("input4align"))){input4align = "text-align: left";}}

Modify the following style = "<% = input4align % >;< % = numericStyle % >;< % = width %>.

The component-registry.xml only needs to add a custom attribute to the component of <component-descriptor name = "textbox:

<Property name = "input4align"/>

The control-registry.xml needs to add a custom property in the <control-descriptor name = "textbox"> control:
<Property name = "input4align"/> and input4align = "@ {input4align}" (we obtained it using component. getProperty in textbox. jsp ).

OK, it is done. By the way, we need to manually specify the text method in our application, just add: input4align = "right" in the label, so that we can.

In fact, this is just a simple modification. I hope you will give more valuable comments.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.