Guest
Welcome login
TIBCOmmunity > Blogs
Home   Members Communities

Rich Internet Applications Blog

3 Posts
0

I'm a big fan of the various food network presentations that provide people new to cooking with simple recipes that introduce important concepts. And I also enjoy the way the presenters make elegant meals evolve from basic ingredients found in most kitchens. That got me to thinking about General Interface as the professional kitchen for cooking up tasty web applications and about how the GI Properties Editor is a way to display a collection of available ingredients for each of the on-screen components. I told you that I'm addicted to GI; even a cooking show can't keep me from thinking about it. In this segment, I'll review the various properties that relate to a core component of any GI application: the Block.

 

The official name of the Block component is the "jsx3.gui.Block" and I've picked it as our starter course because many of the other GI components base their characteristics on it through a scheme called inheritance. But inheritance is a topic better covered in another segment. The Properties Editor will change the list of available settings based on what is currently selected in the Builder Component Hierarchy and because I've added a Block to my new page, the Properties Editor starts right off with showing us that the "Object Type" is in fact the "jsx3.gui.Block". Having the object type prominently displayed is really helpful if you are looking at an application created by someone else and you are unfamiliar with how things are organized.

 

Gazing down the Properties Editor rows, the next item is the "ID". This is assigned by the system and is unique for all the items in your project. If you've done any web design without a tool like GI, you might have named one of your html tagged items in a similar fashion. Such as:

<span id="span_1">The Text</span>

 

GI's Integrated Development Environment, GI Builder, is doing the same thing under the hood. It is giving the newly created element an individual identification property so that it can be located without ambiguity.

 

The next property in the list is the new block instance's "Name". This is under your control and can be anything within reason. It can contain spaces and dashes and other characters, but I wouldn't get too wild with the names; just try to name it something that makes sense and follow a theme. My theme is making the first part a lower-case word and then make all the words after it with an initial capital letter and then lower-case, but without spaces. I think this is called Hungarian notation or Camel Case. My names look like "folderBlock" or "upperRightBlock" and are much more informative to me than names like "block" or "label".

Positioning

"Relative XY" is the next item in the property list. It isn't referring to a family member's chromosomes; it is a way to layout items contained within a block. If you choose "Relative", and there are multiple items contained within the block, they get adjusted from the left or top depending on how much space is allotted. Simply, if you have a block that is 300 pixel units by 300 pixel units (300px) as the container block, a.k.a. the parent, and you have 3 blocks within it that are all 100px wide and 100px high and each one's layout is set to "Relative", then you will see all three side-by-side. But should the parent block width be reset to 250px, you will instead see two blocks side-by-side and one all by itself on the next row down.

 

In contrast, if you change the property of each child block to "Absolute" then you'll notice that all three children are right on top of each other and all crowded into the top left of the parent block. To correct this pileup, set the "Left" and "Top" property values to make each one respect its sibling's personal space. The values can either be a percentage of the parent's width, as in 15%, or the value can be a number written in pixel units, such as 100. By setting the first Block with a "top" property of 100 and the "left" property to 100, you'll notice it move to that exact coordinate. The "Z-Index" property will adjust the other two components above or below the other one like a stack of pancakes. The higher the z-index, the higher the component will be positioned in the stack.

 

I find it easier to design forms by using the relative property setting and let the layout flow naturally rather than absolutely positioning the elements. I usually nest the form fields inside a 100% wide parent block that has a 30px height and then position a label with a 30% width and a textbox with a 70% width. I then copy that structure within the same parent and the rows fall below each other nicely. If I move one of the rows to another position in the group, I won't need to recalculate the top and left properties of every component group affected by the change as I would need to do if I used "absolute" positioning.

Block

The next grouping of properties is under the heading of "Block" and contains a frequently used setting called "Text/HTML". This setting allows you to type text into the field for on-screen display. Because displaying text is the bread and butter of most applications, this property field has a few other features worth noting. First, not only can you just display simple text, you can use HTML in the entry and it will be used exactly as you enter it. This enables you to use specialized tags in the application such as java applets or Vector Markup Language (VML) for graphics.

 

Second, GI Builder provides a way to associate a name with text and can store it in a separate file. When you enter the identifying name in the field and touch the TAB key, the Block displays the text from the lookup.

 

The lookup file is called a "Properties Bundle" and is much like a spreadsheet table where the left hand column is for the lookup name and has one or more adjacent columns to resolve the text associated with the name. The first adjacent column, named "Default", holds the text that you want to use if no other columns are present. You can then add other columns based on the short-cut name for browser supported languages; English is "en_EN" and Spanish is "es_ES" to name a few. To create the "Properties Bundle", use the File/New/Properties Bundle menu commands in GI Builder. Make sure to save it and set it to load when the project starts by selecting it in the Project Files palette with a right mouse and picking the "Auto Load" menu option.

 

By using the Properties Bundle file you've now separated the text from residing directly within the Block "Text/HTML" property, but it will still show up just as if you typed it right into the property field. One advantage of using this name/value lookup technique is that if you decide to make changes to the text, you only need to modify the Properties Bundle file rather than visiting each of the "Text/HTML" fields individually; it's a real time saver.

 

Finally, if you want your application to work in Montreal and you need to have all the text in French, just create another resolution field associated with the lookup name and have someone translate the values into the French language. When your application runs, the browser's language setting is inspected and if it matches the resolution column type, voila, Bob est votre Oncle!

 

The other property in this section is the "Tag" field and it sets the HTML tag name when rendering the on-screen markup. I've used this in the past to force a Block to render as a SPAN tag instead of a DIV by just typing the word "span" into the property field.

 

There are more properties to discuss, but I'll leave that for the next segment because I hear my oven timer buzzing in the kitchen. Or is that the smoke detector?

0 Comments Permalink
0

At the Water's Edge

Posted by Vic Patterson Jul 31, 2008

I was sitting on an empty beach last weekend watching the surf roll in, when all of a sudden five guys came to the water's edge right in front of me with skim boards. The youngest was about 10 years old and the oldest was his father. One by one they ran down the beach at full speed and dropped their boards onto the skinny water retreating back to sea and then jumped aboard, sliding along precariously until they flopped into the water. They were really having fun. I thought it looked easy and wanted to give it a try but I didn't know the first thing about how to get started. No sooner had that thought run through my mind, I saw another guy walk up to one of the surfers and ask if he could give it a try.

 

"So I just jump on it, right?" he asked. "Well, yeah, that's pretty much it" the skim board owner replied. I then watched the new guy run three steps, drop his borrowed board onto a thin layer of water, jump on it and then immediately fly over the front of the fully stopped board and tumble over the sand and into the water. He looked up from the frothing surf and said "I guess it's a little harder than it looks...I better quit before I bruise more than my ego." He gave the board back, thanked the guy and then continued his walk on down the beach. I started thinking that if he would have had a better understanding of the basic principles of skim boarding before he got started, it would have helped him tremendously.

 

In order to help you understand how to build Rich Internet Applications with General Interface, I want to open this segment with a few of the basic principles of web page construction and how they apply to GI.

 

The first thing to remember is that our goal is to put marks on the browser display. To do that without GI, we will need to create a page with a few lines of text written with formatting rules used by the browser to interpret our text and display it properly. The screen layout is described to the browser by following the Hypertext Markup Language (HTML) definition. The language is made up of symbols recognized by the browser and enclosed in angled brackets. The combination of angled brackets and keywords is called a "tag" and surrounds the text that we want to format. For instance, to make text bold, just add the "<b>" tag in front of the text element and "</b>" behind it to turn it off.

 

We start the formatting process with the <HTML> tag and close it with the </HTML> tag. We can organize the page by enclosing the content into sections. The main section is the "BODY" and is tagged with that same name.

<HTML>

<BODY></BODY>

</HTML>

 

We can create as many sections as we need inside the BODY and can use a variety of tags to denote the start and end of each section. The <div> tag will divide a logical group in the same way that you would use a paragraph to logically divide text. The <div> and <span> tags have no pre-defined formatting and are strictly there as a parent container for your other elements.

 

The formatting definitions also allow us to group characteristics into a property collection called a "style". By including the style property inside a tag we are instructing the browser to follow a standard definition called the Cascading Style Sheet (CSS). The CSS definition also allows us to position elements on the screen in an "absolute" placement from the top and left sides of the current container. For instance, if we want to place a "block" of text to start 10 pixel units from the top and 12 pixel units from the left we can define it in the style property in the tag that goes with the text.

 

Example:

<div style="position:absolute;top:10px;left:12px;">Hello</div>

 

By using a style "position" property value set to "absolute", the element can be placed anywhere on a page. The tag style can be further enhanced with the size of text, the font weight (bold, italics), color and many other choices. Storing these style properties gives you the ability to call them when needed and can help to unify multiple pages with the same type of formatting.

 

When you use General Interface Builder to create your page you are provided a pre-defined set of styles to format the components that you insert into the page. The style choices are exposed as a list of properties in a panel editor that changes according to the GI component you've selected. Most of the property fields have drop-down choices for you to pick from a set of values. For example, the "text-align" style property has "left", "center" and "right" alignment choices.

 

Builder saves your property choices and then converts them to the HTML tags for the browser to display. To demonstrate, I'll create a simple GI page with the "Block -Absolute" component picked from the Component Libraries palette and drop it into a blank page. A square grey box is displayed on the screen. At the bottom of the design area, a row of icons allows me to see the HTML that will be created at run-time. It shows as:

 

<span id="_jsx_1_5d" label="block" class="jsx30block" style="position:absolute;width:100px;height:100px;left:0px;top:0px;background-c olor:#e8e8f5;overflow:auto;"/>

 

The process of converting the saved property values to HTML tags is just one of the functions GI Builder provides. Builder will also store your favorite property settings by a name that you give it and will lookup values assigned to that name when the page is displayed. This feature is called the "Dynamic Properties File" and has a nickname of JSS in homage to the CSS property idea. So instead of typing "Tahoma" as the font family name in the property editor field, you can use "appFont" as the name you assign to "Tahoma" in the dynamic properties file. When the page is displayed, GI will lookup the "appFont" name in the dynamic properties file and exchange it with the value you've assigned it.

 

Furthermore, each property editor field has a type associated with it and can be part of the dynamic property information. In the "appFont" example, the type of "jsxfontname" can also be assigned to the entry so that a right-mouse context menu can be called from the "Font Name" property editor field to filter all the dynamic property records that are of the same type. The resulting drop-down menu will display them for use along with system defined styles that usually have a "@" symbol as part of the name.

 

The benefit to using dynamic property values becomes clear if you change your mind often. For example, you might have created a text field for data entry and you want to put a label next to it. To make sure that it has a little breathing room between the components, you use the dynamic lookup for the margin property that uses "2px" but later change your mind to make it "4px" instead. All you need to do is change the single JSS entry and all the fields rebuild when they are repainted on the screen.

 

We now know that GI can help insulate us from having to write HTML tags with elaborate style properties to create a Rich Internet Application. And we know that by using the Properties Editor we can make the formatting changes we want use in our application, yet we don't know too much about those properties. In our next discussion, each one of the property elements will be covered so that we will have a better understanding of how to combine them for the exact look we want to achieve.

0 Comments Permalink
0

Introduction

Posted by Vic Patterson Jul 24, 2008

Hello, my name is Vic Patterson and I've been using a Rich Internet Application (RIA) framework sponsored by TIBCO called General Interface (GI) since 2004.

 

That opening sentence sounds a lot like what someone might say at an addiction meeting while standing up for the very first time and maybe it's appropriate, because I just may be addicted to GI. You see, prior to General Interface, I had been building web-based applications with all sorts of tools and techniques but I never really liked using them very much. It was always the end result that I was hoping to achieve and I just suffered through all the hidden input fields and session variables and the constant battle of remembering what was on the current page and what came next. What came next was a great new way of delivering quality applications and it got me hooked.

 

There is a software toolkit for web designers and developers that can reduce the time it takes to create rich and robust applications that runs inside an Integrated Development Environment (IDE). The GI Builder, (that's what it's called), has palettes for you to "drag and drop" pre-built components into an awaiting work area that will allow you to develop the "look and feel" of your application really fast.

 

You can drag in menus and tabs and layout the page a bunch of ways until you get it like you want it. Just drag a component from one of the libraries and go to a property panel to set the details like you want them. Builder, (it's nickname), saves the view and all the settings in a simple format, so that when you open or run your project, all the parts are just like you left them.

 

Another thing I like is that the components that come with Builder already do all the things you would expect them to do. For instance, if you use the Tree component, which looks like the left side of a file system explorer window, the tree elements will expand and fold back when you click on them. And you didn't do anything but drag in the Tree component. Likewise the menus and combo select boxes and all the other components that come with it do the things they need to do with only a few adjustments from the properties palette.

 

If you've built things like this before, you're probably thinking, "So what's the big deal?" Well the hard part is usually hooking them up to live data. Builder has a way to connect to services out there on your network, get the details about what goes into the component, and then updates them on the screen without repainting the entire page. Just the parts that need updating get repainted so your entire application just sits on one page. You don't need to think about page sequences or what data is now in view, you just repaint the parts of the screen that need updating.

 

If you are just getting into GI and don't know too much about it, I hope this series of posts will help you understand it better. My plan is to start off with the absolute beginner in mind and fill in as much of the background as possible before going on to the next subject.

0 Comments Permalink