Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.FunctionalAgent$Form


        dialogBox.center();
    }

    private void buildCreatePonyActivity() {

        createPony = new Form();
        nameFormField = new StringTextBoxFormField();
        ageFormField = new IntegerTextBoxFormField();
        raceFormField = new StringTextBoxFormField();

        nameFormField.setValidator(new NotEmptyFieldValidator());
View Full Code Here


        final PFlowPanel layout = new PFlowPanel();
        layout.add(new PLabel("Pony SDK styling use Less CSS. It's really easy to customize your styling with the use of a few variable."));
        layout.add(new PLabel("Customize the sample by changing this variables :"));

        final Form form = new Form();

        final PSimplePanel headerPreview = new PSimplePanel();
        final PSimplePanel headerTextColorPreview = new PSimplePanel();
        final PSimplePanel footerPreview = new PSimplePanel();
        final PSimplePanel footerTextColorPreview = new PSimplePanel();
        final PSimplePanel highlightPreview = new PSimplePanel();

        final PSimplePanel blackPreview = new PSimplePanel();
        final PSimplePanel grayDarkerPreview = new PSimplePanel();
        final PSimplePanel grayDarkPreview = new PSimplePanel();
        final PSimplePanel grayPreview = new PSimplePanel();
        final PSimplePanel grayLightPreview = new PSimplePanel();
        final PSimplePanel grayLighterPreview = new PSimplePanel();
        final PSimplePanel whitePreview = new PSimplePanel();

        header = buildColorFormField("498BF4", headerPreview);
        headerTextColor = buildColorFormField("EDEDED", headerTextColorPreview);
        footer = buildColorFormField("498BF4", footerPreview);
        footerTextColor = buildColorFormField("EDEDED", footerTextColorPreview);
        highlight = buildColorFormField("498BF4", highlightPreview);

        black = buildColorFormField("000000", blackPreview);
        grayDarker = buildColorFormField("222222", grayDarkerPreview);
        grayDark = buildColorFormField("333333", grayDarkPreview);
        gray = buildColorFormField("555555", grayPreview);
        grayLight = buildColorFormField("999999", grayLightPreview);
        grayLighter = buildColorFormField("eeeeee", grayLighterPreview);
        white = buildColorFormField("ffffff", whitePreview);

        form.addFormField(header.formField);
        form.addFormField(headerTextColor.formField);
        form.addFormField(footer.formField);
        form.addFormField(footerTextColor.formField);
        form.addFormField(highlight.formField);

        form.addFormField(black.formField);
        form.addFormField(grayDarker.formField);
        form.addFormField(grayDark.formField);
        form.addFormField(gray.formField);
        form.addFormField(grayLight.formField);
        form.addFormField(grayLighter.formField);
        form.addFormField(white.formField);

        final PFlexTable formLayout = new PFlexTable();
        formLayout.setWidget(0, 0, new FormFieldComponent("header", header.formField));
        formLayout.setWidget(1, 0, new FormFieldComponent("headerTextColor", headerTextColor.formField));
        formLayout.setWidget(2, 0, new FormFieldComponent("footer", footer.formField));
        formLayout.setWidget(3, 0, new FormFieldComponent("footerTextColor", footerTextColor.formField));
        formLayout.setWidget(5, 0, new FormFieldComponent("highlight", highlight.formField));

        formLayout.setWidget(0, 1, headerPreview);
        formLayout.setWidget(1, 1, headerTextColorPreview);
        formLayout.setWidget(2, 1, footerPreview);
        formLayout.setWidget(3, 1, footerTextColorPreview);
        formLayout.setWidget(5, 1, highlightPreview);

        formLayout.setWidget(0, 2, new FormFieldComponent("black", black.formField));
        formLayout.setWidget(1, 2, new FormFieldComponent("grayDarker", grayDarker.formField));
        formLayout.setWidget(2, 2, new FormFieldComponent("grayDark", grayDark.formField));
        formLayout.setWidget(3, 2, new FormFieldComponent("gray", gray.formField));
        formLayout.setWidget(4, 2, new FormFieldComponent("grayLight", grayLight.formField));
        formLayout.setWidget(5, 2, new FormFieldComponent("grayLighter", grayLighter.formField));
        formLayout.setWidget(6, 2, new FormFieldComponent("white", white.formField));

        formLayout.setWidget(0, 3, blackPreview);
        formLayout.setWidget(1, 3, grayDarkerPreview);
        formLayout.setWidget(2, 3, grayDarkPreview);
        formLayout.setWidget(3, 3, grayPreview);
        formLayout.setWidget(4, 3, grayLightPreview);
        formLayout.setWidget(5, 3, grayLighterPreview);
        formLayout.setWidget(6, 3, whitePreview);

        final PButton validateButton = new PButton("Validate");
        validateButton.setStyleName("pony-PButton accent");
        validateButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final boolean isValid = form.isValid();
                if (isValid) {
                    updateClientColorAndRefreshLess();
                }
            }
View Full Code Here

    protected void onFirstShowPage() {
        super.onFirstShowPage();

        final PFlexTable panel = new PFlexTable();

        final Form form = new Form();

        final FormField<String> field1 = new StringTextBoxFormField();
        field1.setValidator(new NotEmptyFieldValidator());
        final FormField<String> field2 = new StringTextBoxFormField();
        field2.setValidator(new DoubleFieldValidator());
        final FormField<String> field3 = new StringTextBoxFormField();
        field3.setValidator(new CompositeFieldValidator(new NotEmptyFieldValidator(), new DoubleFieldValidator()));
        final FormField<String> field4 = new StringTextBoxFormField();
        field4.setValidator(new CompositeFieldValidator(new NotEmptyFieldValidator(), new EmailFieldValidator()));
        final FormField<Boolean> field5 = new CheckBoxFormField();
        field5.setValidator(new UncheckedFieldValidator());

        final PListBox listBox = new PListBox(true);
        listBox.addItem("Item 1");
        listBox.addItem("Item 2");
        listBox.addItem("Item 3");
        listBox.addItem("Item 4");
        listBox.addItem("Item 5");
        listBox.addItem("Item 6");

        final FormField<String> field6 = new StringListBoxFormField(listBox);
        field6.setValidator(new NotEmptyFieldValidator());

        final FormField<Date> field7 = new DateBoxFormField();
        field7.setValidator(new NotEmptyFieldValidator());

        final FormField<Date> field8 = new DateBoxFormField();
        field7.setValidator(new NotEmptyFieldValidator());

        final FormField<String> field9 = new StringTextBoxFormField();
        field9.setValidator(new NotEmptyFieldValidator());

        final FormField<String> field10 = new StringTextBoxFormField();
        field10.setValidator(new TwinFieldValidator("Field doesn't match", field9));

        form.addFormField(field1);
        form.addFormField(field2);
        form.addFormField(field3);
        form.addFormField(field4);
        form.addFormField(field5);
        form.addFormField(field6);
        form.addFormField(field7);
        form.addFormField(field8);
        form.addFormField(field9);
        form.addFormField(field10);

        final FormFieldComponent formFieldComponent1 = new FormFieldComponent("field1", field1);
        final FormFieldComponent formFieldComponent2 = new FormFieldComponent("field2", field2);
        final FormFieldComponent formFieldComponent3 = new FormFieldComponent("field3", field3);
        final FormFieldComponent formFieldComponent4 = new FormFieldComponent("field4", field4);
        final FormFieldComponent formFieldComponent5 = new FormFieldComponent("field5", field5);
        final FormFieldComponent formFieldComponent6 = new FormFieldComponent("field6", field6);
        final FormFieldComponent formFieldComponent7 = new FormFieldComponent("field7", field7);
        final FormFieldComponent formFieldComponent8 = new FormFieldComponent("field8", field8);
        final FormFieldComponent formFieldComponent9 = new FormFieldComponent("field9", field9);
        final FormFieldComponent formFieldComponent10 = new FormFieldComponent("field10", field10);

        final PFlexTable formLayout = new PFlexTable();
        formLayout.addStyleName("cell-top");
        formLayout.setWidget(0, 0, formFieldComponent1);
        formLayout.setWidget(0, 1, formFieldComponent2);
        formLayout.setWidget(1, 0, formFieldComponent3);
        formLayout.setWidget(1, 1, formFieldComponent4);
        formLayout.setWidget(2, 0, formFieldComponent5);
        formLayout.setWidget(2, 1, formFieldComponent6);
        formLayout.setWidget(3, 0, formFieldComponent7);
        formLayout.setWidget(3, 1, formFieldComponent8);
        formLayout.setWidget(4, 0, formFieldComponent9);
        formLayout.setWidget(4, 1, formFieldComponent10);

        final PButton validateButton = new PButton("Validate");
        validateButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                final boolean isValid = form.isValid();
                PNotificationManager.showTrayNotification("The form is valid? " + (isValid ? "YES" : "NO"));
            }
        });

        final PButton resetButton = new PButton("Reset");
        resetButton.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                form.reset();
                PNotificationManager.showHumanizedNotification("The form has been reseted");
            }
        });

        final PListBox captionOriantationList = new PListBox(true);
View Full Code Here

            }
        }

        if (metadata instanceof FunctionalAgentMetadata) {

            FunctionalAgent envEntity = (FunctionalAgent)scopedEntity;
            PolymorphicVarContext polymorphicVarContext = PolymorphicVarContext.make();
            TypeExpr[] typePieces = envEntity.getTypeExpr().getTypePieces();

            CALDocComment caldoc = envEntity.getCALDocComment();

            // Add the result type.           
            text.append("<br>");
            text.append("<b>");
            text.append(GemCutter.getResourceString("ToolTipHelper_Returns"));
View Full Code Here

        /// ultimately ends up being used in expressions, not the instance method backing it.
        //
       
        Scope scope = null;
        String unqualifiedName = methodName;
        FunctionalAgent entityWithArgumentNames = classMethod;
        CALDocComment classMethodCALDocComment = classMethod.getCALDocComment();
        TypeExpr typeExpr = classInstance.getInstanceMethodType(methodName);
        ArgumentMetadata[] argMetadataArray = metadata.getArguments();
        String label = labelMaker.getLabel(classInstance, methodName);
       
View Full Code Here

        if (typeInfo != null) {
   
            FunctionalAgent[] entities = typeInfo.getFunctionalAgents();
   
            for (int i = 0; i < entities.length; ++i) {
                FunctionalAgent envEntity = entities [i];
                addGemEntity(new GemEntity(envEntity, virtualResourceManager));
            }
        }
    }
View Full Code Here

     */       
    protected ImageIcon getGemDisplayIcon(Gem gem) {
        // different icons for each type of gem
        if (gem instanceof FunctionalAgentGem) {
            FunctionalAgentGem functionalAgentGem = (FunctionalAgentGem) gem;
            FunctionalAgent functionalAgent = functionalAgentGem.getGemEntity().getFunctionalAgent();

            if (functionalAgent instanceof Function || functionalAgent instanceof ClassMethod) {
                return supercombinatorIcon;
            } else if (functionalAgent instanceof DataConstructor) {
                return constructorIcon;
View Full Code Here

                    ModuleTypeInfo typeInfo = workspaceManager.getModuleTypeInfo(moduleName);
                    if (typeInfo == null) {
                        iceLogger.log(Level.INFO, "The module " + moduleName + " does not exist.");
                    } else {
                        String functionName = qualifiedFunctionName.getUnqualifiedName();
                        FunctionalAgent function = typeInfo.getFunctionOrClassMethod(functionName);
                        if (function == null) {
                            iceLogger.log(Level.INFO, "The function " + qualifiedFunctionName + " does not exist.");
                        } else {                           
                            ScopedEntityNamingPolicy scopedEntityNamingPolicy = new ScopedEntityNamingPolicy.UnqualifiedUnlessAmbiguous(typeInfo);
                           
                            iceLogger.log(Level.INFO, qualifiedFunctionName + " :: " + function.getTypeExpr().toString(true, scopedEntityNamingPolicy) + "\n");
                           
                            CALDocComment comment;
                            String kind;
                            if (function instanceof Function) {
                                comment = ((Function)function).getCALDocComment();
View Full Code Here

        //  Now go over the function names and generate the helper functions and
        // QualifiedName constant.
        for (final Map.Entry<String, FunctionalAgent> entry : nameToFuncInfo.entrySet()) {
          
            String calFuncName = entry.getKey();
            FunctionalAgent functionalAgent = entry.getValue();

            CALDocComment cdc = functionalAgent.getCALDocComment();

            // We need to make sure the name for the helper function/qualified name field is
            // a valid java name.
            String javaFuncName = fixupVarName(calFuncName);
           
            // Add a binding method for the CAL function.
            // Essentially this method builds an application
            // of the function to the supplied arguments using our
            // source model.
           
            // Build up the argument names and types.
            TypeExpr te = functionalAgent.getTypeExpr();
            int nArgs = te.getArity();
            int nNamedArgs = functionalAgent.getNArgumentNames();
           
            String paramNames[] = CALDocToJavaDocUtilities.getArgumentNamesFromCALDocComment(cdc, functionalAgent);
            if (paramNames.length != nArgs)  {
                throw new NullPointerException ("Mismatch between arity and number of arguments for " + calFuncName);
            }
            String origParamNames[] = new String[paramNames.length];
            System.arraycopy(paramNames, 0, origParamNames, 0, origParamNames.length);
           
            JavaTypeName paramTypes[] = new JavaTypeName [paramNames.length];
           
            // If we have named arguments we should use those names.
            Set<String> paramNamesSet = new HashSet<String>();
            for (int i = 0; i < paramNames.length; ++i) {
                String name = paramNames[i];

                if (name == null) {
                    if (i < nNamedArgs) {
                        name = functionalAgent.getArgumentName(i);
                    }
                   
                    if (name == null || name.equals("")) {
                        name = null;
                        // There is no name for this argument in the functional entity.  This
View Full Code Here

            // and simply fall off the end with no additional HTML generated, which is what is intended in such cases.
           
            if (metadata instanceof FunctionalAgentMetadata) {
                QualifiedName qualifiedName = featureName.toQualifiedName();
                ModuleTypeInfo moduleTypeInfoForFeature = owner.getPerspective().getMetaModule(qualifiedName.getModuleName()).getTypeInfo();
                FunctionalAgent envEntity = moduleTypeInfoForFeature.getFunctionalAgent(qualifiedName.getUnqualifiedName());
               
                boolean isRequiredClassMethod = false;
                if (envEntity instanceof ClassMethod) {
                    ClassMethod method = (ClassMethod)envEntity;
                    isRequiredClassMethod = (method.getDefaultClassMethodName() == null); // no default -> required
                }
               
                CALDocComment caldoc = envEntity.getCALDocComment();
                buffer.append(getBasicMetadataHtml(owner, metadata, caldoc));
                buffer.append(getFunctionalAgentMetadataHtml(owner, (FunctionalAgentMetadata) metadata, url, caldoc, isRequiredClassMethod));
                buffer.append(getAdditionalMetadataHtml(owner, metadata, caldoc));
               
            } else if (metadata instanceof ModuleMetadata) {
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.FunctionalAgent$Form

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.