Joinjs Cell vs Cellview - jointjs

In the documentation of JointJS I have often seen the terms cell and cellview. I know cell is the an Item cell on the graph but what is meant by cellView. I tried to find myself but could not figure it out !!
E.g on this link List of triggered events
following line is written:
cell: pointerdown - triggered when a pointer is pressed on a cell. Takes cellView, evt, x and y as arguments.
what is this cellView here ?

It doesn't show up in the JointJS API docs under CellView, but it's either an instance of joint.dia.ElementView or joint.dia.LinkView. They both extend from `joint.dia.CellView.

A cell is a backbone 'Model' object, and a cellView (linkView, elementView) are backbone 'View' objects. This follows the backbone MVC 'model/view/controller' paradigm.
The model represents data, where the view represents the visual presentation of that data. So in the context of joingjs cells and cellViews, the cell is the data, and the cellView is how that data is rendered in your diagram.

Related

On synchronize Exact Online GL transactions with Invantive Control for Excel error: "You are trying to move cells within a table on the worksheet"

When trying to synchronize my model with Invantive Control for Excel, the following error occurs:
This is the complete error message:
Type: System.Runtime.InteropServices.COMException
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Microsoft.Office.Interop.Excel.Range.Delete(Object Shift)
at Invantive.Producer.Control.Utility.ResizeBlock(ModelCache modelCache, Workbook workbook, List`1 blocks, iea_blocks_v block, Cube currentCube, Cube desiredCube, Point3d startPoint, Int64 growLength) in File169:line 7968
at Invantive.Producer.Control.Utility.AdjustBlockDimensionOneAxis(SystemWorkingContext context, ModelCache modelCache, Workbook workbook, iea_blocks_v currentBlock, Cube currentCube, Cube desiredCube, IEnumerable`1 anchoredBlocksResult, List`1 blocks, Point3d desiredStartPoint, Int64 growLength, iea_blocks_vBlk_repeat_rows_along adjustAxis, iea_blocks_vBlk_repeat_rows_direction adjustDirection) in File169:line 7293
at Invantive.Producer.Control.Utility.AdjustBlockDimensions(SystemWorkingContext context, ModelCache modelCache, Workbook workbook, List`1 blocks, iea_blocks_v currentBlock, Cube currentCube, Cube desiredCube, Point3d desiredStartPoint) in File169:line 6617
at Invantive.Producer.Control.SyncToDatabaseForm.SyncDownload(DoWorkEventArgs e) in File170:line 2173
What are the steps to solving this error?
EDIT
The SQL statement on the block in Invantive Control is:
select division_hid
, division_name
, reportingyear_attr
, years_balance_code_attr
, years_balance_description
, open
from BalanceLines
where years_balance_balancetype_attr = "B"
and reportingyear_attr = $X{eol_year_to}
The $X{eol_year_to} is a referenced to a named range eol_year_to whose value is used in the query.
I have added to the Excel table two columns, one with a vertical search on GL account classification code and one on GL account classification description. After that addition, the model no longer synchronizes with Exact Online.
Invantive Control puts data in an Excel table. I've added formulas to the last two columns of this table. Invantive Control may not shift these formulas since that would break the Excel table.
We've added the formulas to the SQL-code. The problem is solved now.
You can get the GL account classification code and description from Exact Online in one go also, please use something like the following to get a list of all GL transactions plus the classification code/description:
select tln.division division_hid
, sdn.description division_name
, tln.financialyear finyear_number_attr
, tln.financialperiod finperiod_number_attr
, tln.glaccountcode glaccount_code_attr
, tln.glaccountdescription glaccount_description
, tln.journalcode gltransaction_journal_code_attr
, tln.currency gltransaction_journal_currency_code_attr
, tln.amountdc amount_value
, tln.vatpercentage amount_vatpercentage
, tln.description
, tln.accountname account_name
, sysdate nu
, '=I_EOL_GL_ACTCLN_CODE(,$C{E,.,.,^+4,.})' glactclncode
, '=I_EOL_GL_ACTCLN_DESCRIPTION(,$C{E,.,.,^+4,.})' glactclndescription
from transactionlines tln
join systemdivisions sdn
on sdn.code = tln.division
where tln.financialyear >= $X{eol_year_from}
and tln.financialyear <= $X{eol_year_to}
and tln.financialperiod >= $X{eol_month_from}
and tln.financialperiod <= $X{eol_month_to}
order
by tln.division
, tln.financialyear
, tln.glaccountcode
Classifications on Balance
In your query, this would be:
select division_hid
, division_name
, reportingyear_attr
, years_balance_code_attr
, years_balance_description
, open
, '=I_EOL_GL_ACTCLN_CODE(,$C{E,.,.,^+3,.})' glactclncode
, '=I_EOL_GL_ACTCLN_DESCRIPTION(,$C{E,.,.,^+3,.})' glactclndescription
from BalanceLines
where years_balance_balancetype_attr = "B"
and reportingyear_attr = $X{eol_year_to}
Column Expressions
The process is now:
The SQL loads all general ledger transactions of Exact Online for the indicated period into Excel.
Do this by pressing Synchronize.
Then the Excel formulas I_EOL_GL_ACTCLN_CODE and I_EOL_GL_ACTCLN_DESCRIPTION are evaluated.
These formulas take a unique division code (company) plus at least the GL account code. Since the GL account code varies per GL transaction, you want to refer to the contents of a specific column of your query. You can generate a hard-coded formula with the actual GL account code in it.
But it is better to take the GL account code from another cell in Excel.
The $C{...} syntax allows you during synchronization to replace it by a cell reference. Please consult the online manual and the model editor wizard.
The $C{E,.,.,^+4,.} means:
Pivot method: use X/Y orientation is in (E)xcel. You could use D too to take any transposition from database into Excel into account, but is seldom used.
.: current block, like '.' in vi sometimes referring to 'here'.
.: current sheet, like '.' in vi sometimes referring to 'here'.
^+4: column, the left-most cell ('^') of the current Excel row and then four cells to the right.
.: current row
You may also add two more coordinates to the column expression for column 2 and row 2 to indicate a range of cells.

How to identify the class of an Object which is in a cell of webtable

I have a webtable which MIGHT have a weblink object in it's Row 2, Column 1 cell (also Index of this object is 0). If it indeed is a link I would like to click it else ignore it. Is there a way to identify the class of this object given that we know the row and column number.
Below was my initial code. However it doesn't work always when the webtable cell doesn't have a link to click
Set Table = Browser("Oracle PeopleSoft").Page("Request Payment Predictor").WebTable("Run Control ID").ChildItem(2, 1, "Link", 0)
Table.Click
I would like to know if there a way to find the class of the Object (in cell of a web table) so I can click on the Object only if it's a link Or in other words can we use GetRoProperty("Class Name") on a WebTable Cell Object?
The ChildItem function returns a test object of the requested type if it exists, otherwise it returns Nothing.
So your code should look like this:
Set aLink = Browser("Oracle PeopleSoft")_
.Page("Request Payment Predictor")_
.WebTable("Run Control ID").ChildItem(2, 1, "Link", 0)
If Not aLink is Nothing Then
aLink.Click
End If
The object returned by ChildItem is a test object (if it's not Nothing) so you can use the regular test object methods on it.
Please note that the object returned is not a table cell object, it's the object of the type you requested, this type may be WebElement which is considered the base class of all web objects. This means that you can use ChildItem with "WebElement" and then see what actual type it is by getting its micClass (which is what the Class Name is called internally).
Print webElem.GetROProperty("micclass")
Pro tip: The indexes are 1 based, you can use the undocumented Highlight function in order to make sure you're working on the right object (obj.Highlight).

How to style a specific list item in lwuit?

I am need of a requirement that in a list, some of the list item should exhibit different style than others. How can this be achieved in lwuit?
For Example,
List menu = new List();
menu.addItem("1. Green");
menu.addItem("2. Red");
menu.addItem("3. Blue");
In this list Each item should have the style of representing its color(i.e) Green should have green Background and Red should have Red Background. Is it possible in LWUIT? How can we achieve this?
Thanks in Advance.
You must create a cell renderer for this use case. Just derive 'DefaultListCellRenderer' e.g.:
DefaultListCellRenderer rend = new DefaultListCellRenderer() {
public Component getCellRendererComponent(Component list, Object model, Object value, int index, boolean isSelected) {
Component c = super.getCellRendererComponent(...);
c.getStyle().setBgTransparency(255);
c.getStyle().setBgColor(theColorYouWant);
return c;
}
};
Then set this renderer to the list. You will probably need some additional refinements here since this is a WAY oversimplified example of a renderer.
This is one way of doing it.
1. Create a component for each item in the list
2. Add the bg color and text to it.
3. Once done, add it to a form or any other custon component you have created.
Other way:
You can create your own List renderer. Here is some information on how you can do it

disable *some* checkboxes in a column in a GXT Grid

I have a GXT Grid showing some "User" objects. One of the columns holds checkboxes (CheckboxCell) . I need to disable a checkbox for 1 particular user and leave others enabled.
I tried extending CheckboxCell class - it's useless because it does not know the context (which User is renders): it only knows about true/false state.
tried
GridView view = table.getView();
Element cell = view.getCell(0, 1);
cell.setAttribute("disabled", "disabled");
-no luck. the disabled attribute is set on the outer "td" tag instead of the child "input" element.
tried cell.getChild..() methods - they all throw "method does not exist" exceptions.
UPDATE: I ended up creating my own CheckboxCellWhichCanBeDisabled class extending AbstractEditableCell. I'm afraid there's no other way.

Binding an edit box within a custom control to a form field programatically

I have a notes form with a series of fields such as city_1, city_2, city_3 etc.
I have an XPage and on that XPage I have a repeat.
The repeat is based on an array with ten values 1 - 10
var repArray = new Array() ;
for (var i=1;i<=10;i++) {
repArray.push(i) ;
}
return(repArray) ;
Within the repeat I have a custom control which is used to surface the fields city_1 through city_10
The repeat has a custom property docdatasource which is passed in
It also has a string custom property called cityFieldName which is computed using the repeat
collection name so that in the first repeat row it is city_1 and in the second it is city_2 etc..
The editable text field on the custom control is bound using the EL formula
compositeData.docdatasource[compositeData.cityFieldName]
This works fine but each time I add new fields I have to remember to create a new custom property and then a reference to it on the parent page.
I would like to be able to simply compute the data binding such as
compositeData.docdatasource['city_' + indexvar]
where indexvar is a variable representing the current row number.
Is this possible ? I have read that you cannot use '+' in Expression Language.
First: you wouldn't need an array for a counter. Just 10 would do (the number) - repeats 10 times too. But you could build an array of arrays:
var repArray = [];
for (var i=1;i<=10;i++) {
repArray.push(["city","street","zip","country","planet"]) ;
}
return repArray;
then you should be able to use
#{datasource.indexvar[0]}
to bind city,
#{datasource.indexvar[1]}
to bind street. etc.
Carries a little the danger of messing with the sequence of the array, if that's a concern you would need to dig deeper in using an Object here.
compute to javascript and use something like
var viewnam = "#{" + (compositeData.searchVar )+ "}"
return viewnam
make sure this is computed on page load in the custom control
I was never able to do the addition within EL but I have been very successful with simply computing the field names outside the custom control and then passing those values into the custom control.
I can send you some working code if you wish from a presentation I gave.

Resources