Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.Widget


    @Override
    protected Widget getCompositeLabel() {
        ClickHandler leftPatternclick =  new ClickHandler() {

            public void onClick(ClickEvent event) {
                Widget w= (Widget)event.getSource();
                showFactTypeSelector(w);
            }
        };
        ClickHandler sourcePatternClick = new ClickHandler() {

            public void onClick(ClickEvent event) {
                Widget w= (Widget)event.getSource();
                 showSourcePatternSelector(w);
            }
        };

        String lbl = "<div class='form-field'>" + HumanReadable.getCEDisplayName("from accumulate") + "</div>";

        DirtyableFlexTable panel = new DirtyableFlexTable();


        int r = 0;

        if (pattern.getFactPattern() == null) {
            panel.setWidget(r++, 0, new ClickableLabel("<br> <font color='red'>" + constants.clickToAddPattern() + "</font>", leftPatternclick, !this.readOnly));
        }


        panel.setWidget(r++, 0, new HTML(lbl));

        if (this.getFromAccumulatePattern().getSourcePattern() == null) {
            panel.setWidget(r++, 0, new ClickableLabel("<br> <font color='red'>" + constants.clickToAddPattern() + "</font>", sourcePatternClick, !this.readOnly));
        } else {
            IPattern rPattern = this.getFromAccumulatePattern()
                    .getSourcePattern();

            if (rPattern instanceof FactPattern) {
                this.sourcePatternWidget = new FactPatternWidget(
                        this.getModeller(), rPattern, true,
                        true, this.readOnly);
            } else if (rPattern instanceof FromAccumulateCompositeFactPattern) {
                this.sourcePatternWidget = new FromAccumulateCompositeFactPatternWidget(
                        this.getModeller(),
                        (FromAccumulateCompositeFactPattern) rPattern,
                        this.readOnly);
            } else if (rPattern instanceof FromCollectCompositeFactPattern) {
                this.sourcePatternWidget = new FromCollectCompositeFactPatternWidget(
                        this.getModeller(),
                        (FromCollectCompositeFactPattern) rPattern,
                        this.readOnly);
            } else if (rPattern instanceof FromCompositeFactPattern) {
                this.sourcePatternWidget = new FromCompositeFactPatternWidget(
                        this.getModeller(),
                        (FromCompositeFactPattern) rPattern, this.readOnly);
            } else {
                throw new IllegalArgumentException("Unsupported pattern "
                        + rPattern + " for right side of FROM ACCUMULATE");
            }

            this.sourcePatternWidget.addOnModifiedCommand(new Command() {
                public void execute() {
                    setModified(true);
                }
            });

            panel.setWidget(
                    r++,
                    0,
                    addRemoveButton(this.sourcePatternWidget,
                            new ClickHandler() {

                                public void onClick(ClickEvent event) {
                                    if (Window.confirm(constants
                                            .RemoveThisBlockOfData())) {
                                        setModified(true);
                                        getFromAccumulatePattern()
                                                .setSourcePattern(null);
                                        getModeller().refreshWidget();
                                    }

                                }
                            }));
        }

        //REVISIT: Nested TabLayoutPanel does not work, its content is truncated.
        //TabLayoutPanel tPanel = new TabLayoutPanel(2, Unit.EM);
        TabPanel tPanel = new TabPanel();

        DirtyableFlexTable codeTable = new DirtyableFlexTable();
        int codeTableRow = 0;
        int codeTableCol = 0;

        codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='form-field'>Init:</div>"));
       
        final TextBox initField = new TextBox();
        initField.setTitle("init code");
        initField.setText(getFromAccumulatePattern().getInitCode());
        initField.setEnabled(!this.readOnly);
        codeTable.setWidget(codeTableRow++, codeTableCol--, initField);

        codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='form-field'>Action:</div>"));
        final TextBox actionField = new TextBox();
        actionField.setTitle("action code");
        actionField.setText(getFromAccumulatePattern().getActionCode());
        actionField.setEnabled(!this.readOnly);
        codeTable.setWidget(codeTableRow++, codeTableCol--, actionField);

        codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='form-field'>Reverse:</div>"));
        final TextBox reverseField = new TextBox();
        reverseField.setTitle("reverse code.");
        reverseField.setText(getFromAccumulatePattern().getReverseCode());
        reverseField.setEnabled(!this.readOnly);
        codeTable.setWidget(codeTableRow++, codeTableCol--, reverseField);

        codeTable.setWidget(codeTableRow, codeTableCol++, new HTML("<div class='form-field'>Result:</div>"));
        final TextBox resultField = new TextBox();
        resultField.setTitle("result code");
        resultField.setText(getFromAccumulatePattern().getResultCode());
        resultField.setEnabled(!this.readOnly);
        codeTable.setWidget(codeTableRow++, codeTableCol--, resultField);


        //panel.setWidget(r++, 0, codeTable);
        ScrollPanel codePanel = new ScrollPanel();
        codePanel.add(codeTable);
       
        tPanel.add(codePanel,"Custom Code");

        DirtyableFlexTable functionTable = new DirtyableFlexTable();

        functionTable.setWidget(0, 0, new HTML("<div class='form-field'>Function:</div>"));
        final TextBox functionField = new TextBox();
        functionField.setTitle("function code");
        functionField.setText(getFromAccumulatePattern().getFunction());
        functionField.setEnabled(!this.readOnly);
        functionTable.setWidget(0, 1, functionField);

//        panel.setWidget(r++, 0, functionTable);

        ScrollPanel functionPanel = new ScrollPanel();
        functionPanel.add(functionTable);
       
       
        tPanel.add(functionPanel,"Function");
        ChangeHandler changehandler = new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                Widget sender = (Widget)event.getSource();
                TextBox senderTB = (TextBox) event.getSource();
                String code = senderTB.getText();
                setModified(true);
                if (sender == initField) {
                    getFromAccumulatePattern().setFunction(null);
View Full Code Here


        final Button fromAccumulateBtn = new Button(constants.FromAccumulate());
        final Button fromCollectBtn = new Button(constants.FromCollect());
        ClickHandler btnsClickHandler = new ClickHandler() {

            public void onClick(ClickEvent event) {
                Widget sender = (Widget) event.getSource();
                if (sender == fromBtn) {
                    getFromAccumulatePattern().setSourcePattern(
                            new FromCompositeFactPattern());
                } else if (sender == fromAccumulateBtn) {
                    getFromAccumulatePattern().setSourcePattern(
View Full Code Here

        return constraint;
    }

    private void refreshEditor() {
        panel.clear();
        Widget constraintWidget = null;

        //Expressions' fieldName and hence fieldType can change without creating a new ConstraintValueEditor.
        //SingleFieldConstraints and their ConnectiveConstraints cannot have the fieldName or fieldType changed
        //without first deleting and re-creating.
        if ( this.constraint instanceof SingleFieldConstraintEBLeftSide ) {
View Full Code Here

            public void onChange(ChangeEvent event) {
                executeOnValueChangeCommand();
            }
        } );

        Widget ed = widgets( img,
                             box );
        return ed;
    }
View Full Code Here

            public void execute() {
                executeOnValueChangeCommand();
            }
        } );
        Widget ed = widgets( new HTML( "&nbsp;" ),
                             builder );
        return ed;
    }
View Full Code Here

    class NewExpectationPopup extends TestScenarioButtonPopup {
        public NewExpectationPopup() {
            super( images.ruleAsset(),
                   constants.NewExpectation() );

            Widget selectRule = parent.getRuleSelectionWidget( packageName,
                                                               new RuleSelectionEvent() {

                                                                   public void ruleSelected(String name) {
                                                                       VerifyRuleFired verifyRuleFired = new VerifyRuleFired( name,
                                                                                                                              null,
View Full Code Here

  public void addRow(Integer rowIndex, Object[] cellObjects) {

    HTMLTable.RowFormatter rf = getRowFormatter();
    for (int cell = 0; cell < cellObjects.length; cell++) {
      Widget widget = createCellWidget(cellObjects[cell]);
      setWidget(rowIndex, cell, widget);

      if (cell==0)
         getCellFormatter().addStyleName(rowIndex, cell,"application-FlexTable-Cell-first");
      else
View Full Code Here

    }
  }

  public void AddHeader(Object[] cellObjects) {
    for (int cell = 0; cell < cellObjects.length; cell++) {
      Widget widget = createCellWidget(cellObjects[cell]);
      setWidget(0, cell, widget);
      getCellFormatter().addStyleName(0, cell,"application-FlexTable-ColumnLabelCell");
    }
  }
View Full Code Here

      getCellFormatter().addStyleName(0, cell,"application-FlexTable-ColumnLabelCell");
    }
  }

  private Widget createCellWidget(Object cellObject) {
    Widget widget = null;

    if (cellObject instanceof Widget)
      widget = (Widget) cellObject;
    else
      widget = new Label(cellObject.toString());
View Full Code Here

    if (initialized) {
      return;
    }
   
    // Get the contents
    Widget w = onInitialize();
    if (w != null) {
      setWidget(w);
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.Widget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.