Component level Functions

<< Click to Display Table of Contents >>

Current:  Script > Yonghong Script Object Reference List 

Component level Functions

Previous pageReturn to chapter overviewNext page

Each component contains both generic script functions and specific script functions. The following describes the two script functions in detail.

 

General function

Functions

Instructions

Examples

enabled

Set whether the current component is available

id.enabled = false;

visible

Sets whether the current component is visible

id.visible=false;

interval

Set the current component refresh interval in seconds

id.interval=100000;

x,y,width,height

x, y to determine the starting position, width and height determine the width and height of the region.

id.x=100;

Format

Set the format of the text. See the table below for details.

id.setFormat(loc,DATE_FORMAT);//var loc=new Locator(["sell_date"],CELL,DETAIL);

FormatPattern

Set the format type of the text, such as the display format of the set date MM/dd/yyyy

id.setFormatPattern(loc, "#,##0.##");//var loc = new Locator(["price"], CELL, DETAIL);

Font

Set the font format

var loc=new Locator("price",CELL,HEADER);

var font=new GFont.getDefault();

id.setFont (loc,font);

Foreground

Set the foreground

id.setForeground (loc,color);

Background

Set the background color

var loc=new Locator(["product"],CELL,DETAIL);

var color=new Color(0xAAAAAA);

id.setBackground (loc,color);

Borders

Set the border, the type of border see the border type table

var loc=new Locator(["price"],CELL,DETAIL);

Table1.setBorder(loc,THICK_LINE);

BorderColor

Set the border color

id.setBorderColor(loc, color);

//var loc = new Locator("product"],CELL,DETAIL);

//var 

color=newColor(java.awt.Color.red); 

BorderColors

Set the color of each border

id.setBorderColors(loc, color);

//var loc = new Locator("product"],CELL,DETAIL);

var color2 =[color1,color2,color3,color4];

HAlignment

Set the horizontal alignment, see the table below

Table1.setHAlignment(loc,2);

Rotation

Set the rotation angle

id.setRotation(loc,ROTATION_45);

VAlignment

Set vertical alignment

Table1.setVAlignment(loc,8);

Alpha

Set transparency

id.setAlpha(loc,20);

Wrap

Set whether to automatically wrap

Table1.setWrap(loc,true);

ColWidth

Set the width of the cell

Table1.setColWidth(loc,100);

RowHeight

Set cell row height

Table1.setRowHeight(loc,100);

setLinkEnable

Set whether the hyperlink is visible

var loc = new Locator(["STATE"], CELL, DETAIL);

Table1.setLinkEnable(loc,false);

isLinkEnbale

Returns if the hyperlink is visible

var a=Table1.isLinkEnbale(loc);

title

Set the title

id.title = "Yonghong";

showTitle

Whether to display the title

id.showTitle=true;

active

Component is valid

id.active = true;

detailMaxRows

Maximum number of rows when displaying specific data

id.detailMaxRows = 1000;

detailVisibleCols

Display fields when displaying specific data

id.detailVisibleCols = ["marketmysql", "sale_type"];

excelSheetName

The name of the component exported to excel sheet

Table1.excelSheetName = "Yonghong";

exclude

Reject components

id.exclude = true;

removeLinkParam

Remove hyperlink parameters

var loc = new Locator(["product"], CELL, DETAIL);

Table1.removeLinkParam(loc, "market");

setLinkParam

Set hyperlink parameters

var loc = new Locator(["product"], CELL, DETAIL);

Table1.setLinkParam(loc, "marketmysql", "aa");

source

Bind data source

id.binding.source = "test/orders.sqry";

setFitContent

Set cell adaptive size

var loc = new Locator(["product"], CELL, DETAIL);

Table1.setFitContent(loc, true);

isFitContent

Returns whether the cell is adaptively sized

var loc = new Locator(["product"], CELL, DETAIL);

  Table1.isFitContent(loc);

innerParam

Used to pass different parameter values to the same parameter name

id.innerParam[“market”]=”West”;

id.innerParam[“market”]=”South”;

//Market is the parameter, South, West is the value

setLink

 

Set hyperlinks for text, meters, tables, crosstabs, and chart components. The links contain four types of actions: dashboards, data columns, and URLs. There are six operations: Excel, PDF, Word, PNG, CSV, Refresh.

Link to Excel: 

var loc=new Locator([],OBJECT,DETAIL);

Text1.setLink(loc,"action://Excel");

Link to PDF:

var loc = new Locator(["STATE","STATE"],CELL,HEADR);

Pivot1.setLink(loc, "action://PDF ");

Link to Dashboard:

var loc=new Locator([],OBJECT,DETAIL);

 Gauge1.setLink(loc,"db://folder1/aaa");

Link to Column:

var loc = new Locator(["PRODUCT"], CELL, DETAIL);                

 Table1.setLink(loc, "datalink://PRODUCT");

Link to URL: 

var loc = new Locator(["Sum_SALES"],MARK,DETAIL);        

Chart1.setLink(loc,"http://www.yonghongtech.com");

Link

 

Set hyperlinks to image components. There are three types of links: Actions, Dashboards, URLs. There are six operations: Excel, PDF, Word, PNG, CSV, Refresh.

Link to Word:

Image1.link = "action://Word";

Link to Dasboard:

Image1.link = "db://folder1/aaa";

Link to URL:

Image1.link = "http://www.yonghongtech.com";

Span

Set up merged cells

var loc = new Locator(["product"], CELL, DETAIL);

id.setSpan(loc, new Dimension(2, 1));

paged

Set whether the component of the table class is paged. The default value is false, that is, no page is displayed.

Table1.paged=true;//Set paging

countPerPage

The number of rows displayed on each page after paging is set. It is effective only when paged is true. The default value is 25. Valid values are integers greater than or equal to 0.

Table1.paged=true;

Table1.countPerPage=10;

exportDataSheet

Whether display the data sheet in exported excel file.

Table1.exportDataSheet = true;

exportVisible

Set the component's export visibility.

Table1.exportVisible = true;

clearData

Clear component cache data. 

clearData("Table1");

 

Format table

Format type

Corresponding constants

Instructions

NONE_FORMAT

0

Null

DATE_FORMAT

1

Date

DECIMAL_FORMAT

2

Number

CURRENCY_FORMAT

3

Currency

PERCENT_FORMAT

4

Percent

MESSAGE_FORMAT

5

Text

 

Border type table

Border type

Corresponding constants

Instructions

NO_BORDER

Constants.NO_BORDER

Empty

VERY_THIN_LINE

Constants.VERY_THIN_LINE

Finer

THIN_LINE

Constants.THIN_LINE

Thin line

MEDIUM_LINE

Constants.MEDIUM_LINE

medium

THICK_LINE

Constants.THICK_LINE

Thick line

DOT_LINE

Constants.DOT_LINE

Dotted line

DASH_LINE

Constants.DASH_LINE

dotted line

MEDIUM_DASH

Constants.MEDIUM_DASH

Short dashed line

LARGE_DASH

Constants.LARGE_DASH

Long dotted line

DOUBLE_LINE

Constants.DOUBLE_LINE

Double line

 

Alignment

Alignment

Corresponding constants

Instructions

LEFT_ALIGN

0

left

CENTER_ALIGN

1

Horizontally centered

RIGHT_ALIGN

2

Righe

TOP_ALIGN

0

Top

MIDDLE_ALIGN

4

Vertically centered

BOTTOM_ALIGN

8

Bottom

 

Text rotation angle setting

Rotation

Corresponding constants

Instructions

ROTATION_0

0

Rotate 0 degrees counterclockwise

ROTATION_45

1

Rotate 45 degrees counterclockwise

ROTATION_90

2

Rotate 90 degrees counterclockwise

ROTATION_135

3

Rotate 1135 degrees counterclockwise

ROTATION_180

4

Rotate 180 degrees counterclockwise

ROTATION_225

5

Rotate 225 degrees counterclockwise

ROTATION_270

6

Rotate 270 degrees counterclockwise

ROTATION_315

7

Rotate 315 degrees counterclockwise

ROTATION_360

8

Rotate 360 degrees counterclockwise