In this section: |
You can apply custom cascading style sheet (CSS) properties and JavaScript code to a page, allowing you to significantly enhance the page with countless styling options and run-time behaviors using code that you write yourself. CSS makes it easy to style different elements on a page by applying various styling properties to them, while JavaScript is a robust programming language that you can use to customize a page with dynamic and interactive features not normally available in WebFOCUS Designer.
This feature is intended for content developers with CSS and JavaScript coding experience. The CSS and JavaScript options are available to developers, administrators, and users with text editor access.
You can add custom CSS and JavaScript to a page by typing code into the CSS and Javascript text editors, respectively. To access the CSS or JavaScript text editor, click Outline on the sidebar, and then select CSS or JavaScript. The text editor opens over the canvas, and you can type your code into it, as shown in the following image.
The code that you write can reference classes that you assign to different components on the page by selecting them and assigning a class name, using the Classes property on the Format tab.
To return to the canvas, click the close icon in the corner of the page.
When you use the text editor, the WebFOCUS Designer toolbar provides additional options to copy, cut, paste, and find and replace your text. The text editor also includes built-in features such as syntax highlighting, code folding, line numbering, autocomplete, alerts, indent guides, and a status bar. These features facilitate CSS and JavaScript code development and debugging by improving clarity and navigability in the text editor.
Note: Custom CSS and JavaScript is not displayed in the canvas. You must run the visualization to see the results of your custom code.
How to: |
Cascading style sheets, or CSS, is a commonly used language that allows you to style different components on a page. CSS properties include font style, text color, background color, and much more. Custom CSS can be applied to specific objects on a page by specifying a CSS class for the object, and then using a class selector in your CSS code.
To specify a CSS class for an object on a page, select the object and, on the Properties panel, type a class name into the text box for the Classes property. You can specify multiple classes for an object by separating the class names with spaces, and you are encouraged to use the same class names for multiple items on the page. When you assign attributes to a class in the CSS tab, they will affect all elements on the page that are assigned to that class.
You can change the background color of a panel by assigning a class to the panel and then adding the background-color attribute to the class using CSS.
WebFOCUS Designer opens in a new browser tab.
Once you select a data source, WebFOCUS Designer loads with options to create a single content item.
The CSS text editor opens.
Type a period (.) followed immediately by the class name, then an opening curly bracket ({), and press the Enter key.
The closing bracket is added automatically.
For example, to make the color of a panel, for which panelclass is the value of the Classes property, to a bright blue, you could use the following CSS declaration.
.panelclass { background-color: rgb(0,180,240); }
The custom CSS is applied to the specified container.
In this section: |
How to: |
You can use custom JavaScript to enhance the functionality of components on a page. Any component created on the page using the WebFOCUS Designer canvas can be modified in the JavaScript text editor by referencing a CSS class name specified in the Classes field of the Properties panel for the object, or using the WebFOCUS Designer JavaScript API, to standardized classes that correspond to different component types in a page or portal. Each component class can utilize a set of predefined methods in addition to custom JavaScript. You can even use JavaScript to add objects to a page entirely through code, without using the canvas at all.
You can use custom JavaScript code to add a button and a menu item to a panel that you have added to a page. You can configure the button and menu item to execute a command of your choice, such as a URL call.
For information about different JavaScript object classes, see the ibi WebFOCUS Designer JavaScript API Classes reference information below.
WebFOCUS Designer opens in a new browser tab.
Once you select a data source, WebFOCUS Designer loads with options to create a single content item.
The JavaScript text editor opens.
window.addEventListener("iba_pageloaded", function (e){ });
The code to add a button and menu item will go within this event listener command.
var panel = document.querySelector(".class").ibaObject;
where:
Is the name of the variable that you define to represent the panel.
Is the name you previously typed in the Classes property for the panel on the page.
var button = panel.addButton( {"glyphClasses": "fa fa-home", "class": "buttonClass", "tooltip": "tooltip text"}, ".pd-container-title-button-resize", true);
where:
Is the name of the variable that you define to represent the button.
Is the variable representing the panel, defined in step 10a.
Is a glyph class for a Font Awesome icon that looks like a house.
Is a CSS class assigned to the button itself. You can use this to apply CSS styling to the button, or reference the button elsewhere in your JavaScript code.
Is the text that you want to appear in the tooltip when you point to the button.
Is the class of the resize button on the panel. This is the sibling of the button you are currently adding.
When the value of the before property is set to true, the button is placed before the sibling. Otherwise, it is placed after the sibling. If no sibling is specified, it is ordered last.
button.addEventListener("click", function(){ window.open("https://www.tibco.com/"); });
where:
var menu = panel.addMenuItem({ "text": "Menu text", "glyphClasses": "fa fa-globe","class": "menu-class"}, ".class>.ibx_menu_item", true);
where:
Is a variable name that you want to use to represent the menu item.
Is the text of the menu item.
Is a CSS class assigned to the menu item itself. You can use this to apply CSS styling to the menu item, or reference the menu item elsewhere in your JavaScript code.
Is a selector for the Refresh button in the panel menu, where class is the CSS class assigned to the panel using the Classes property.
When the value of the before property is set to true, the menu item is placed before the sibling, which in this case is the Refresh option. Otherwise, it is placed after the sibling. If no sibling is specified, it is ordered last in the menu.
menu.addEventListener("click", function(){ window.open( "http://localhost:8080/ibi_apps/run.bip?BIP_REQUEST_TYPE=BIP_LAUNCH&BIP_folder=IBFS%253A%252FWFC%252FRepository%252FPublic%252F2019%252FHTML%252F&BIP_item=html_page.htm" ); });
where:
The complete custom JavaScript may resemble the following.
window.addEventListener("iba_pageloaded", function (e){ var panel = document.querySelector(".map-panel").ibaObject; var tibcosite = panel.addButton({ "glyphClasses": "fa fa-home", "class": "tibcoButton", "tooltip": "Click to display help."}, ".pd-container-title-button-resize", true); tibcosite.addEventListener("click", function(){ window.open("https://www.tibco.com/");}); var runReport = panel.addMenuItem({ "text": "Country Report", "glyphClasses": "fa fa-globe","class": "globemenu"}, ".map-panel>.ibx_menu_item", true); runReport.addEventListener("click", function(){ window.open( "http://localhost:8080/ibi_apps/run.bip?BIP_REQUEST_TYPE=BIP_LAUNCH&BIP_folder=IBFS%253A%252FWFC%252FRepository%252FPublic%252F2019%252FHTML%252F&BIP_item=Basic_2_ctrl_page.htm"); }); });
Changes made using custom CSS and JavaScript do not appear on the canvas at design time. To see the impact of your custom code, you must run the visualization.
The visualization opens in a new browser tab or window, and the customized button and menu item are available. When clicked, they open the links you specified for them in a new tab or window.
Since the panels in a responsive page resize to fit the browser window, images added to the page may not always fit properly. If the image is too big, only part of the image may show in the panel, and scrollbars may be added. If the image is too small, the panel background may show around the image.
In order to autosize an image to fit a panel, you can use jQuery to set the height and width CSS properties for an image in a specified container. You can specify the container by referencing its class, which you can set using the Classes property on the Settings tab.
An example of the final JavaScript code is shown below:
$('.class').closest('.grid-stack-item').addClass('autoheight'); $('.class iframe').attr('scrolling','no').on('load', function(e){ $(this).contents().find('img').height('100%'); $(this).contents().find('img').width('100%'); })
where:
Is a class assigned to the panel that contains the image to be autosized.
Disables the generation of scrollbars in the container.
Sets the image to fill the height and width of the container. This may distort the image, depending on the dimensions of the container. As an alternative, replace 100% with auto for either the height or width, to maintain the height-to-width ratio at all sizes. Using auto may reveal the panel background or cut off part of the image, depending on the dimensions of the container.
WebFOCUS Designer opens to assemble a page from existing content.
The image is added to a container on the page. The size of the image in the container is the absolute size of the uploaded image file.
The JavaScript text editor opens.
$('.class').closest('.grid-stack-item').addClass('autoheight'); $('.class iframe').attr('scrolling','no').on('load', function(e){ $(this).contents().find('img').height('100%'); $(this).contents().find('img').width('100%'); })
The image still displays at its original size. The height and width properties are only applied when the page is run.
The image stretches to fill the entire container at run time.
In this section: |
A help plug-in with information about each class is packaged with your WebFOCUS installation. It is available through a URL at the following address:
http[s]://hostname:port/context/web_resource/doc/automation/index.html
where:
Is the name of the machine on which the WebFOCUS Client is installed.
Is the port number on which the server is listening.
new ibaObject(element)
Is the base automation object. Automation objects are created internally by the system. You never directly instantiate an automation object.
where:
Available methods include the following:
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, the DOM node that is being automated by this object.
new ibaPage(element)
Is the page automation object. Automation objects are created internally by the system. You never directly instantiate an automation object. The event iba_pageloading will be triggered on the global window object. event.data will be the ibaPage object.
where:
The following triggers can be used with the page object:
These are used in the following JavaScript syntax example:
window.addEventListener("iba_pageloading", function (e){ var page = e.data; page.element().addEventListener("iba_pageloaded", function(e){ var page = e.data; }); page.element().addEventListener("iba_beforecontentdescribe", function (e){ var describeInfo = e.data; var path = describeInfo.path; // The path to the content being described // e.preventDefault() will stop the describe from happening }); page.element().addEventListener("iba_contentdescribed", function (e){ var describeInfo = e.data; var path = describeInfo.path; // The path to the content being described var wfDescribe = describeInfo.wfDescribe; // The filtering information of the content being described }); page.element().addEventListener("iba_beforecontentload", function (e){ var loadInfo = e.data; var path = loadInfo.path; // The path to the content being described var defaultValues = loadInfo.defaultValues; // If default values are used to run the content // e.preventDefault() will stop the page from retrieving the content }); });
If you add multiple pages with custom JavaScript to the same portal, the iba_pageloading event listener, for the global window object, will execute whenever any page in the portal loads. To execute your code only when a specific page loads, remove the event listener after the code executes for the desired page using the window.removeEventListener method.
The iba_pageloading event listener can be used to access the page being loaded, since it receives a page object as a parameter. The page object can be stored or used to assign additional event handlers to the page as shown below:
function onPageLoading(e) { var page = e.data; page.element().addEventListener("iba_pageloaded", function(e){ on load code }); page.element().addEventListener("click", function(e) { on click code }); window.removeEventListener("iba_pageloading", onPageLoading); }
where:
Is an iba_pageloading event listener function.
Accesses the page object via the event parameter.
Code to be executed when the page loads.
Code to be executed when the page is clicked.
Removes the iba_pageloading listener.
You can use the context member object to supply the context information for the page.
Available methods include the following:
Returns an element, adding a button to the title bar of the page.
where:
Object.
One or more button options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add button before or after the specified sibling.
Returns an element, adding a section to the page.
where:
Object.
One or more section options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add the section before or after the specified sibling.
Returns the page title bar buttons as an array.
where:
Selector, element, or jQuery.
Is the buttons selector. All is the default.
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Returns the page containers as an array.
where:
Selector, element, or jQuery.
Is the containers selector. All is the default.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, the DOM node that is being automated by this object.
Use to redescribe the existing content and recreate filter panels.
Removes one or more buttons from the title bar of the page.
where:
Removes one or more sections from the page.
where:
Returns the page sections as an array.
where:
Selector, element, or jQuery.
Is the section selector. All is the default.
Sets the title of the page. If title is not passed, the title of the container is returned as a string or jQuery.
where:
The ibaSection class extends ibaObject.
new ibaSection(element)
Is the page section automation object. Automation objects are created internally by the system. You never directly instantiate an automation object.
where:
Available methods include the following:
Adds a new container to the section.
where:
String.
Is one of the following container types:
String.
Is the container title.
Integer.
Optional. The column of the section to insert to. By default, the container is added to the first available column.
Integer.
Optional. The row of the section to insert to. By default, the container is added to the first available row.
Integer.
Optional. The width of the container in columns. 3 is the default.
Integer.
Optional. The height of the container in rows. 5 is the default.
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Makes the section collapsed, or returns the current collapsed state or a chainable automation object.
where:
Boolean.
Optional. If true, collapse the section. Otherwise, expand.
Makes the section collapsible, or returns the current collapsible state or a chainable automation object.
where:
Boolean.
Optional. If true, make the section collapsible.
Returns the containers in the section as an array.
where:
Selector, element, or jQuery.
An optional containers selector. All is the default.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, the DOM node that is being automated by this object.
new ibaContainer(element)
Is the container automation object. Automation objects are created internally by the system. You never directly instantiate an automation object.
where:
Available methods include the following:
Returns an element, adding a button to the title bar of the container.
where:
Object.
One or more button options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add button before or after the specified sibling.
Returns elements. Adds new content by replacing the content in the current content panel or adding a sub-panel.
where:
String.
Path of the content being added.
String.
Description of the content being added.
Boolean.
Optional. When true, replace the existing content. When false, which is the default, add new content.
Returns an element, adding a menu item to the container menu.
where:
Object.
One or more menu item options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add the menu item before or after the specified sibling.
Returns an element, adding a separator to the container menu.
where:
Object.
Menu separator options. You can use the class property to specify additional CSS classes.
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add menu separator before or after the specified sibling.
Returns the container title bar buttons as an array.
where:
Selector, element, or jQuery.
Is the buttons selector. All is the default.
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Returns the content panels in the container as an array.
where:
Selector, element, or jQuery.
Is the content selector. All is the default.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, the DOM node that is being automated by this object.
Removes one or more buttons from the title bar of the container.
where:
Removes content from the container.
where:
Removes one or more menu items from the container menu.
where:
Removes one or more separators from the container.
where:
Sets the title of the container. If title is not passed, the title of the container is returned as a string or jQuery.
where:
The ibaAccordionContainer class extends ibaContainer.
new ibaAccordionContainer(element)
Is the accordion container automation object. Automation objects are created internally by the system. You never directly instantiate an automation object.
where:
Available methods include the following:
Returns an element, adding a button to the title bar of the accordion container.
where:
Object.
One or more button options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add button before or after the specified sibling.
Returns elements. Adds new content by replacing the content in the current content panel or adding a new accordion tab.
where:
String.
Path of the content being added.
String.
Description of the content being added.
Boolean.
Optional. When true, replace the existing content. When false, which is the default, add new content.
Returns an element, adding a menu item to the accordion container menu.
where:
Object.
One or more menu item options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add the menu item before or after the specified sibling.
Returns an element, adding a separator to the accordion container menu.
where:
Object.
Menu separator options. You can use the class property to specify additional CSS classes.
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add menu separator before or after the specified sibling.
Returns the container title bar buttons as an array.
where:
Selector, element, or jQuery.
Is the buttons selector. All is the default.
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Returns the content panels in the container as an array.
where:
Selector, element, or jQuery.
Is the content selector. All is the default.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, the DOM node that is being automated by this object.
Removes one or more buttons from the title bar of the container.
where:
Removes content from the container.
where:
Removes one or more menu items from the container menu.
where:
Removes one or more separators from the container.
where:
Returns an element. Selects a content pane in the accordion container.
where:
Sets the title of the container. If title is not passed, the title of the container is returned as a string or jQuery.
where:
The ibaCarouselContainer class extends ibaContainer.
new ibaCarouselContainer(element)
Is the carousel container automation object. Automation objects are created internally by the system. You never directly instantiate an automation object.
where:
Available methods include the following:
Returns an element, adding a button to the title bar of the carousel container.
where:
Object.
One or more button options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add button before or after the specified sibling.
Returns elements. Adds new content by replacing the content in the current content panel or adding a new carousel slide.
where:
String.
Path of the content being added.
String.
Description of the content being added.
Boolean.
Optional. When true, replace the existing content. When false, which is the default, add new content.
Returns an element, adding a menu item to the carousel container menu.
where:
Object.
One or more menu item options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add the menu item before or after the specified sibling.
Returns an element, adding a separator to the carousel container menu.
where:
Object.
Menu separator options. You can use the class property to specify additional CSS classes.
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add menu separator before or after the specified sibling.
Returns the container title bar buttons as an array.
where:
Selector, element, or jQuery.
Is the buttons selector. All is the default.
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Returns the content panels in the container as an array.
where:
Selector, element, or jQuery.
Is the content selector. All is the default.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, the DOM node that is being automated by this object.
Removes one or more buttons from the title bar of the container.
where:
Removes content from the container.
where:
Removes one or more menu items from the container menu.
where:
Removes one or more separators from the container.
where:
Returns an element. Selects a content pane in the carousel container.
where:
Sets the title of the container. If title is not passed, the title of the container is returned as a string or jQuery.
where:
The ibaPanelContainer class extends ibaContainer.
new ibaPanelContainer(element)
Is the panel container automation object. Automation objects are created internally by the system. You never directly instantiate an automation object.
where:
Available methods include the following:
Returns an element, adding a button to the title bar of the panel container.
where:
Object.
One or more button options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add button before or after the specified sibling.
Returns elements. Adds new content by replacing the content in the current content panel or adding a new panel.
where:
String.
Path of the content being added.
String.
Description of the content being added.
Boolean.
Optional. When true, replace the existing content. When false, which is the default, add new content.
Returns an element, adding a menu item to the container menu.
where:
Object.
One or more menu item options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add the menu item before or after the specified sibling.
Returns an element, adding a separator to the container menu.
where:
Object.
Menu separator options. You can use the class property to specify additional CSS classes.
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add menu separator before or after the specified sibling.
Returns the container title bar buttons as an array.
where:
Selector, element, or jQuery.
Is the buttons selector. All is the default.
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Returns the content panels in the container as an array.
where:
Selector, element, or jQuery.
Is the content selector. All is the default.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, the DOM node that is being automated by this object.
Removes one or more buttons from the title bar of the container.
where:
Removes content from the container.
where:
Removes one or more menu items from the container menu.
where:
Removes one or more separators from the container.
where:
Sets the title of the container. If title is not passed, the title of the container is returned as a string or jQuery.
where:
The ibaTabContainer class extends ibaContainer.
new ibaTabContainer(element)
Is the carousel container automation object. Automation objects are created internally by the system. You never directly instantiate an automation object.
where:
Available methods include the following:
Returns an element, adding a button to the title bar of the tab container.
where:
Object.
One or more button options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add button before or after the specified sibling.
Returns elements. Adds new content by replacing the content in the current content panel or adding a new tab.
where:
String.
Path of the content being added.
String.
Description of the content being added.
Boolean.
Optional. When true, replace the existing content. When false, which is the default, add new content.
Returns an element, adding a menu item to the tab container menu.
where:
Object.
One or more menu item options, which can include the following:
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add the menu item before or after the specified sibling.
Returns an element, adding a separator to the tab container menu.
where:
Object.
Menu separator options. You can use the class property to specify additional CSS classes.
Selector, element, or jQuery.
Optional. A sibling to add before or after. The default is Last.
Boolean.
Add menu separator before or after the specified sibling.
Returns the container title bar buttons as an array.
where:
Selector, element, or jQuery.
Is the buttons selector. All is the default.
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Returns the content panels in the container as an array.
where:
Selector, element, or jQuery.
Is the content selector. All is the default.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, the DOM node that is being automated by this object.
Removes one or more buttons from the title bar of the container.
where:
Removes content from the container.
where:
Removes one or more menu items from the container menu.
where:
Removes one or more separators from the container.
where:
Returns an element. Selects a content pane in the tab container.
where:
Sets the title of the container. If title is not passed, the title of the container is returned as a string or jQuery.
where:
The ibaContent class extends ibaObject.
new ibaContent(element)
Is the content panel automation object. Automation objects are created internally by the system. You never directly instantiate an automation object.
where:
Available methods include the following:
Returns a string, which is the unique, automatically generated class ID of the object being automated. It can be used to filter enumerations.
Returns a string. Sets or gets custom classes.
where:
String.
Optional. A space-separated list of classes to be added or removed.
Boolean.
Optional. If true, remove the classes specified in classes, otherwise add them.
Returns an element, which is the DOM node that is being automated by this object.
Returns the path of the content as a string.