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

[bug] RichTextItem not editable after calling animateShow()

$
0
0
But calling show on the parent canvas causes the RichTextItem to behave normally.


1. SmartClient version
v10.0p_2015-05-12/PowerEdition Deployment (built 2015-05-12)

2. browser(s) and version(s) involved
Chrome Version 43.0.2357.132, Firefox 16.0.1, IE 11.0.9600.17207

3. for a server-side problem, the *complete* logs generated during processing of the failing request (do *not* trim to just the error message)
N/A

4. for any problem processing a server response, the actual response as shown in the RPC tab in the Developer Console
N/A

5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
No error I can see

6. sample code if applicable
I modified the Master Detail showcase example but used the supplyitem datasource provided by built-in-ds example code to replicate the defect.

BuiltInDS.java
Code:

package com.smartgwt.sample.client;

import java.util.ArrayList;
import java.util.List;
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.AnimationEffect;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortArrow;
import com.smartgwt.client.util.PageKeyHandler;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.AnimationCallback;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.RichTextEditor;
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.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.RichTextItem;
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.VLayout;
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 {

        protected VLayout detailPanel;

        /**
        * This is the entry point method.
        */
        public void onModuleLoad() {
                VLayout layout = new VLayout(15); 
                layout.setWidth100();

                Label label = new Label(); 
                label.setHeight(10); 
                label.setWidth100(); 
                label.setContents("Showing items in Category 'Rollfix Glue"); 
                layout.addMember(label); 

                // Get the supplyItem dataSource
                final DataSource dataSource = DataSource.get("supplyItem"); 

                final DynamicForm form = new DynamicForm(); 
                form.setIsGroup(true); 
                form.setGroupTitle("Update"); 
                form.setNumCols(4); 
                form.setDataSource(dataSource); 
                form.setItems(createFormItems());

                final ListGrid listGrid = new ListGrid(); 
                listGrid.setWidth100(); 
                listGrid.setHeight(200); 
                listGrid.setDataSource(dataSource); 
                listGrid.setAutoFetchData(true); 
                listGrid.addRecordClickHandler(new RecordClickHandler() { 
                        public void onRecordClick(RecordClickEvent event) {
                                recordSelected(event.getRecord());
                                form.reset(); 
                                form.editSelectedData(listGrid);
                        } 
                }); 

                detailPanel = new VLayout();

                layout.addMember(listGrid); 
                layout.addMember(detailPanel);     

                detailPanel.setVisible(false);
                detailPanel.addMember(form);

                IButton button = new IButton("Save"); 
                button.addClickHandler(new ClickHandler() { 
                        public void onClick(ClickEvent event) { 
                                form.saveData();                 
                        } 
                }); 
                layout.addMember(button);

                layout.draw();
        }

        /**
        *  By calling detailPanel.show() instead the RichTextItem behaves correctly.
        */
        protected void recordSelected(final Record record) {
                detailPanel.animateShow(AnimationEffect.WIPE, new AnimationCallback() {
                        @Override
                        public void execute(boolean earlyFinish) {

                        }
                }, 250);
                //                  detailPanel.show();
        }

        /**
        * Below method returns a list of form items. Currently only returns the description RichTextItem.
        * @return FormItem[]
        */
        private FormItem[] createFormItems() {
                List<FormItem> items = new ArrayList<FormItem>();

                RichTextItem richTextItem = new RichTextItem("description", "Description");                 
                richTextItem.setShowTitle(true);
                richTextItem.setWidth(650);
                richTextItem.setHeight(300);
                richTextItem.setOverflow(Overflow.HIDDEN);     
                items.add(richTextItem);                 

                return items.toArray(new FormItem[items.size()]);
        }

}


Viewing all articles
Browse latest Browse all 4756

Trending Articles