1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    2
    Vote Rating
    0
    zmas is on a distinguished road

      0  

    Cool formpanel already added to contentpanel but not showing

    formpanel already added to contentpanel but not showing


    formpanel already added to contentpanel but not showing. But buttons in the contentpanel are showing. Is there a force redrawing / recalculating of the contentpanel?

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Nov 2010
    Posts
    209
    Vote Rating
    -2
    Ersmarker has a little shameless behaviour in the past

      0  

    Default


    Could you provide a fully working testcase that implements EntryPoint.

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    2
    Vote Rating
    0
    zmas is on a distinguished road

      0  

    Default formpanel already added to contentpanel but not showing

    formpanel already added to contentpanel but not showing


    Hi,
    Include 3 main player classes here - SynopWeb,CodedSynopPanel and SynopForm. SynopWeb implements entrypoint, here codedsynopanel and synopform is added to viewport, which is then added to the rootpanel. Upon launching, codedsynoppanel will be displayed first, when the decode button in the codedsynoppanel is pressed, the synopform (a contentpanel) appears, but only the added buttons are displayed, the formpanel does not show.
    I need help, please help me, thank you.

    //========= Class SynopWeb implementing Entrypoint ==================

    package my.com.tech.synop.client;

    import my.com.tech.synop.client.EventHandlers.SaveSynopEventHandler;
    import my.com.tech.synop.client.Events.SaveSynopEvent;
    import my.com.tech.synop.client.EventHandlers.SynopFormEventHandler;
    import my.com.tech.synop.client.Events.SynopFormEvent;
    import my.com.tech.synop.client.EventHandlers.CancelEventHandler;
    import my.com.tech.synop.client.Events.CancelEvent;

    import com.extjs.gxt.ui.client.Style.LayoutRegion;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
    import com.extjs.gxt.ui.client.widget.layout.FitLayout;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.user.client.Window;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.extjs.gxt.ui.client.Style.Scroll;


    public class SynopWeb implements EntryPoint {

    public void onModuleLoad() {

    final Viewport viewport = new Viewport ();
    viewport.setLayout (new FitLayout ());

    String SynopCoded = "NNXX 12345";

    try {
    //SynopCoded;
    Synop s = new Synop (SynopCoded);
    s.dumpVars();

    final CodedSynopPanel codedSynopPanel = new CodedSynopPanel (SynopCoded);
    viewport.add(codedSynopPanel);

    final SynopForm synopForm = new SynopForm (s);
    viewport.add(synopForm);

    codedSynopPanel.addSynopFormEventHandler (new SynopFormEventHandler () {
    public void onSynopForm(SynopFormEvent event) {
    Synop s;
    try {
    s = new Synop (event.getData());
    s.dumpVars ();

    codedSynopPanel.hide();
    synopForm.show();
    synopForm.createForm (s);
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    });

    synopForm.addSaveSynopEventHandler (new SaveSynopEventHandler () {
    public void onSaveSynop(SaveSynopEvent event) {
    codedSynopPanel.hide();
    synopForm.show();
    }
    });

    synopForm.addCancelEventHandler (new CancelEventHandler () {
    public void onCancel(CancelEvent event) {
    Window.alert ("Cancel Synop: " + event.getData());
    synopForm.hide();
    codedSynopPanel.show();
    }
    });

    }
    catch (Exception e) {
    e.printStackTrace();
    }

    RootPanel.get().add (viewport);

    }
    }

    // =========== CodedSynopPanel class ============


    package my.com.tech.synop.client;

    import java.util.HashMap;


    import my.com.tech.synop.client.EventHandlers.SynopFormEventHandler;
    import my.com.tech.synop.client.Events.SynopFormEvent;

    import com.extjs.gxt.ui.client.Style;
    import com.extjs.gxt.ui.client.Style.LayoutRegion;
    import com.extjs.gxt.ui.client.Style.Scroll;
    import com.extjs.gxt.ui.client.event.ButtonEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.LayoutContainer;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.form.Field;
    import com.extjs.gxt.ui.client.widget.form.FormPanel;
    import com.extjs.gxt.ui.client.widget.form.TextArea;
    import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
    import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
    import com.extjs.gxt.ui.client.widget.layout.FormData;
    import com.extjs.gxt.ui.client.widget.layout.FormLayout;
    import com.google.gwt.event.shared.GwtEvent;
    import com.google.gwt.event.shared.HandlerRegistration;
    import com.google.gwt.event.shared.SimpleEventBus;
    import com.google.gwt.event.shared.HasHandlers;
    import com.google.gwt.event.shared.SimpleEventBus;
    import com.google.gwt.user.client.Window;

    public class CodedSynopPanel extends ContentPanel implements HasHandlers {

    private SimpleEventBus eventBus;

    FormPanel fp1;

    public CodedSynopPanel (String initSynop) {
    createSynopPanel (initSynop);
    eventBus = new SimpleEventBus();
    }

    public void createSynopPanel (String initSynop) {

    setHeading ("Coded Synop");
    setLayout (new CenterLayout());
    fp1 = new FormPanel ();
    setScrollMode(Scroll.AUTO);
    fp1.setHeaderVisible(false);
    fp1.setBodyBorder(false);
    fp1.setSize(1000,500);
    fp1.setLabelAlign(LabelAlign.TOP);
    fp1.setButtonAlign(Style.HorizontalAlignment.RIGHT);
    add (fp1);

    final TextArea codedSynop = new TextArea();
    codedSynop.setFieldLabel("Coded Synop");
    codedSynop.setValue(initSynop);
    codedSynop.setAllowBlank(false);
    fp1.add (codedSynop, new FormData (800,70));

    final Button decodeButton = new Button ("Decode");
    decodeButton.addSelectionListener(
    new SelectionListener<ButtonEvent> () {
    public void componentSelected(ButtonEvent ce) {
    if (fp1.isValid()) {
    Window.alert("decode pressed");
    SynopFormEvent ev = new SynopFormEvent (codedSynop.getValue());
    fireEvent (ev);
    };
    }});
    fp1.add (decodeButton);

    final TextArea encodedSynop = new TextArea();
    encodedSynop.setFieldLabel("Encoded Synop Result");
    fp1.add (encodedSynop, new FormData (800,70));

    }

    public void fireEvent(GwtEvent<?> event) {
    eventBus.fireEvent(event);
    }

    public HandlerRegistration addSynopFormEventHandler(
    SynopFormEventHandler handler) {
    return eventBus.addHandler(SynopFormEvent.TYPE, handler);
    }

    }


    // =========== SynopForm class ============


    package my.com.tech.synop.client;

    import my.com.tech.synop.client.EventHandlers.CancelEventHandler;
    import my.com.tech.synop.client.EventHandlers.SaveSynopEventHandler;
    import my.com.tech.synop.client.Events.CancelEvent;
    import my.com.tech.synop.client.Events.SaveSynopEvent;

    import java.util.HashMap;
    import com.extjs.gxt.ui.client.widget.form.Validator;
    import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
    import com.extjs.gxt.ui.client.Style.LayoutRegion;
    import com.extjs.gxt.ui.client.Style.Scroll;
    import com.extjs.gxt.ui.client.Style.VerticalAlignment;
    import com.extjs.gxt.ui.client.event.ButtonEvent;
    import com.extjs.gxt.ui.client.event.Events;
    import com.extjs.gxt.ui.client.event.FieldEvent;
    import com.extjs.gxt.ui.client.event.FieldSetEvent;
    import com.extjs.gxt.ui.client.event.Listener;
    import com.extjs.gxt.ui.client.event.BaseEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.Info;
    import com.extjs.gxt.ui.client.widget.Label;
    import com.extjs.gxt.ui.client.widget.LayoutContainer;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.form.Field;
    import com.extjs.gxt.ui.client.widget.form.FieldSet;
    import com.extjs.gxt.ui.client.widget.form.FormPanel;
    import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
    import com.extjs.gxt.ui.client.widget.form.Radio;
    import com.extjs.gxt.ui.client.widget.form.RadioGroup;
    import com.extjs.gxt.ui.client.widget.form.TextField;
    import com.extjs.gxt.ui.client.widget.form.TextArea;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
    import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
    import com.extjs.gxt.ui.client.widget.layout.ColumnData;
    import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
    import com.extjs.gxt.ui.client.widget.layout.FormData;
    import com.extjs.gxt.ui.client.widget.layout.FormLayout;
    import com.extjs.gxt.ui.client.widget.layout.TableData;
    import com.extjs.gxt.ui.client.widget.layout.TableLayout;
    import com.google.gwt.event.shared.GwtEvent;
    import com.google.gwt.event.shared.HandlerRegistration;
    import com.google.gwt.event.shared.HasHandlers;
    import com.google.gwt.dom.client.Style.VerticalAlign;
    import com.google.gwt.event.dom.client.ChangeEvent;
    import com.google.gwt.event.dom.client.ChangeHandler;
    import com.google.gwt.regexp.shared.MatchResult;
    import com.google.gwt.regexp.shared.RegExp;
    import com.google.gwt.user.client.Window;
    import com.google.gwt.event.shared.SimpleEventBus;

    public class SynopForm extends ContentPanel implements HasHandlers {

    private SimpleEventBus eventBus;

    // keep track of all the fields
    HashMap<String, Field<?>> fields;

    // UI
    LayoutContainer section0Layout, section1Layout, section2Layout, section3Layout, section4Layout;
    LabelValueListBox reportIdList, WMORAList, reportPartIdList, UTCDayList, UTCHourList, windIndicatorList, mtrsOrFtList;
    LabelValueListBox precipitationList, stationOperationIndList, cloudHeightList, totalCloudCvrList, windDirectionList, stdIsobaricSurfaceList;
    LabelValueListBox dataSignHumidityList, charOfPressureTendList, precipitationPrecObsvList, durationOfRefForPrecList, presentWeatherMannedList;
    LabelValueListBox pastWeatherW1List, pastWeatherW2List, presentWeatherAutoList, pastWeatherAutoWa1List, pastWeatherAutoWa2List;
    LabelValueListBox amtCLOrCMCloudList, clCloudList, cmCloudList, chCloudList;
    LabelValueListBox directionList, averageSpeedList, seaTemperatureIndList, swellWaveDirection1List, swellWaveDirection2List, iceAccretionList;
    LabelValueListBox iceAccretionRateList, wetBulbTemperatureIndList, seaIceConcentrationList, stageOfDevelopmentList, iceOfLandOriginList, iceEdgeBearingList;
    LabelValueListBox iceSituationTrendList, stateOftheGroundList, groundStateSnowList, durationOfRefForPrecListS3, indivCloudAmtList, genusOfCloudsList;
    LabelValueListBox amtOfCloudList, genusOfCloudsBelowList, cloudDescriptionList;
    FormPanel fp;
    TextField<String> CallSign, latitude, longitude;
    FieldSet fieldsetS2, fieldsetS3, fieldsetS4;

    public SynopForm () {
    eventBus = new SimpleEventBus();
    Synop blankSynop = new Synop ();
    createForm (blankSynop);
    }

    public SynopForm (Synop initSynop) {
    eventBus = new SimpleEventBus();
    createForm (initSynop);
    }

    public void createForm (Synop initSynop) {

    // remove existing fields. Needed in case createForm is called again, after
    // constructing SynopForm.

    Window.alert("in createform");
    // removeAll();

    HashMap<String,String> synopFields = initSynop.decode ();
    fields = new HashMap<String, Field<?>> ();

    setHeading ("Synop Editor");
    setLayout ( new BorderLayout ());

    fp = new FormPanel ();
    fp.setScrollMode(Scroll.AUTO);
    fp.setHeaderVisible(false);
    fp.setBodyBorder(false);

    fp.add(createSection0(synopFields));

    add (fp, new BorderLayoutData (LayoutRegion.CENTER));

    final ContentPanel preview = new ContentPanel ();
    preview.setHeaderVisible(false);
    preview.addText ("I am the Preview");
    preview.setVisible (false);

    BorderLayoutData previewLayout = new BorderLayoutData (LayoutRegion.SOUTH, 50);
    previewLayout.setMinSize (50);
    previewLayout.setMaxSize (200);
    previewLayout.setSplit(true);
    add (preview, previewLayout);

    final Button cancelButton = new Button ("Cancel");
    getButtonBar().add (cancelButton);

    final Button previewButton = new Button ("Show Preview");
    getButtonBar().add (previewButton);

    previewButton.addSelectionListener(
    new SelectionListener<ButtonEvent> () {
    public void componentSelected(ButtonEvent ce) {
    //Info.display("Valid state", fp.isValid() ? "is valid" : "is not valid");
    if (preview.isVisible()) {
    preview.setVisible (false);
    previewButton.setText ("Show Preview");
    } else {
    if (fp.isValid()) {
    // create and encode a Synop
    Synop synop = new Synop (getFields());
    String codedSynop = synop.encode ();
    preview.setVisible (true);
    preview.removeAll();
    preview.addText(codedSynop);
    preview.layout();
    previewButton.setText ("Hide Preview");
    } else {
    Info.display("Validity State", "is not valid");
    }
    }
    }
    });

    final Button saveButton = new Button ("Save");
    getButtonBar().add (saveButton);

    saveButton.addSelectionListener(
    new SelectionListener<ButtonEvent> () {
    public void componentSelected(ButtonEvent ce) {
    if (fp.isValid()) {
    // Save the encoded Synop
    Synop synop = new Synop (getFields());
    SaveSynopEvent ev = new SaveSynopEvent (synop.encode ());
    fireEvent (ev);
    } else {
    Info.display("Validity State", "is not valid");
    }

    }
    });

    cancelButton.addSelectionListener(
    new SelectionListener<ButtonEvent> () {
    public void componentSelected(ButtonEvent ce) {
    CancelEvent ev = new CancelEvent ();
    fireEvent (ev);
    }
    });

    fp.layout();
    }

    public void fireEvent(GwtEvent<?> event) {
    eventBus.fireEvent(event);
    }

    public HandlerRegistration addSaveSynopEventHandler(SaveSynopEventHandler handler) {
    return eventBus.addHandler(SaveSynopEvent.TYPE, handler);
    }

    public HandlerRegistration addCancelEventHandler(CancelEventHandler handler) {
    return eventBus.addHandler(CancelEvent.TYPE, handler);
    }



    private FieldSet createSection0 (HashMap<String,String> synopFields) {

    FieldSet fieldset = new FieldSet ();
    fieldset.setCollapsible(true);
    fieldset.setLayout(new FormLayout());
    fieldset.setHeading("Section 0: Identification Data");

    section0Layout = new LayoutContainer ();
    TableLayout tableLayout = new TableLayout (6);
    tableLayout.setWidth ("100%");
    tableLayout.setCellPadding(8);
    TableData tableData = new TableData();
    tableData.setWidth("16%");
    tableData.setHeight("50");
    tableData.setVerticalAlign(VerticalAlignment.BOTTOM);
    TableData tableData2 = new TableData();
    tableData2.setWidth("16%");
    tableData2.setHeight("50");
    tableData2.setVerticalAlign(VerticalAlignment.BOTTOM);
    tableData2.setColspan(2);

    section0Layout.setLayout (tableLayout);
    section0Layout.setBorders(true); // temporary so we can see it

    // Report ID
    reportIdList = new LabelValueListBox();
    reportIdList.addItem("FM 12 - Fixed Land Station", "AAXX");
    reportIdList.addItem("FM 13 - Sea Station", "BBXX");
    reportIdList.addItem("FM 14 - Mobile Land Station", "OOXX");
    reportIdList.selectValue(synopFields.get("Section0Group0MiMiMjMj"));
    reportIdList.setFieldLabel ("Report ID");
    reportIdList.setAllowBlank(false);
    section0Layout.add(addField ("Section0Group0MiMiMjMj", reportIdList, new FormData (100, 22)), tableData);


    // Group D....D
    // D....D - Ship's call sign consisting of three or more alphanumeric characters
    CallSign = new TextField<String>();
    CallSign.setFieldLabel("Ship's Call Sign");
    CallSign.setValidator(new Validator() {
    public String validate(Field<?> field, String value) {
    String errMsg = null;

    if (! value.matches("^[a-zA-Z0-9]+$")) {
    errMsg = "Must be alphanumeric";
    }
    return errMsg;
    }
    });
    section0Layout.add(addField ("Section0Group1D_D", CallSign, new FormData (100,22)), tableData);


    // A1 - WMO Regional Association area in which buoy, drilling rig or oil-
    // or gas production platform has been deployed
    // bw - Sub-area belonging to the area indicated by A1
    WMORAList = new LabelValueListBox();
    WMORAList.addItem(" ", "");
    WMORAList.addItem("11 - Region I", "11");
    WMORAList.addItem("12 - Region I", "12");
    WMORAList.addItem("13 - Region I", "13");
    WMORAList.addItem("14 - Region I", "14");
    WMORAList.addItem("71 - Region VII", "71");
    WMORAList.addItem("72 - Region VII", "72");
    WMORAList.addItem("73 - Region VII", "73");
    WMORAList.addItem("74 - Region VII", "74");
    WMORAList.setFieldLabel ("WMO Regional Association Area and Sub Area");
    WMORAList.setMinListWidth(120);
    WMORAList.selectValue(synopFields.get("Section0Group1A1bw"));
    WMORAList.setValidator(new Validator() {
    public String validate(Field<?> field, String value) {
    String errMsg = null;
    if (reportIdList.getValue().getValuePart().matches("BBXX") || reportIdList.getValue().getValuePart().matches("OOXX")) {
    if (value.matches(" ") && fields.get("Section0Group1A1bw").isEnabled() == true) {
    errMsg = "This field is required";
    } else {
    errMsg = null;
    }
    }
    return errMsg;
    }
    });
    section0Layout.add(addField ("Section0Group1A1bw", WMORAList, new FormData (100, 22)), tableData);

    fieldset.add (section0Layout);

    return fieldset;

    }


    private LayoutContainer addField (String fieldTag, final Field<?> field, final FormData d) {

    // Create a layoutContainer set to FormLayout. Without this, field labels
    // will not appear.
    LayoutContainer ret = new LayoutContainer ();
    FormLayout f = new FormLayout ();
    f.setLabelAlign(LabelAlign.TOP);

    ret.setLayout (f);
    ret.add (field, d);

    // keep a reference to the field so that we can call it up from anywhere
    // later.
    fields.put (fieldTag, field);

    return ret;
    }

    }

Similar Threads

  1. widget not showing in GXT's contentpanel
    By mwmcmullen in forum Ext GWT: Discussion
    Replies: 12
    Last Post: 5 May 2010, 6:38 AM
  2. GridPanel not showing added records
    By Radziu in forum Ext 2.x: Help & Discussion
    Replies: 10
    Last Post: 12 Mar 2009, 8:21 PM
  3. TabPanel not showing added components correctly
    By whodat in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 11 Feb 2009, 11:30 AM
  4. [Solved] Tree Styling disappears when added to ContentPanel
    By Aaryn015 in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 11 Sep 2007, 7:51 PM

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar