Quantcast
Channel: SmartClient Forums
Viewing all 4756 articles
Browse latest View live

ListGrid.RecordComponents - Issue

$
0
0
hi isomorphic,

the next IE8 bug. (I hate IE :-))...

In IE8 there is a problem with "ShowRecordComponents". If you FILTER and SORT an listgrid the RecordComponents will (on some lines) disappear.

Expected result: every "male" record has a small icon at column MaritalStatus.

If you carry out these steps exactly, you will see the problem.

1) run my testclass.
2) choose employees Datascource
3) insert "full time" into field "Employee Type" inside boundForm and click "fetch"
4) sort listgrid by email (simply click at header)
5) now, important: please scroll using the small arrows in the List Grid down and you will see the problem. (please have a look at my screenshot). Not in each "male" line an image is displayed.

My Testclass:
Code:

package com.smartgwt.sample.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortArrow;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.ImgButton;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VStack;
import com.smartgwt.client.widgets.viewer.DetailViewer;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class BuiltInDS implements EntryPoint {
        private ListGrid boundList;
        private DynamicForm boundForm;
        private IButton saveBtn;
        private DetailViewer boundViewer;
        private IButton newBtn;

        /**
        * This is the entry point method.
        */
        @Override
        public void onModuleLoad() {
                KeyIdentifier debugKey = new KeyIdentifier();
                debugKey.setCtrlKey(true);
                debugKey.setKeyName("D");

                Page.registerKey(debugKey, new PageKeyHandler() {
                        @Override
                        public void execute(String keyName) {
                                SC.showConsole();
                        }
                });


                ListGrid grid = new ListGrid();
                grid.setLeft(20);
                grid.setTop(75);
                grid.setWidth(130);
                grid.setLeaveScrollbarGap(false);
                grid.setShowSortArrow(SortArrow.NONE);
                grid.setCanSort(false);
                grid.setFields(new ListGridField("dsTitle", "Select a DataSource"));
                grid.setData(new ListGridRecord[]{
                                new DSRecord("Animals", "animals"),
                                new DSRecord("Office Supplies", "supplyItem"),
                                new DSRecord("Employees", "employees")}
                                );
                grid.setSelectionType(SelectionStyle.SINGLE);
                grid.addRecordClickHandler(new RecordClickHandler() {
                        @Override
                        public void onRecordClick(RecordClickEvent event) {
                                DSRecord record = (DSRecord) event.getRecord();
                                bindComponents(record.getDsName());
                        }
                });

                grid.draw();

                VStack vStack = new VStack();
                vStack.setLeft(175);
                vStack.setTop(75);
                vStack.setWidth("70%");
                vStack.setMembersMargin(20);

                Label label = new Label();
                label.setContents("<ul>" +
                                "<li>select a datasource from the list at left to bind to these components</li>" +
                                "<li>click a record in the grid to view and edit that record in the form</li>" +
                                "<li>click <b>New</b> to start editing a new record in the form</li>" +
                                "<li>click <b>Save</b> to save changes to a new or edited record in the form</li>" +
                                "<li>click <b>Clear</b> to clear all fields in the form</li>" +
                                "<li>click <b>Filter</b> to filter (substring match) the grid based on form values</li>" +
                                "<li>click <b>Fetch</b> to fetch records (exact match) for the grid based on form values</li>" +
                                "<li>double-click a record in the grid to edit inline (press Return, or arrow/tab to another record, to save)</li>" +
                                "</ul>");
                vStack.addMember(label);

                boundList = new ListGrid(){
                        @Override
                        protected Canvas createRecordComponent(ListGridRecord record, Integer colNum) {

                                String fieldName = this.getFieldName(colNum);
                                if (fieldName.equals("MaritalStatus")) {
                                        String value = record.getAttribute("Gender");
                                        if ("male".equalsIgnoreCase(value)){
                                                HLayout recordCanvas = new HLayout();
                                                recordCanvas.setHeight(14);
                                                recordCanvas.setAlign(Alignment.CENTER);
                                                recordCanvas.setWidth(70);

                                                ImgButton editImg = new ImgButton();
                                                editImg.setShowDown(false);
                                                editImg.setShowRollOver(true);
                                                editImg.setSrc("[SKIN]/headerIcons/comment.png");
                                                editImg.setHoverWidth(150);
                                                editImg.setHeight(14);
                                                editImg.setWidth(16);
                                                editImg.addClickHandler(new ClickHandler() {
                                                        @Override
                                                        public void onClick(ClickEvent event) {
                                                                System.out.println("click!!");
                                                        }
                                                });
                                                recordCanvas.addMember(editImg);
                                                return recordCanvas;

                                        }
                                }
                                //                                return null;
                                return super.createRecordComponent(record, colNum);
                        }
                };
                boundList.setHeight(200);
                boundList.setCanEdit(true);
                boundList.setShowRecordComponents(true);
                boundList.setShowRecordComponentsByCell(true);


                boundList.addRecordClickHandler(new RecordClickHandler() {
                        @Override
                        public void onRecordClick(RecordClickEvent event) {
                                Record record = event.getRecord();
                                boundForm.editRecord(record);
                                saveBtn.enable();
                                boundViewer.viewSelectedData(boundList);
                        }
                });
                vStack.addMember(boundList);

                boundForm = new DynamicForm();
                boundForm.setNumCols(6);
                boundForm.setAutoFocus(false);

                vStack.addMember(boundForm);

                HLayout hLayout = new HLayout(10);
                hLayout.setMembersMargin(10);
                hLayout.setHeight(22);

                saveBtn = new IButton("Save");
                saveBtn.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                boundForm.saveData();
                                if (!boundForm.hasErrors()) {
                                        boundForm.clearValues();
                                        saveBtn.disable();
                                }
                        }
                });
                hLayout.addMember(saveBtn);

                newBtn = new IButton("New");
                newBtn.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                boundForm.editNewRecord();
                                saveBtn.enable();
                        }
                });
                hLayout.addMember(newBtn);

                IButton clearBtn = new IButton("Clear");
                clearBtn.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                boundForm.clearValues();
                                saveBtn.disable();
                        }
                });
                hLayout.addMember(clearBtn);

                IButton filterBtn = new IButton("Filter");
                filterBtn.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                boundList.filterData(boundForm.getValuesAsCriteria());
                                saveBtn.disable();
                        }
                });
                hLayout.addMember(filterBtn);

                IButton fetchBtn = new IButton("Fetch");
                fetchBtn.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                boundList.fetchData(boundForm.getValuesAsCriteria());
                                saveBtn.disable();
                        }
                });
                hLayout.addMember(fetchBtn);

                vStack.addMember(hLayout);


                boundViewer = new DetailViewer();
                vStack.addMember(boundViewer);

                vStack.draw();

        }

        private void bindComponents(String dsName) {
                DataSource ds = DataSource.get(dsName);
                boundList.setDataSource(ds);
                boundViewer.setDataSource(ds);
                boundForm.setDataSource(ds);
                boundList.fetchData();
                newBtn.enable();
                saveBtn.disable();
        }
}

best regards,
mirko

i used:
- Isomorphic SmartClient/SmartGWT Framework (v9.1p_2014-03-18/PowerEdition Deployment 2014-03-18)
- Internet Explorer 8

Attached Images
File Type: png RecordComponents.PNG (24.7 KB)

com.smartgwt.client.widgets.layout.Layout.getMembe rs() throws an exception

$
0
0
sgwt: 4.1p.0.0
sc: v9.1p_2014-03-06
ff:26.0
Code:

@Override
public void onModuleLoad() {
        new VLayout(){{
                addMember(new ToolStrip(){{
                        final ToolStrip toolStrip = this;
                        addButton(new ToolStripButton("E"){{
                                addClickHandler(new ClickHandler() {
                                        @Override
                                        public void onClick(ClickEvent event) {
                                                for(Canvas canvas : toolStrip.getMembers()){
                                                        //do something
                                                }
                                        }
                                });
                        }});
                }});
        }}.show();
}

Error:
Code:


Caused by: java.lang.AssertionError: null
    at com.smartgwt.client.widgets.Button.getOrCreateRef(Button.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.smartgwt.client.util.ObjectFactory.createCanvas(ObjectFactory.java)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.smartgwt.client.widgets.Canvas.getByJSObject(Canvas.java)
    at com.smartgwt.client.util.ConvertTo.arrayOfCanvas(ConvertTo.java:3312)
    at com.smartgwt.client.widgets.layout.Layout.getMembers(Layout.java:702)
    at web.gwt.client.Main3$1$1$1$1.onClick(Main3.java:22)

Reg:ListGrid.editFailed() and ListGrid.editComplete() methods are not called always

$
0
0
Hi,

As per the documentation, editFailed() will be called when there is an error while trying to save a row. And editComplete() will be called when the row has saved successfully. But both are not calling properly. But both the methods are calling sometimes. Please find the below scenarios:

1) editComplete() is not called: when there is an error in a row and try to resolve the error. And it is called if we save a row without any errors for the first time.

2) editFailed() is not called when there is a server Custom validation. And it is called for other validations.

We are using the autoSaveEdits:true for the ListGrid and also ListGrid.endEditing() for saving.

We are using the below version of SmartClient:

Isomorphic SmartClient/SmartGWT Framework (v9.0p_2014-01-14/PowerEdition Deployment 2014-01-14)

Please suggest me if there are any other properties I need to use or is this a functionality.

Could you please give me a more information on editFailed and editComplete methods like when it will be called.

Thanks in advance.

Tabbing between Grid Fields in IE does not select value

$
0
0
Using the showcase Grid->Editing->Edit By Row with IE. Values are not auto selected when tabbing throw the values. In Chrome they are.

Real-Time Messaging: Subscribing Best Practices

$
0
0
I have channel that I want my clients to subscribe to upon opening the webapp, and I want them to remain subscribed for the duration of using the webapp.

Where is the best place to put the Messaging.subscribe() call? I currently have it at the end of onModuleLoad(), which is my entry point method. In the future, there may be multiple channels that I want them to subscribe to upon loading the webapp.

Secondly, I've noticed that upon calling Messaging.subscribe(), the browser tab shows "Connecting..." with the loading icon for a long period of time, upwards of a minute. This doesn't halt any program execution, nor does client still seem to be in the connecting process. The client receives the messages on the channel despite the browser tab still showing "Connecting...". This behavior happens regardless of where in my code I place the Messaging.subscribe() call. Has this behavior been noted before? It's not a functional blocker but it does look weird...

SmartClient Version: v9.0p_2014-02-13/EVAL Deployment
Firefox 26

Freeze column not working on Listgrid with Filter Editor enabled

$
0
0
Hi Isomorphic

The freeze column option on the right click context menu does not function when applied on a grid with a filter editor. Clicking on the frozen column causes its data to be swapped with another column's data as well.
The same is reproducible in the showcase example on Filter

Steps to reproduce:
http://www.smartclient.com/smartgwt/showcase/#grid_sortfilter_filter
1. Right click on the listgrid column Capital and choose Freeze Capital.
2. Notice that no change occurs.
3. Click on the "Capital" column header.
4. Notice that the data in capital has swapped with code though the column header remain unchanged.
5. Try resizing the column widths.
6. Notice the misalignment of the column headers and the filter editor fields

I am facing this issue in release v9.0p_2014-02-06/Enterprise Deployment 2014-02-06. I used Chrome and Firefox 12.0

Please let me know when this will be fixed.

Thanks

Attached Images
File Type: png OnClickColumnHeaderAfterFreeze.PNG (22.8 KB)
File Type: png OnResizeColumnWidths.PNG (19.7 KB)

How to add 2 panels in one screen using smartgwt.mobile

$
0
0
I've tried using HLayouts and VLayouts to do so, but it doesn't work. Is there any way to achieve that ?

Problem with record.setAttributeAsJavaObject and DynamicForm.editRecord

$
0
0
Hi,

I have a custom datasource and am trying to add a DataSourceField and then set the corresponding attribute with Record.setAttributeAsJavaObject. In my DynamicForm I have created and added a custom FormItem that extends CanvasItem and calls CanvasItem.addShowValueHandler.

My problem is that when I call DynamicForm.editRecord(Record) something goes wrong and I don’t get the java object in the CanvasItem.addShowValueHandler. Instead I get a JavaScriptObject.

Code snippets: In my CustomDataSource:
Code:

  DataSourceField testField = new DataSourceField(“test”, FieldType.ANY);
And
Code:

    record.setAttributeAsJavaObject(“test”, new String[] { "string1", "string2" });
In my custom form items ShowValueHandler.onShowValue:
Code:

    public void onShowValue(ShowValueEvent event) {
        Object value = event.getDataValue();
        Utils.logInfo("value=" + value);
        Utils.logInfo("value.getClass=" + value.getClass());       
        if (value instanceof String[]) {
            Utils.logInfo("we actually got an String[]!");
            return;
        }
        Record valueRecord = event.getDataValueAsRecord();
        String[] attributes = valueRecord.getAttributes();
        for (String string : attributes) {
            Utils.logInfo("attrib:" + string);
            Object attribute = valueRecord.getAttributeAsObject(string);
            Utils.logInfo("attribute=" + attribute);
            Utils.logInfo("attribute.getClass=" + attribute.getClass());
            if (attribute instanceof RuntimeException) {
                RuntimeException e = (RuntimeException) attribute;
                printStackTrace(e);
            }
        }
        if (value instanceof JavaScriptObject) {
            JavaScriptObject jsObj = (JavaScriptObject) value;
            Utils.logInfo("Converting to java array");
            String[] convertToJavaStringArray = JSOHelper.convertToJavaStringArray(jsObj);
            for (String string : convertToJavaStringArray) {
                Utils.logInfo("item=" + string);
            }
        }
    }

The output of above when running in gwt devmode:
Code:

value=[object Object]
value.getClass=class com.google.gwt.core.client.JavaScriptObject$
attrib:0
attribute=java.lang.RuntimeException
attribute.getClass=class java.lang.RuntimeException
e=null
com.google.gwt.dev.shell.JavaDispatchImpl JavaDispatchImpl.java:123
com.google.gwt.dev.shell.JsValueOOPHM$DispatchObjectOOPHM JsValueOOPHM.java:55
com.google.gwt.dev.shell.OophmSessionHandler OophmSessionHandler.java:83
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:687
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:344
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:219
com.google.gwt.dev.shell.ModuleSpaceOOPHM ModuleSpaceOOPHM.java:136
com.google.gwt.dev.shell.ModuleSpace ModuleSpace.java:576
com.google.gwt.dev.shell.ModuleSpace ModuleSpace.java:304
com.google.gwt.dev.shell.JavaScriptHost JavaScriptHost.java:107
com.smartgwt.client.widgets.form.DynamicForm DynamicForm.java:-1
com.test.TestPanel$8 TestPanel.java:796
sun.reflect.NativeMethodAccessorImpl NativeMethodAccessorImpl.java:-2
sun.reflect.NativeMethodAccessorImpl NativeMethodAccessorImpl.java:57
sun.reflect.DelegatingMethodAccessorImpl DelegatingMethodAccessorImpl.java:43
java.lang.reflect.Method Method.java:606
com.google.gwt.dev.shell.MethodAdaptor MethodAdaptor.java:103
com.google.gwt.dev.shell.MethodDispatch MethodDispatch.java:71
com.google.gwt.dev.shell.OophmSessionHandler OophmSessionHandler.java:172
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:338
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:219
com.google.gwt.dev.shell.ModuleSpaceOOPHM ModuleSpaceOOPHM.java:136
com.google.gwt.dev.shell.ModuleSpace ModuleSpace.java:576
com.google.gwt.dev.shell.ModuleSpace ModuleSpace.java:284
com.google.gwt.dev.shell.JavaScriptHost JavaScriptHost.java:91
com.google.gwt.core.client.impl.Impl Impl.java:-1
com.google.gwt.core.client.impl.Impl Impl.java:347
sun.reflect.GeneratedMethodAccessor560 null:-1
sun.reflect.DelegatingMethodAccessorImpl DelegatingMethodAccessorImpl.java:43
java.lang.reflect.Method Method.java:606
com.google.gwt.dev.shell.MethodAdaptor MethodAdaptor.java:103
com.google.gwt.dev.shell.MethodDispatch MethodDispatch.java:71
com.google.gwt.dev.shell.OophmSessionHandler OophmSessionHandler.java:172
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:338
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:219
com.google.gwt.dev.shell.ModuleSpaceOOPHM ModuleSpaceOOPHM.java:136
com.google.gwt.dev.shell.ModuleSpace ModuleSpace.java:576
com.google.gwt.dev.shell.ModuleSpace ModuleSpace.java:304
com.google.gwt.dev.shell.JavaScriptHost JavaScriptHost.java:107
com.smartgwt.client.data.DataSource DataSource.java:-1
com.test.CustomDataSource$PagedCallBack CustomDataSource.java:513
com.test.CustomDataSource$PagedCallBack CustomDataSource.java:1
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter RequestCallbackAdapter.java:232
com.google.gwt.http.client.Request Request.java:259
com.google.gwt.http.client.RequestBuilder$1 RequestBuilder.java:412
sun.reflect.NativeMethodAccessorImpl NativeMethodAccessorImpl.java:-2
sun.reflect.NativeMethodAccessorImpl NativeMethodAccessorImpl.java:57
sun.reflect.DelegatingMethodAccessorImpl DelegatingMethodAccessorImpl.java:43
java.lang.reflect.Method Method.java:606
com.google.gwt.dev.shell.MethodAdaptor MethodAdaptor.java:103
com.google.gwt.dev.shell.MethodDispatch MethodDispatch.java:71
com.google.gwt.dev.shell.OophmSessionHandler OophmSessionHandler.java:172
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:338
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:219
com.google.gwt.dev.shell.ModuleSpaceOOPHM ModuleSpaceOOPHM.java:136
com.google.gwt.dev.shell.ModuleSpace ModuleSpace.java:576
com.google.gwt.dev.shell.ModuleSpace ModuleSpace.java:284
com.google.gwt.dev.shell.JavaScriptHost JavaScriptHost.java:91
com.google.gwt.core.client.impl.Impl Impl.java:-1
com.google.gwt.core.client.impl.Impl Impl.java:347
sun.reflect.GeneratedMethodAccessor560 null:-1
sun.reflect.DelegatingMethodAccessorImpl DelegatingMethodAccessorImpl.java:43
java.lang.reflect.Method Method.java:606
com.google.gwt.dev.shell.MethodAdaptor MethodAdaptor.java:103
com.google.gwt.dev.shell.MethodDispatch MethodDispatch.java:71
com.google.gwt.dev.shell.OophmSessionHandler OophmSessionHandler.java:172
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:293
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:547
com.google.gwt.dev.shell.BrowserChannelServer BrowserChannelServer.java:364
java.lang.Thread Thread.java:724

But, when I deploy my webapp I get the “Converting to java array” and the conversion works fine (but I am really expecting a String[] here).

After some debugging I found references to an attribute called “deepCloneOnEdit”, and if I add:

Code:

  DataSourceField testField = new DataSourceField(“test”, FieldType.ANY);
  testField.setAttribute(“deepCloneOnEdit”, false);

Then it works fine, and I get the “we actually got an String[]!” above. Both when deploying and running in gwt devmode.

I suspect that somewhere in the code smartgwt tries to copy the java String[] object, but fails (in devmode).

If the record.setAttributeAsJavaObject is called with a “custom” POJO (array) it also ends up in a JavaScriptObject (array) which makes it impossible to get my original POJO (array) unless I set the “deepCloneOnEdit” to true.

Have I missed something or is “deepCloneOnEdit=true” the right way to solve it?

Above is when using smartgwt-4.0p from 2014-03-18 (LGPL) (SmartClient Version: v9.0p_2014-03-18/LGPL Development Only (built 2014-03-18)), GWT 2.6.0, Chrome Version 32.0.1700.102, Linux Ubuntu 12.04.But I am seeing the same thing with SmartClient Version: SNAPSHOT_v10.0d_2014-03-18/LGPL Development Only (built 2014-03-18) and SmartClient Version: v9.1p_2014-03-18/LGPL Development Only (built 2014-03-18)

Regards
/Johannes

ClassCastException Button ToolStripButton Component XML in FF and Chrome

$
0
0
Hi Isomorphic,

there is an issue with the Canvas being generated from Component XML which I can only reproduce in Firefox (26.0) and Chrome (33). This issue does not happen in IE (10).


The short version is that the client will try to create a Button from a component declared as a ToolStripButton thus generating the ClassCastException while working in Hosted mode (In deployed mode there is no exception nor error, just the buttons not working)




Component XML:
Code:

<isomorphicXML>
        <Label ID="titleLabel" width="100%" height="36" autoDraw="false" >
                <contents>MODULO PROYECTOS</contents>
                <title>Label0</title>
                <styleName>header</styleName>
        </Label>

        <HLayout ID="titleLayout" width="100%" height="36" autoDraw="false" >
                <defaultLayoutAlign>left</defaultLayoutAlign>
                <members>
                        <Canvas ref="titleLabel" />
                </members>
                <layoutAlign>left</layoutAlign>
        </HLayout>

        <ToolStripButton ID="projDisplayButton" autoDraw="false" >
                <title>Proyectos</title>
        </ToolStripButton>
       
        <ToolStripButton ID="projCloseButton" autoDraw="false" >
                <title>Cerrar</title>
        </ToolStripButton>

        <ToolStripButton ID="adminConsoleButton" autoDraw="false" >
                <title>Consola Admin.</title>
        </ToolStripButton>

        <ToolStripButton ID="developConsoleButton" autoDraw="false" >
                <title>Consola Desa.</title>
                <click>
                        isc.showConsole();
                </click>
        </ToolStripButton>
       
        <ToolStripButton ID="visualBuilderButton" autoDraw="false" >
                <title>Visual Builder</title>
        </ToolStripButton>
       
        <ToolStripButton ID="hidTest" autoDraw="false" >
                <title>Connect HID</title>
        </ToolStripButton>
       
        <ToolStripButton ID="refreshScreenCache" autoDraw="false" >
                <title>Recargar screenCache</title>
        </ToolStripButton>
       
        <ToolStripButton ID="reloadDS" autoDraw="false" >
                <title>Recargar DataSources</title>
        </ToolStripButton>
       
        <ToolStrip ID="mainToolbar" width="100%" autoDraw="false" >
                <members>
                        <Canvas ref="projDisplayButton" />
                        <Canvas ref="projCloseButton" />
                        <Canvas ref="adminConsoleButton" />
                        <Canvas ref="developConsoleButton" />
                        <Canvas ref="visualBuilderButton" />
                        <Canvas ref="hidTest" />
                        <Canvas ref="refreshScreenCache" />
                        <Canvas ref="reloadDS" />
                </members>
                <visibilityMode>multiple</visibilityMode>
        </ToolStrip>
       
        <VLayout ID="mainAreaLayout" width="100%" height="100%" autoDraw="false" >
       
        </VLayout>

        <VLayout ID="layoutPrincipal" width="100%" height="100%" autoDraw="false" >
                <members>
                        <Canvas ref="titleLayout" />
                        <Canvas ref="mainToolbar" />
                        <Canvas ref="mainAreaLayout" />
                </members>
        </VLayout>

</isomorphicXML>

Cast exception occurs in (screen is created with loadScreen with global IDs for every component):
Code:

//      ADMIN CONSOLE
        ToolStripButton btnConsolaAdmin = (ToolStripButton) Canvas.getById("adminConsoleButton");
        btnConsolaAdmin.addClickHandler(new ClickHandler(){

            @Override
            public void onClick(ClickEvent event) {
                SC.openDataSourceConsole();
            }
        });

I would appreciate if you could take a look at this issue since it is reducing the options we have as compatible browsers. If there is any other information you need to replicate this case, please let me know.


Thanks.


GWT Version 2.5.1

Current version:
SmartClient Version: v9.1p_2014-03-11/EVAL Deployment (expires 2014.05.10_10.04.43) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

Also tested with 4.0p (20140119 and 20140225)

Attached Images
File Type: png Error ClassCastException SmartGWT.png (29.3 KB)

Layout problem

$
0
0
Problem is items are not staying in the same line.

1)GWT 2.5.0

2)ALL bowsers

3) Java class is

public class TextAreaItemWithLink extends CanvasItem {


//UI Fields
private String name;
private DynamicForm dynamicForm = new DynamicForm();
public TextAreaItem txtAreaItem;
public ButtonItem buttonItem;

public TextAreaItemWithLink() {
super();
createLayout();
}

private void createLayout() {

txtAreaItem = new TextAreaItem();
txtAreaItem.setTitle(CaseFormUtil.getString("case. note"));
txtAreaItem.setWidth("300");
txtAreaItem.setHeight("190");
txtAreaItem.setRequired(true);
txtAreaItem.setValidators(CustomerFormUtil.getSpec ialCharactersFieldValidator());


buttonItem = new ButtonItem();
buttonItem.setTitle(CustomerFormUtil.getString("ca se.note.attachment"));
buttonItem.setStartRow(false);
buttonItem.setAutoFit(true);
buttonItem.setWidth("250");
buttonItem.setOverflow(Overflow.CLIP_V);

dynamicForm.setFields(txtAreaItem, buttonItem);

setCanvas(dynamicForm);
}

public void showCustomizeValuesButton(boolean val){
buttonItem.setVisible(val);
}

public Object getSelectedValue(){
return txtAreaItem.getValue();
}

public String getSelectedDisplayValue(){
return txtAreaItem.getDisplayValue();
}

@Override
public void setValue(String value) {
if(value != null && value.length() > 0){
storeValue(value);
}else{
clearValue();
}

super.setValue(value);
}

@Override
public Object getValue() {
return txtAreaItem.getValue();
}

public SelectItem getItem(){

return getItem();
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}

Attached Images
File Type: jpg results.JPG (25.3 KB)

TimeItem backed by Text/String?

$
0
0
Is there anyway to have a TimeItem that is backed by a String/Text via the data source?

When I try I get the nice Time picker but then the client validation fails saying: "Must be a time."

Currently we are just using a text field with "HH:MM" validation that we define ourselves and it all works but I wanted to use the TimeItem picker instead.

Thanks.

New patterns feature in comboxfield

$
0
0
It's possible to use the new richer patterns in combobox fields against an option datasource.

I've looking for it in documentation and showcase but it's not clear to me how I can enable patterns in combobox in a way that user can use * to do a LIKE search in the server.

For example that if user types 'and*r*a' it will match Andorra

applySummaryFunction not consistent with grid summary functions

$
0
0
SmartClient_v90p_2014-03-13_PowerEdition

This is related to post: http://forums.smartclient.com/showthread.php?t=26693

It seems like the summary functions have been updated (per the previous post) to correctly handle cases where there are dots "." in a formula field (divide by zero). I have tested this with the grid using summary functions.

However, in some cases we allow the user to add descriptive text to summary functions, so the display in the grid is more useful. For example a user may want to display the sum and average, so our application allows users to display the text "Total" and "Average" in the summary row, so the values are more descriptive. This is achieved using a custom function for the summary function. I have simplified the code for this test case to illustrate my point.

Repro steps:
- Load the test case
- The grid will display with a formula column (observations/inspections).
- Observe some rows have a divide by zero, resulting in "." for the formula value.
- I have added three sumamry functions to the grid, "sum", "avg" and "max", in that order.
- Observe that those values are 6, 3 and 6 respectively, which are correct.
- Open the browser console (Firefox). Note that the same summary calculations yield null.

It seems like isc.SimpleType.applySummaryFunction() has not been updated to behave the same as the built in grid summaries that were fixed (per the previous post).

Code:

<html>

        <head>
                <title >SNTQ-1843</title>
               
                <script type="text/javascript" >
                        var isomorphicDir="http://localhost:8080/isomorphic/";
                       
                        var data = [
                                { project:"Some zeros",  inspections:0, observations:0 },
                                { project:"Some zeros",  inspections:5, observations:0 },
                                { project:"Some zeros",  inspections:0, observations:0 },
                                { project:"Some zeros",  inspections:1, observations:6 }
                        ];
                </script>
               
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_Core.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_Foundation.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_Containers.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_Grids.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_Forms.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_DataBinding.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_Drawing.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_PluginBridges.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_Charts.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/system/development/ISC_Tools.js"></script>
                <script type="text/javascript" SRC="http://localhost:8080/isomorphic/skins/EnterpriseBlue/load_skin.js"></script>
        </head>
<body>

        <script type="text/javascript">

                var gridObject = isc.ListGrid.create({
                        fields:[
                                {name:"project", title:"Project", type:"text" },
                                {name:"formula", title: "Formula", userFormula: { formulaVars: {A:"observations", B:"inspections"}, text:"A/B" }, summaryFunction :["sum", "avg", "max"] },
                                {name:"inspections", type:"integer", title:"# Inspections"},
                                {name:"observations", type:"integer",  title:"# Observations"}
                        ],
                                dataFetchMode : "local",
                                data: data,
                                width : "100%",
                                align : "center",
                                autoFitData : "vertical",
                                autoFitMaxHeight : 400,
                                alternateRecordStyles : true,
                                canAddFormulaFields : true,
                                canAddSummaryFields : true,
                                canGroupBy : true,
                                canReorderFields : true,
                                showGridSummary : true,
                                useAdvancedFieldPicker : true,
                                advancedFieldPickerThreshold : 2
                });
                       
                var aggregateFunction = function(records, summaryField, f, t) {
               
                        var val = isc.SimpleType.applySummaryFunction(records, gridObject.getField(summaryField), f);
                        if (typeof (val) != "undefined" && val != null) {
                                return t + val;
                        }
                        else {
                                return t + "null";
                        }
                }

                // set the summary functions for this formula
                console.log("formula field summary function values");
                console.log(aggregateFunction(gridObject.data, "formula", "sum", "=== Total is "));
                console.log(aggregateFunction(gridObject.data, "formula", "avg", "=== Average is "));
                console.log(aggregateFunction(gridObject.data, "formula", "max", "=== Maximum is "));
                                       
        </script>       

</body>
</html>

Key press events not firing sometimes

$
0
0
Hi all,

I'm trying to add into my application some shortcut keys which will popped a small menu box if CTRL space is pressed.

In my EntryPoint I have a VLayout (called layout) that is drawn and is the root Element of my application.

So I have attached a keyDown handler to this...

Code:

    public void setupShortcutKeys() {
        layout.addKeyPressHandler(new KeyPressHandler() {
            @Override
            public void onKeyPress(KeyPressEvent keyPressEvent) {
                String pressedKey = keyPressEvent.getKeyName().toLowerCase();
                if (EventHandler.ctrlKeyDown() && pressedKey.equals("space")) {
                    if (HotLinkBar.getInstance().getContext() == HotLinkBar.LocationContext.EditCase) {
                        MessageUtil.addInfoMessage("Edit Case - Quick Launch");
                    } else {
                        MessageUtil.addInfoMessage("Other - Quick Launch");
                    }
                }
            }
        });

        layout.focus();
    }

Now this fires most of the time but I'm having a few issues...

1) On load of the application, key events do not fire until I click somewhere in the page. I'd guessed this is a focus issue but focus() does not seem to resolve the issue.
2) I have a Growl style alerts, which is basically a VLayout positioned in the top right corner. On closing the message, removeFromParent() and destroy() are called. Again this seems to lose focus and I have to click somewhere on page to get key presses working again.
3) There's places in the application where I add a tab to a tabset on the fly and then select that tab, again same thing here, events don't fire until I click on something.

To me it seems like a focus issue, anyone do something similar and have found away around this. I'd assumed its a focus issue, but attaching blur handlers do not seem to fire so suggest that's not the issue.

Any help/advice much appreciated.

Thanks,
Dale

SmartGWT Build Date : com.smartgwt.client.Version.getBuildDate() = Mon Dec 23 10:04:00 GMT 2013
SmartGWT Version : 4.0p
GWT Version : 2.4.0
Browser : IE11

DrawLabel with ellipsis

$
0
0
I'd like to truncate DrawLabel contents when it overflows a specified width.
I've experimented a bit with measuring text size on a hidden DIV.

Follows a snippet that works on current SmartClient showcase: it shows a gray label that overflows the green rectangle, while the red label (having the same contents) is truncated with an ellipsis.

Is there any smarter way to obtain the same result?
Also: is there any chance to have a similar feature integrated into smartclient/smartgwt?

Code:

var lbl1;
var lbl2;

var fontSize = 15;
var fontFamily = 'Sans';
var fontStyle = 'italic';
var fontWeight = 'bold';


var mainPane = isc.VLayout.create({
    autoDraw: true,
    height: 200,
    width: 600,
    members: [
        isc.DrawPane.create({
            autoDraw: false,
            cursor: "default",
            height: "100%",
                        border: "2px solid blue",
            drawItems: [
                lbl1 = isc.DrawLabel.create({
                    left: 60,
                    top: 40,
                    fontSize: fontSize,
                    fontFamily: fontFamily,
                    fontStyle: fontStyle,
                    fontWeight: fontWeight,
                    contents: 'The quick brown fox jumps over the lazy dog'
                }),
                lbl2 = isc.DrawLabel.create({
                    left: 60,
                    top: 70,
                    width: 200,
                    lineColor: 'red',
                    fontSize: fontSize,
                    fontFamily: fontFamily,
                    fontStyle: fontStyle,
                    fontWeight: fontWeight
                }),
                isc.DrawRect.create({
                    id: "lblContainer",
                    width: 200,   
                    height: 100,
                    left: 60,
                    top: 30,
                    lineColor: 'green'
                })
            ]
        })
    ]

});

isc.VStack.create({
    height: "100%",
    members: [mainPane]
});


var getLabelWidth = function  (contents, dirty) {
    dirty.innerHTML =  contents;
    return dirty.clientWidth + 1;
}

var truncateLabel = function  (theLabel, width, dirty) {
    var originalContents = theLabel.contents;
    var contents = originalContents;
    console.log ('analyzing "'+originalContents+'" for target width: '+width);

    var maxSteps = 3;
    for (var i=0;i<maxSteps;i++) {
        var currentWidth = getLabelWidth (i==0?contents:(contents+'...'), dirty);
        console.log ('currentWidth: '+currentWidth);
        if (currentWidth<=width) {
            break;
        } else {// shrink needed
            var ratio = width/currentWidth;
            contents = contents.substring (0, contents.length * ratio);
            console.log ('i: '+i+', contents: '+contents+', ratio: '+ratio);
        }
        theLabel.contents = contents+'...';
    }
}


var dirty = document.createElement('div');
dirty.id = 'dirty';
dirty.style.fontSize = fontSize+'px';
dirty.style.fontFamily = fontFamily;
dirty.style.fontStyle = fontStyle;
dirty.style.fontWeight = fontWeight;
dirty.style.position = 'absolute';
//dirty.style.visibility = 'hidden';
dirty.style.height = 'auto';
dirty.style.width = 'auto';
document.body.appendChild(dirty);

lbl2.contents = lbl1.contents;
truncateLabel (lbl2, lbl2.width, dirty);


How to design/code a HiddenInfoFormItem ?

$
0
0
I am trying to create a FormItem that mostly hides the value.... for example:
SSN is 123-45-6789
but I would like it to display as
***-**-6789 (or *****6789)
another example might be a credit card number that would show as *************1234

In all of our forms, we require the user to click an edit button to go into edit mode and this calls setCanEdit(true) on all the fields. I want to hide the full value unless it's being edited. This seems like a fairly common usage and maybe someone has done it before?

What I want is when not in edit mode, the SSN would display hidden like *****6789 but also have way to see the full value with user interaction (maybe click a picker icon/button). Then, when in edit mode, it shows the full editable value as usual.

I coded this all up by extending TextItem and it works. I used a PickerIcon with setNeverDisable(true) so when clicked it shows the complete value in a dialog. When in edit mode, I hide the PickerIcon and show the full value as usual. This works but the way I did it is causing all kinds of side effects (form.reset() doesn't work correctly, rememberValues() was remembering the hidden value, the validators were triggering on the obfuscated string) and was causing me to override a bunch of extra methods to account for the "dual-value" nature of the FormItem.

My solution works, but it's ugly/messy and I have to believe there is an easier way to accomplish this. The other way I thought I could do it was to actually have 2 FormItems in the form... one holds the real value and one holds the obfuscated value. The obfuscated one would have setShouldSaveValue(false) called on it and when we go to/from edit mode we would just hide/show the proper field. I think this might work but I'm not sure about other side effects.

Thoughts? Ideas? I can post my code if anyne wants to see it but I'm really looking for a different idea on how to do this.

Thanks,
Brian

RecordList memory leak

$
0
0
I'm using a RecordList to manipulate a temporary list of Records, but every time I create a new RecordList, it gets associated with the IDManager and will never be collected by the garbage collector, causing a memory leak on the application. Should I use the RecordList for this purpose?

I really appreciate any help you can provide.

Real-Time Messaging: General Question

$
0
0
I'm evaluating Real-Time Messaging in an application in which the user initiates some request - runFooCheck() - which is an RPC call that does some processing on the server which could take some indefinite amount of time, at the end of which a message is pushed to the client using the ISCMessageDispatcher.

I'm currently configured to use "Enterprise messaging" mode, using ActiveMQ and Tomcat following the instructions here: https://isomorphic.atlassian.net/wik...t+and+ActiveMQ

I want to know if it's possible for a client to receive the server-pushed message without being currently subscribed at the time the message was pushed. That is, a user clicks a button which initiates the runFooCheck(), closes their browser window for some inordinate period of time, meanwhile runFooCheck() completes and the ISCMessageDispatcher has pushed the resulting message onto the channel/Topic. When the user re-opens their browser window, they are re-subscribed to the channel, and they immediately receive the message that was there waiting for them.

Is this possible to achieve with Real-Time Messaging? Or is this a pipe dream?

No ScrolledEvent

$
0
0
I use SmartGWT 4.0 power version. For the following code, I am not able to get ScrolledEvent when the top layout is 100%.
@Override
public void onModuleLoad() {
VLayout layout = new VLayout();
layout.setWidth100();
layout.setHeight100();

// create something large enough to allow scrolling
Canvas canvas = new Canvas();
canvas.setHeight(3000);
layout.addMember(canvas);
layout.addScrolledHandler(new ScrolledHandler() {
@Override
public void onScrolled(ScrolledEvent event) {
SC.logWarn("scrolled");
}
});

layout.draw();
}

Apache Commons FileUpload vulnerabilities in SmartGWT (upgrade to FileUpload v1.3.1)

$
0
0
My team are using SmartGWT v2.5 (2011-10-18) Power Edition and v3.0 (2012-02-07) Power Edition. My team is is using Firefox ESR v17.0.4.

It is found that, both of SmartGWT v2.5 & v3.0 are still using commons-fileupload-1.2.1.jar, which is found to have DDOS vulnerability. The vulnerability has been fixed in Commons FileUpload version 1.3.1 that was released on 2014 Feb. 7.

However, when we try to upgrade to commons-fileupload-1.3.1.jar in SmartGWT v2.5 PowerEdition and v3.0 PowerEdition, we got the following errors:

[3/20/14 10:30:31:689 HKT] 000000b3 SystemOut O === 2014-03-20 10:30:31,689 [ : 5] INFO RequestContext - URL: '/XXXXXX_MyApp-web/spring/workspace/IDACall', User-Agent: 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0;
SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)': MSIE with Accept-Encoding header, ready for compressed JS
[3/20/14 10:30:31:732 HKT] 000000b3 SystemOut O === 2014-03-20 10:30:31,730 [ : 5] ERROR IDACall - Top-level servlet error:
java.lang.AbstractMethodError: com.isomorphic.servlet.ISCFileItem.setHeaders(Lorg/apache/commons/fileupload/FileItemHeaders;)V at org.apache.commons.fileupload.FileUploadBase.parse Request(FileUploadBase.java:355)
at org.apache.commons.fileupload.FileUploadBase.parse Request(FileUploadBase.java:288)
at com.isomorphic.servlet.ISCHttpServletRequest.parse Request(ISCHttpServletRequest.java:217)
at com.isomorphic.servlet.ISCHttpServletRequest.parse Request(ISCHttpServletRequest.java:192)
at com.isomorphic.servlet.ISCHttpServletRequest.getSt ringParams(ISCHttpServletRequest.java:116)
at com.isomorphic.servlet.ISCHttpServletRequest.getPa rameter(ISCHttpServletRequest.java:253)
at com.isomorphic.rpc.RPCManager.parseRequest(RPCMana ger.java:1800)
at com.isomorphic.rpc.RPCManager.<init>(RPCManager.ja va:286)
at com.isomorphic.rpc.RPCManager.<init>(RPCManager.ja va:271)
at com.isomorphic.servlet.IDACall.processRequest(IDAC all.java:116)
at com.isomorphic.servlet.IDACall.doPost(IDACall.java :73)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)
at com.isomorphic.servlet.BaseServlet.service(BaseSer vlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)


After some checking, it is found that there are method signature change from Commons-Fileupload v1.2.1 to v1.3.1 as follow on org.apache.commons.fileupload.FileItemHeaders:

Commons FileUpload v1.2.1:
Iterator getHeaders(String name); to
Commons FileUpload v1.3.1:
Iterator<String> getHeaders(String name);

Commons FileUpload v1.2.1:
Iterator getHeaderNames(); to
Commons FileUpload v1.3.1:
Iterator<String> getHeaderNames();

Would you please provide a patch on this vulnerability for SmartGWT 2.5 Power Edition / 3.0 Power Edition or you can advise us how we can tackle this vulnerability in SmartGWT v2.5 / 3.0 Power Edition? Thank you very much!

DDOS Vunerability on Commons FileUpload and Tomcat:
http://www.pcworld.com/article/2097360/denialofservice-vulnerability-puts-apache-tomcat-servers-at-risk.html.

This vulnerability allows attackers to take down Tomcat web sites and services. A malicious user can craft a malformed HTTP request, with a non-standard Content-Type multipart header that causes Tomcat to enter an infinite loop. Service can be recovered by rebooting server. A sustained attack could lead to prolong service disruption

--John Law
Viewing all 4756 articles
Browse latest View live