Package org.kie.uberfire.client.common.popups.footers

Examples of org.kie.uberfire.client.common.popups.footers.ModalFooterOKCancelButtons


    public void onClick( final ClickEvent event ) {
        final FormStylePopup pop = new FormStylePopup( TestScenarioConstants.INSTANCE.ChooseAFieldToAdd() );
        final FactFieldSelector selector = createAddNewField( pop );
        pop.addAttribute( TestScenarioConstants.INSTANCE.ChooseAFieldToAdd(),
                          selector );
        pop.add( new ModalFooterOKCancelButtons( new Command() {
            @Override
            public void execute() {
                SelectionEvent.fire( selector,
                                     selector.getSelectedText() );
            }
View Full Code Here


                                                                  } );

                final FormStylePopup pop = new FormStylePopup( TestScenarioAltedImages.INSTANCE.RuleAsset(),
                                                               TestScenarioConstants.INSTANCE.ChooseAFieldToAdd() );
                pop.addRow( b );
                pop.add( new ModalFooterOKCancelButtons( new Command() {
                    @Override
                    public void execute() {
                        String f = b.getItemText( b.getSelectedIndex() );
                        vf.getFieldValues().add( new VerifyField( f,
                                                                  "",
View Full Code Here

                centerVertically( AbstractBRLColumnViewImpl.this.getElement() );
            }
        };

        add( uiBinder.createAndBindUi( this ) );
        add( new ModalFooterOKCancelButtons( new Command() {
            @Override
            public void execute() {
                applyChanges();
            }
        }, new Command() {
View Full Code Here

                centerVertically( AbstractLimitedEntryBRLColumnViewImpl.this.getElement() );
            }
        };

        add( uiBinder.createAndBindUi( this ) );
        add( new ModalFooterOKCancelButtons( new Command() {
            @Override
            public void execute() {
                applyChanges();
            }
        }, new Command() {
View Full Code Here

        doValueList();
        doCalculationType();
        initialiseViewForConstraintValueType( editingCol.getConstraintValueType() );

        //Apply button
        footer = new ModalFooterOKCancelButtons( new Command() {
            @Override
            public void execute() {
                applyChanges( refreshGrid,
                              col,
                              isNew );
View Full Code Here

                        "",
                        1 );
        pop.addAttribute( GuidedDecisionTableConstants.INSTANCE.Operator(),
                          box );

        pop.add( new ModalFooterOKCancelButtons( new Command() {
            @Override
            public void execute() {
                editingCol.setOperator( box.getValue( box.getSelectedIndex() ) );
                makeLimitedValueWidget();
                makeDefaultValueWidget();
View Full Code Here

                                         } );

        pop.addAttribute( new StringBuilder( GuidedDecisionTableConstants.INSTANCE.Field() ).append( GuidedDecisionTableConstants.COLON ).toString(),
                          box );

        pop.add( new ModalFooterOKCancelButtons( new Command() {
            @Override
            public void execute() {
                editingCol.setFactField( box.getItemText( box.getSelectedIndex() ) );
                editingCol.setFieldType( oracle.getFieldType( editingPattern.getFactType(),
                                                              editingCol.getFactField() ) );
View Full Code Here

        } );
        pop.addAttribute( GuidedDecisionTableConstants.INSTANCE.negatePattern(),
                          chkNegated );

        pop.add( new ModalFooterOKCancelButtons( new Command() {
            @Override
            public void execute() {
                boolean isPatternNegated = chkNegated.getValue();
                String ft = types.getItemText( types.getSelectedIndex() );
                String fn = isPatternNegated ? "" : binding.getText();
View Full Code Here

                    }

                } );

                //OK button to create column
                final ModalFooterOKCancelButtons footer = new ModalFooterOKCancelButtons( new Command() {
                    @Override
                    public void execute() {
                        String s = choice.getValue( choice.getSelectedIndex() );
                        if ( s.equals( NewColumnTypes.METADATA_ATTRIBUTE.name() ) ) {
                            showMetaDataAndAttribute();
                        } else if ( s.equals( NewColumnTypes.CONDITION_SIMPLE.name() ) ) {
                            showConditionSimple();
                        } else if ( s.equals( NewColumnTypes.CONDITION_BRL_FRAGMENT.name() ) ) {
                            showConditionBRLFragment();
                        } else if ( s.equals( NewColumnTypes.ACTION_UPDATE_FACT_FIELD.name() ) ) {
                            showActionSet();
                        } else if ( s.equals( NewColumnTypes.ACTION_INSERT_FACT_FIELD.name() ) ) {
                            showActionInsert();
                        } else if ( s.equals( NewColumnTypes.ACTION_RETRACT_FACT.name() ) ) {
                            showActionRetract();
                        } else if ( s.equals( NewColumnTypes.ACTION_WORKITEM.name() ) ) {
                            showActionWorkItemAction();
                        } else if ( s.equals( NewColumnTypes.ACTION_WORKITEM_UPDATE_FACT_FIELD.name() ) ) {
                            showActionWorkItemActionSet();
                        } else if ( s.equals( NewColumnTypes.ACTION_WORKITEM_INSERT_FACT_FIELD.name() ) ) {
                            showActionWorkItemActionInsert();
                        } else if ( s.equals( NewColumnTypes.ACTION_BRL_FRAGMENT.name() ) ) {
                            showActionBRLFragment();
                        }
                        pop.hide();
                    }

                    private void showMetaDataAndAttribute() {
                        // show choice of attributes
                        final Image image = GuidedDecisionTableImageResources508.INSTANCE.Config();
                        final FormStylePopup pop = new FormStylePopup( image,
                                                                       GuidedDecisionTableConstants.INSTANCE.AddAnOptionToTheRule() );
                        final ListBox list = RuleAttributeWidget.getAttributeList();

                        //This attribute is only used for Decision Tables
                        list.addItem( GuidedDecisionTable52.NEGATE_RULE_ATTR );

                        // Remove any attributes already added
                        for ( AttributeCol52 col : model.getAttributeCols() ) {
                            for ( int iItem = 0; iItem < list.getItemCount(); iItem++ ) {
                                if ( list.getItemText( iItem ).equals( col.getAttribute() ) ) {
                                    list.removeItem( iItem );
                                    break;
                                }
                            }
                        }

                        final Image addbutton = GuidedDecisionTableImageResources508.INSTANCE.NewItem();
                        final TextBox box = new TextBox();
                        box.setVisibleLength( 15 );

                        list.setSelectedIndex( 0 );

                        list.addChangeHandler( new ChangeHandler() {
                            public void onChange( ChangeEvent event ) {
                                AttributeCol52 attr = new AttributeCol52();
                                attr.setAttribute( list.getItemText( list.getSelectedIndex() ) );
                                dtable.addColumn( attr );
                                refreshAttributeWidget();
                                pop.hide();
                            }
                        } );

                        addbutton.setTitle( GuidedDecisionTableConstants.INSTANCE.AddMetadataToTheRule() );

                        addbutton.addClickHandler( new ClickHandler() {
                            public void onClick( ClickEvent w ) {

                                String metadata = box.getText();
                                if ( !isUnique( metadata ) ) {
                                    Window.alert( GuidedDecisionTableConstants.INSTANCE.ThatColumnNameIsAlreadyInUsePleasePickAnother() );
                                    return;
                                }
                                MetadataCol52 met = new MetadataCol52();
                                met.setHideColumn( true );
                                met.setMetadata( metadata );
                                dtable.addColumn( met );
                                refreshAttributeWidget();
                                pop.hide();
                            }

                            private boolean isUnique( String metadata ) {
                                for ( MetadataCol52 mc : model.getMetadataCols() ) {
                                    if ( metadata.equals( mc.getMetadata() ) ) {
                                        return false;
                                    }
                                }
                                return true;
                            }

                        } );
                        DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
                        horiz.add( box );
                        horiz.add( addbutton );

                        pop.addAttribute( new StringBuilder( GuidedDecisionTableConstants.INSTANCE.Metadata1() )
                                                  .append( GuidedDecisionTableConstants.COLON ).toString(), horiz );
                        pop.addAttribute( GuidedDecisionTableConstants.INSTANCE.Attribute(),
                                          list );
                        pop.show();
                    }

                    private void showConditionSimple() {
                        final ConditionCol52 column = makeNewConditionColumn();
                        ConditionPopup dialog = new ConditionPopup( model,
                                                                    oracle,
                                                                    new ConditionColumnCommand() {
                                                                        public void execute( Pattern52 pattern,
                                                                                             ConditionCol52 column ) {

                                                                            //Update UI
                                                                            dtable.addColumn( pattern,
                                                                                              column );
                                                                            refreshConditionsWidget();
                                                                        }
                                                                    },
                                                                    column,
                                                                    true,
                                                                    isReadOnly );
                        dialog.show();
                    }

                    private void showConditionBRLFragment() {
                        final BRLConditionColumn column = makeNewConditionBRLFragment();
                        switch ( model.getTableFormat() ) {
                            case EXTENDED_ENTRY:
                                BRLConditionColumnViewImpl popup = new BRLConditionColumnViewImpl( path,
                                                                                                   model,
                                                                                                   oracle,
                                                                                                   ruleNameService,
                                                                                                   column,
                                                                                                   eventBus,
                                                                                                   true,
                                                                                                   isReadOnly );
                                popup.setPresenter( BRL_CONDITION_PRESENTER );
                                popup.show();
                                break;
                            case LIMITED_ENTRY:
                                LimitedEntryBRLConditionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLConditionColumnViewImpl( path,
                                                                                                                                      model,
                                                                                                                                      oracle,
                                                                                                                                      ruleNameService,
                                                                                                                                      (LimitedEntryBRLConditionColumn) column,
                                                                                                                                      eventBus,
                                                                                                                                      true,
                                                                                                                                      isReadOnly );
                                limtedEntryPopup.setPresenter( LIMITED_ENTRY_BRL_CONDITION_PRESENTER );
                                limtedEntryPopup.show();
                                break;
                        }
                    }

                    private void showActionInsert() {
                        final ActionInsertFactCol52 afc = makeNewActionInsertColumn();
                        ActionInsertFactPopup ins = new ActionInsertFactPopup( model,
                                                                               oracle,
                                                                               new GenericColumnCommand() {
                                                                                   public void execute( DTColumnConfig52 column ) {
                                                                                       newActionAdded( (ActionCol52) column );
                                                                                   }
                                                                               },
                                                                               afc,
                                                                               true,
                                                                               isReadOnly );
                        ins.show();
                    }

                    private void showActionSet() {
                        final ActionSetFieldCol52 afc = makeNewActionSetColumn();
                        ActionSetFieldPopup set = new ActionSetFieldPopup( model,
                                                                           oracle,
                                                                           new GenericColumnCommand() {
                                                                               public void execute( DTColumnConfig52 column ) {
                                                                                   newActionAdded( (ActionCol52) column );
                                                                               }
                                                                           },
                                                                           afc,
                                                                           true,
                                                                           isReadOnly );
                        set.show();
                    }

                    private void showActionRetract() {
                        final ActionRetractFactCol52 arf = makeNewActionRetractFact();
                        ActionRetractFactPopup popup = new ActionRetractFactPopup( model,
                                                                                   new GenericColumnCommand() {
                                                                                       public void execute( DTColumnConfig52 column ) {
                                                                                           newActionAdded( (ActionCol52) column );
                                                                                       }
                                                                                   },
                                                                                   arf,
                                                                                   true,
                                                                                   isReadOnly );
                        popup.show();
                    }

                    private void showActionWorkItemAction() {
                        final ActionWorkItemCol52 awi = makeNewActionWorkItem();
                        ActionWorkItemPopup popup = new ActionWorkItemPopup( path,
                                                                             model,
                                                                             GuidedDecisionTableWidget.this,
                                                                             new GenericColumnCommand() {
                                                                                 public void execute( DTColumnConfig52 column ) {
                                                                                     newActionAdded( (ActionCol52) column );
                                                                                 }
                                                                             },
                                                                             awi,
                                                                             workItemDefinitions,
                                                                             true,
                                                                             isReadOnly );
                        popup.show();
                    }

                    private void showActionWorkItemActionSet() {
                        final ActionWorkItemSetFieldCol52 awisf = makeNewActionWorkItemSetField();
                        ActionWorkItemSetFieldPopup popup = new ActionWorkItemSetFieldPopup( model,
                                                                                             oracle,
                                                                                             new GenericColumnCommand() {
                                                                                                 public void execute( DTColumnConfig52 column ) {
                                                                                                     newActionAdded( (ActionCol52) column );
                                                                                                 }
                                                                                             },
                                                                                             awisf,
                                                                                             true,
                                                                                             isReadOnly );
                        popup.show();
                    }

                    private void showActionWorkItemActionInsert() {
                        final ActionWorkItemInsertFactCol52 awiif = makeNewActionWorkItemInsertFact();
                        ActionWorkItemInsertFactPopup popup = new ActionWorkItemInsertFactPopup( model,
                                                                                                 oracle,
                                                                                                 new GenericColumnCommand() {
                                                                                                     public void execute( DTColumnConfig52 column ) {
                                                                                                         newActionAdded( (ActionCol52) column );
                                                                                                     }
                                                                                                 },
                                                                                                 awiif,
                                                                                                 true,
                                                                                                 isReadOnly );
                        popup.show();
                    }

                    private void showActionBRLFragment() {
                        final BRLActionColumn column = makeNewActionBRLFragment();
                        switch ( model.getTableFormat() ) {
                            case EXTENDED_ENTRY:
                                BRLActionColumnViewImpl popup = new BRLActionColumnViewImpl( path,
                                                                                             model,
                                                                                             oracle,
                                                                                             ruleNameService,
                                                                                             column,
                                                                                             eventBus,
                                                                                             true,
                                                                                             isReadOnly );
                                popup.setPresenter( BRL_ACTION_PRESENTER );
                                popup.show();
                                break;
                            case LIMITED_ENTRY:
                                LimitedEntryBRLActionColumnViewImpl limtedEntryPopup = new LimitedEntryBRLActionColumnViewImpl( path,
                                                                                                                                model,
                                                                                                                                oracle,
                                                                                                                                ruleNameService,
                                                                                                                                (LimitedEntryBRLActionColumn) column,
                                                                                                                                eventBus,
                                                                                                                                true,
                                                                                                                                isReadOnly );
                                limtedEntryPopup.setPresenter( LIMITED_ENTRY_BRL_ACTION_PRESENTER );
                                limtedEntryPopup.show();
                                break;
                        }

                    }

                    private void newActionAdded( ActionCol52 column ) {
                        dtable.addColumn( column );
                        refreshActionsWidget();
                    }
                }, new Command() {
                    @Override
                    public void execute() {
                        pop.hide();
                    }
                }
                );

                //If a separator is clicked disable OK button
                choice.addClickHandler( new ClickHandler() {

                    public void onClick( ClickEvent event ) {
                        int itemIndex = choice.getSelectedIndex();
                        if ( itemIndex < 0 ) {
                            return;
                        }
                        footer.enableOkButton( !choice.getValue( itemIndex ).equals( SECTION_SEPARATOR ) );
                    }

                } );

                pop.setTitle( GuidedDecisionTableConstants.INSTANCE.AddNewColumn() );
View Full Code Here

        //Hide column tick-box
        addAttribute( new StringBuilder( GuidedDecisionTableConstants.INSTANCE.HideThisColumn() ).append( GuidedDecisionTableConstants.COLON ).toString(),
                      DTCellValueWidgetFactory.getHideColumnIndicator( editingCol ) );

        //Apply button
        add( new ModalFooterOKCancelButtons( new Command() {
            @Override
            public void execute() {
                applyChanges( refreshGrid,
                              col,
                              isNew );
View Full Code Here

TOP

Related Classes of org.kie.uberfire.client.common.popups.footers.ModalFooterOKCancelButtons

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.