Custom components and passing arguments

This afternoon I got a great response on the use of custom MXML components and calling a function in the main file of the application. I can do it now using parentDocument, BUT I need to pass the name of a function (for filtering) as a parameter of the function call in the custom component. Here are two code fragments.

Custom component code

" < mx:LinkButton label = '10% discount or more" (showTenPercent) click = "parentDocument.filterFunction" / >

The main application code

public function filterFunction(functionName:Function):void {}

merchantDG.visible =true;

merchantData.filterFunction = functionName;

merchantData.refresh ();

}

public Function showTenPercent(item:Object):Boolean {}

return (item.merchantOfferCategory ==' 10% ');

}

The filterFunction in main application function is called by multiple components, so I think I should keep centralized in the main application. There is probably another way to do it, but I build my Flex skills slowly and need to understand how to proceed. As the code is now, I get an error on the functions and strings.

I think instead of calling the function inside the custom component, you must do this from the inside of your main application whenever you are initiating the custom component.

for ex.

in this way, that you need not prefix parentDocument.

Tags: Flex

Similar Questions

  • The workflow step (approve Action) Service custom Java and "pass params".

    Good afternoon, fellow coders!

    Normally I research and proof of concepts until I find a solution, but given the great deadlines, I don't have the time - so I need your help.

    I try to have an Action to approve Workflow (idocScript output Workflow event call) to call a custom component (Service of Java) AND 'pass' a sort of parameters (bare minimum dDocName)

    In a perfect world, it would be as simple as: processContentInfo (String dDocName, String xMyCode1, String xMyCode2);

    But since I called the Java Service of idocScript (via executeService) I can't skip params through the API.

    Is there a simple way to do this?

    It seems that if you can not skip params you could put at least in the managed container (m_binder) and just know to look on the side of Java via some DataBinder as m_binder.getLocal)

    Am I missing a simple idocScript function that will allow you to do this?

    Note: I'm NOT running the Service from a URL so normal? param1 and param2-> m_binder.getLocal solution is not good.

    In addition, book of Bex warns on the Classes of Service not easily 'be able to call other Services of the University Complutense of MADRID'...  My Personalized Service must do exactly that (and JDBC and other things). Is this really a problem?

    Looks like I've got dDocName I could use CRMI to hit what I want, as long as I know how to use a binder, etc. - is there a mystical shade that prevents this?  Or he just said that it is difficult, UNLESS you know RIDC?

    Quality all advice is appreciated!  And please, try to give me an answer detailed as opposed to something vague like 'try a Service Manager', I need something that I can digest quickly.

    Thanks in advance!

    You can set parameters for the service call by defining Idoc Script variable before calling executeService.

    <$dDocName="TEST12345"$>

    <$param1="09876"$>

    <$param2="ABCDEFG"$>

    These variables are then available via the DataBinder service.

    Here is information on how to run a custom component service. Avoid any question doing this.

    http://www.redstonecontentsolutions.com/5/post/2012/05/executing-a-service-from-aservicehandler.html

    http://jonathanhult.com/blog/2012/06/execute-a-service-from-a-Java-filter/

    Jonathan

    http://jonathanhult.com

  • Design example of a different process pocess and passing arguments

    Creating instance of process of a different process:

    I have two different processes: Main_Flow (id: MainFlow) and Second_Flow (id: SecondFlow). In the first process, I read a csv file. Each line of the file contains four columns. After reading each line, I open the Second_Flow and pass the data read from the file. (Pls find the code below for the whole process):
    fileReader = FileReader(arg1: fullFileName); filename is a file type and file name and path
    Java.Io.BufferedReader reader = BufferedReader(arg1: fileReader);

    String str;
    countLines int = 0;

    While ((str = reader.readLine ())! = null)
    {
    strColumn = str.split (delim: ",");

    int ColumnCnt = 0;
    While (ColumnCnt, 4)
    {
    definition of variables
    String appNo;
    String custNo;
    String loanAmm;
    String loanDate;
    logMessage ("the column value:"+ ColumnCnt + "is" + strColumn [ColumnCnt] ');
    If (ColumnCnt == 0)
    {
    arrLoanData ['appNo'] = strColumn [ColumnCnt];
    }
    Else if (ColumnCnt == 1)
    {
    arrLoanData ['custNo'] = strColumn [ColumnCnt];
    }
    Else if (ColumnCnt == 2)
    {
    arrLoanData ['loanAmm'] = strColumn [ColumnCnt];
    }
    ElseIf (ColumnCnt == 3)
    {
    arrLoanData ['loanDate'] = strColumn [ColumnCnt];
    }
    arrLoanData ["descriptionArg"] = "AutoInstance:" + formatTime (timeStyle 'now',: Time.SHORT); "."
    arrLoanData ['genByArg'] = 'auto ';

    ProcessInstance.create (processId: "/ SecondFlow", arguments: arrLoanData, argumentsSetName: "BeginIn");

    ColumnCnt = ColumnCnt + 1;
    }
    countLines = countLines + 1;
    }

    (' The code is in Java and not PBL ")

    I spend appNo, custNo, loanAmm, and loanDate as arguments. The Argument will be of any type [string]. The argument the name of Second_Flow is "BeginIn". But I don't get anything in Second_Flow.

    What can I do in the mapping of the beginning of Second_Flow argument for the argument past (table)?

    the argument "arguments" for the ProcessInstance.create method receives a map of the arguments that the value of the "argumentSetName" argument will receive.
    so, for example, if your second stream has 2 arguments, String name, decimal value and content String() your method call would be:
    ProcessInstance.create (processId: "/ SecondFlow", arguments: {"name": strNameFromCsv, "value": valueFromCsv, "content": ["a", "b", "c", "d"]}, argumentsSetName: "BeginIn");

  • Passing data between the component main enforcement through custom methods and custom

    Similar to what this article is talking about, I have a custom list that contains a list of names of State of the United States in chains. (Let's call this states.mxml) #comments http://www.boyzoid.com/blog/index.cfm/2006/11/22/Flex-Custom-Components-and-Custom-Methods

    I create an action script that is included in my states.mxml like < mx:Script source = "myScripts.as" / > so that I can call the method in mySpcripts.as

    Now, what I want to do is, whenever I click on an item in the list, I want this string is displayed on the Application of the hand (on a canvas or Panel) as a label.

    I don't know how I am supposed to refer to the canvas and wood, which lies on the main of the application of myScripts.as
    Is there a way to create an action script file where methods can reference components for the main application and the custom component file?

    Thank you

    this.parentApplication.canvas.label should do what you are looking for

  • Passing arguments to a custom class of MC constructor

    I have problems with the Builder for a custom class linked to a MovieClip library.

    I have a MovieClip in my library called circle, which is related to the com.shapes.Circle class. I want the contstructor of class circle to take 2 arguments, xScale and yScale:

    public function Circle (xScale:Number, yScale:Number) End Sub

    However, if I try to call it from code, for example ball circle = new Circle (3.14,2.0); , I always get a 'number of Incorrect arguments. Waiting 0 " error.

    Is it possible to have a custom class linked to a MovieClip that can take arguments, or Flash not allow this? I had asked about this before and thought I figured out, but look at it now, I apparently had not thought of it and has resorted to a workaround sloppy; I'm hoping to fix now.

    Library items cannot have constructor arguments, because the user can drag on the stage and in this way has no way of passing arguments. If you wat to initialize instances, define public void init() where you can add as many arguments as you want.

  • Is there a way to 'batch' record as very? We have a customer who regularly sends files without all the embedded fonts. To clean the files for digital printing, save us as Postscript and pass them through Distller. "Save as Postscript is most of time consu

    Is there a way to 'batch' record as very? We have a customer who regularly sends files without all the embedded fonts. To clean the files for digital printing, save us as Postscript and pass them through Distller. "Save as Postscript is the longest part of the process, then I would be able to automate it.  Any ideas?

    This is the worst absolute way to embed fonts for PostScript through deletes dynamic transparency, color management, bookmarks, hyperlinks, etc. Yucck!  You are in many ways to ruin the files, do not clean them.

    Acrobat Preflight has a correction for embedding fonts. Takes only a few seconds per file PDF. And if you have a bunch of these files, you can create an action to do this.

    -Dov

  • You need to pass arguments to the Sub - VI which runs in parallel to the main vi.

    Please help me.

    I can pass arguments to a subvi using "call-by-reference-node" but the sub - vi will not work in parallel.  I can also run my sub - vi in parallel using "invoke the node", but then cannot pass arguments.  I can't understand how to merge these two concepts.

    When I open the reference VI, I specify the strict type, using call-by-reference-node.  When I use call node, I don't specify the type.  It seems that specifying the type strict guard screw run in parallel, but also seems necessary to pass arguments.

    I apologize for my absence of a deeper understanding of this and appreciate any help you can give me.

    Chris

    You must invoke 'Ctrl Val.Set' node.

  • Passing arguments to the script

    Hello

    I have created a dialog box load the files in the folder and when I click the button I run another script of command StartScript (...)

    How can I pass arguments to the script (the paths of files)?

    Thank you

    Hey OzShimon,

    As long as you use a tiara predefined global variables (T1, T2,...)  you'd be fine. You can also define user variables (.) SAV files) or even to declare your own global variables with: call GlobalDim ("Myname").

    These variables are not re-initialized until you restart the script engine. So just change 'obj' for T1 your test should work

    ' Dim obj

    Void Button1_EventClick (ByRef This)

    T1 = "Hello World".

    Call ScriptStart("C:\Users\Oz\Desktop\test.vbs")

    End Sub

    * the script code (test.vbs):

    Call MsgBox (T1)

    Kind regards

    Javier

  • How to pass arguments to JVM containing spaces on Solaris

    How to pass the value of the JVM Argument containing spaces on Solaris?

    For example, I need to run tests of cucumber and pass the following JVM argument:

    -Dcucumber.options = "features - classpath:com glue, company, projects, steps"

    But I get the following error:

    Unrecognized option:-glue

    Could not create the Java virtual machine.

    Seems that the space after "features" is recognized as a delimiter, even if I put the value in quotes.

    Everything works fine on Windows, but fails on Solaris 5.10.

    Any ideas?

    Thank you.

    Problem is solved. The cause was illogical in quotes in Shell.

    This does not work, she same product works the same string on Windows:

    CUCUMBER_OPTIONS = "-Dcucumber.options =-" $FEATURES_PATH - fit $STEPS_PATH\ "" "

    JVM_OPTIONS = "$CUCUMBER_OPTIONS $OTHER_OPTIONS".

    $JAVAHOME/bin/java org.junit.runner.JUnitCore com.company.project.runner.TestRunner $JVM_OPTIONS

    While this is the case, even the value $FEATURES_PATH-$STEPS_PATH glue is not quoted:

    CUCUMBER_OPTIONS = "glue-Dcucumber.options = $ FEATURES_PATH-$STEPS_PATH.

    JVM_OPTIONS = $OTHER_OPTIONS.

    $JAVAHOME/bin/java '$CUCUMBER_OPTIONS' $JVM_OPTIONS org.junit.runner.JUnitCore com.company.project.runner.TestRunner

  • Custom components in FXML

    Hello

    I want to set in the FXML a custom component, something like MyTreeItem, which extends from TreeItem. To do this, I created a MyJavaFXBuilderFactory to return the correct constructor (MyTreeItemBuilder). MyTreeItemBuilder returns instances of MyTreeItem.

    Note: Below, I send my courses and my tree.fxml.


    Is it possible to include in the custom components of fxml?



    When I run my application, I got this error:

    com.sun.javafx.fxml.PropertyNotFoundException: "myvalue" property does not exist or is read-only.

    at com.sun.javafx.fxml.BeanAdapter.put (unknown Source)

    at com.sun.javafx.fxml.BeanAdapter.put (unknown Source)

    to javafx.fxml.FXMLLoader$ Element.applyProperty (unknown Source)

    to javafx.fxml.FXMLLoader$ Element.processPropertyAttribute (unknown Source)

    to javafx.fxml.FXMLLoader$ Element.processEndElement (unknown Source)

    to javafx.fxml.FXMLLoader$ ValueElement.processEndElement (unknown Source)

    at javafx.fxml.FXMLLoader.processEndElement (unknown Source)

    at javafx.fxml.FXMLLoader.load (unknown Source)

    at MainWindowTree.start (MainWindowTree.java:33)

    to com.sun.javafx.application.LauncherImpl$ 5.run (unknown Source)

    to com.sun.javafx.application.PlatformImpl$ 4.run (unknown Source)

    to com.sun.javafx.application.PlatformImpl$ 3.run (unknown Source)

    at com.sun.glass.ui.win.WinApplication._runLoop (Native Method)

    in com.sun.glass.ui.win.WinApplication.access$ 100 (unknown Source)

    to com.sun.glass.ui.win.WinApplication$ $2 1.run (unknown Source)

    at java.lang.Thread.run(Thread.java:722)



    Tree.fxml



    <? XML version = "1.0"; Encoding = "UTF-8"? >



    <? import javafx.scene.layout. *? >

    <? import javafx.scene.control. *? >

    <? import javafx.scene. *? >

    <? import javafx.geometry.Side? >;

    <? importdummy.tree.MyTreeItem? >;



    < xmlns:fx VBox = "http://javafx.com/fxml" >

    < children >

    < showRoot TreeView = "false" fx:id = "treeView" >

    < root >

    < TreeItem value = 'Root' >

    < children >

    < MyTreeItem myvalue = "Node1" fx:id = "treeItemNode1" >

    < children >

    < TreeItem value = "none" / >

    < / children >

    < / MyTreeItem >

    < children >

    < / TreeItem >

    < / root >

    < / TreeView >

    < / children >

    < / VBox >



    Classes:



    package package dummy.tree;



    Import javafx.scene.control.TreeItem;



    SerializableAttribute public class MyTreeItem extends TreeItem {}



    public Object getMyvalue() {}

    Return super.getValue ();

    }

    public void setMyvalue (Object value) {}

    super.setValue (value);

    }



    }



    package dummy.tree;



    Import javafx.fxml.JavaFXBuilderFactory;

    Import javafx.util.Builder;

    Import javafx.util.BuilderFactory;



    Import dummy.tree.MyTreeItem;





    / public class MyJavaFXBuilderFactory implements BuilderFactory {}



    private JavaFXBuilderFactory javaFXBuilderFactory = new JavaFXBuilderFactory();



    class MyTreeItemBuilder implements {Builder < MyTreeItem >



    @Override

    public MyTreeItem build() {}

    return new MyTreeItem();

    }



    }



    @Override

    public Builder <>? getBuilder (class <>? clazz) {}

    If (clazz.equals (MyTreeItem.class)) {}

    return new MyTreeItemBuilder();

    }

    Return javaFXBuilderFactory.getBuilder (clazz);

    }



    }



    package dummy.tree;



    import java.io.InputStream;

    import java.net.URL;



    Import javafx.application.Application;

    Import javafx.fxml.FXMLLoader;

    Import javafx.fxml.JavaFXBuilderFactory;

    Import javafx.scene.Scene;

    Import javafx.scene.layout.Pane;

    Import javafx.scene.paint.Color;

    Import javafx.stage.Stage;



    SerializableAttribute public class MainWindowTree extends Application {}



    Public Shared Sub main (String [] args) {}

    Application.Launch (null);

    }



    @Override

    public void start (s phase) {}

    Location of the URL = getClass().getResource("/com/dbn/ui/theme/default/tree.fxml";);

    FXMLLoader fxmlLoader = new FXMLLoader();

    fxmlLoader.setLocation (rental);



    MyJavaFXBuilderFactory fxBuilderFactory = new MyJavaFXBuilderFactory();



    fxmlLoader.setBuilderFactory (fxBuilderFactory);

    InputStream inputStream = null;

    try {}

    inputStream = location.openStream ();

    Root = fxmlLoader.load (inputStream) (component) component;

    Scene = new scene (root, 800, 600, Color.TRANSPARENT);

    s.setScene (scene);

    s.Show ();

    } catch (Exception ex) {}

    ex.printStackTrace ();

    }

    }



    }

    Hello

    When you include the code (and the stack traces) in your forum messages, please include in a tag {code} as shown: https://forums.oracle.com/forums/ann.jspa?annID=1622 this makes it more easy for us all to read.

    Your code is sort of ok, but you have a lot of typos in your FXML and your Java code. Try searching for the code below instead. You don't actually have a constructor or by the way, it will work only without it.

    Try this FXML:

    
    
    
    
    
    
    
    
    
        
            
                
                    
                        
                            
                                
                                    
                                
                            
                        
                    
                
            
        
    
    

    With that for your item custom:

    package dummy.tree;
    
    import javafx.scene.control.TreeItem;
    
    public class MyTreeItem extends TreeItem
    {
        public Object getMyvalue()
        {
            return super.getValue();
        }
    
        public void setMyvalue(Object value)
        {
            super.setValue(value);
        }
    }
    

    And for launch:

    package dummy.tree;
    
    import javafx.application.Application;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    
    public class TestApp extends Application
    {
        public static void main(String[] args) throws Exception
        {
            launch(args);
        }
    
        public void start(Stage stage) throws Exception
        {
            Parent rootNode = FXMLLoader.load(getClass().getResource("/tree.fxml"));
            Scene scene = new Scene(rootNode, 800, 600);
            stage.setScene(scene);
            stage.show();
        }
    }
    

    Also, I guess it is just a test case, but you don't need to provide your own "myvalue" getters/setters when this is delegated to super. Just use the 'value' property directly in your FXML.

    A view Naming Convention, it should be myValue with getMyValue and setMyValue (e.g. capital 'V'). FXML is case-sensitive too, so if you change, you need to change your FXML for use myValue instead.

    Hope that helps,
    zonski

    Did you find this answer useful? If so, please mark it as 'Correct' or 'useful '.

  • How can I build and pass a variable to the function getField?

    I need to know how to build and pass a variable to the function getField():

    I have a form of several sections similar to a spreadsheet.  Each section contains 5 rows of 11 columns.  Currently I have calculations in the field I want to consolidate and move to the level of the document.  The field names in each column are identical except for a row identifier.  For example, in the 1st row: a_debtType1, a_debtTerm1, adebtRate1, etc.  I want to be able to pass to a function of level document line identifier and that connect a function "getField.  Here is an example:

    Document-level:

    function calculateLoan (lineNumber) {}

    var myDate = getField("a_debtType"+lineNumber).valueAsString;

    var myDate = getField("a_debtTerm"+lineNumber).valueAsString;

    .. few treatment

    return

    }

    Level of the form:

    change the information in the form is ready for line 1

    function calculateLoan("1");

    Thanks in advance for any help.

    It seems good except how you call the function of what you have. The calculation script should be something like:

    Custom calculate script

    calculateLoan("1");

    Note that you can also get the line number if it is contained in behalf of the field that calls the script if you don't disturb him passing as parameter, assuming you named the fields correctly.

    For example, to calculate the field is called "row_total.1", you can get the line number in the script like this:

    var no_lig = event.target.name.split(".") [1] ;

  • How to pass arguments to the SQL Script in command prompt

    I don't know about the ' & nom_de_variable "to request a value in the command line.

    But, how can I pass arguments from the command line for the following script to the command - prompt

    Example:

    ex_proc. SQL

    CREATE OR REPLACE PROCEDURE ex_proc (employee_id NUMBE IN)
    IS
    v_emp_id Number (38);
    BEGIN

    v_emp_id: = employe_id;

    UPDATE emp_employee SET sal = 2000 WHERE emp_id = v_emp_id;

    END;
    /


    call_ex_proc. SQL

    Appellant for procedure above:

    BEGIN

    ex_proc (100); -The employee id is 100.

    END;
    /

    Here are the General controls that we use to run the scripts above-

    SQL > @ex_proc.sql

    SQL > @call_ex_proc.sql



    But my requirement is to pass the employee id as an argument in the command line as.
    SQL > @call_ex_proc.sql 100

    Is it possible to pass command line arguments?

    Usually this question start with reading documentation, wouldn't it?

    Solomon Yakobson showed you the method gross and unreadable.

    You will use best

    set = '& 1' '.

    -use & in the rest of the code

    ----------
    Sybrand Bakker
    Senior Oracle DBA

  • Communication between two custom components

    Hello

    I have a problem to get action in a custom component to cause a refresh of another custom component?

    My configuration is:

    < application >

    < component includeIn custom 1 "View1" >

    < component custom 2 id = "custom2" level = "{level}" "view2" includeIn >

    < component custom an includeIn 'View1' >

    < component includeIn custom B "view2" >

    < / application >

    I have a number of custom components load in my main application window.

    In the custom component 1, I have a drop down menu which determines levels 1 to 10.

    When the user chooses a new level, change an event is triggered and the dispathed to the main application that receives it in the UpdateDisplayHandler.

    Component event dispatcher custom 1:

    protected function level_changeHandler(event:IndexChangeEvent):Sub

    {

    var newDisplay:UpdateDisplay = new UpdateDisplay ("UpdateDisplay", level.selectedItem.value);

    dispatchEvent (newDisplay);

    }

    Main application manager:

    protected function updateDisplayHandler(event:UpdateDisplay):Sub

    {

    Level = event.level

    }

    Level information comes to the manager who updates the "level" variable correctly. So far so good.

    The variable "level" is can be linked and analyzed for the custom component 2.

    < components: custom2 id = level "custom2" = "{level}" / >

    The question is how to make my component custom 2 refresh(), reload() then it makes again based on new information of level?

    I will be grateful for any help on this matter.

    Karsten

    Is probably not the cleanest way, but he's going to move you quickly.

    public var levelNumber:int = new int;

    implement

    private var _levelNumber:int;

    public function get levelNumber (): int

    {

    Return _levelNumber;

    }

    public function set levelNumber(value:int):void

    {

    If (value! = _levelNumber)

    {

    _levelNumber = value;

    call the custom here update refresh method

    }

    }

    I don't know your usecase or your architecture so there are probably better ways.

    Maybe like this:

    The main application event handler:

    protectedfunction updateDisplayHandler(event:UpdateDisplay):void

    {//check if there is a change in level and exposes a public service on the part 2}

    If (level! = event.level)

    {

    Level = event.level;

    COMPONENT2.updateOrRefreshBasedOnNewLevelValue (Level);

    }

    }

    HTH,

    Claudiu

  • Custom components &amp; help Webservice

    I built two custom, components based on a button and the other on a graph.

    The Web service has been defined with the following tag in the button component:

    " < mx:WebService id ="ws"wsdl =" http://localhost/Service1.asmx?WSDL « >
    < name mx:operation = "GetData" / >
    < / mx:WebService >

    I want to be able to add a listener for the chart (not the button) component that listens to the webservice result event and refresh the list. It will be a lot of buttons and many rankings for each graph must subscribe to result event of a particular call.

    The structure of my test application is something like this:

    < application >

    < button (call webservice here) >

    < chart (listener event result here) >

    < / application >

    I think it should be pretty simple, but I can't understand it. Any help would be greatly appreciated!

    Ivan

    you would have an arraycollection collection as the dataprovider for the chart component, just update that.

  • How to send a message between two custom components

    I have a datagrid in a custom cuomponent that is.

    < mx:Canvas id = "customerGrid".
    Width = '100% '.
    Height = "350" >
    < customer: CustomerGrid / >
    < / mx:Canvas >

    < customer: CustomerDetail / >

    The < customer: CustomerDetail / > has a TextInput. How to send a message to < customer: CustomerGrid / > to < customer: CustomerDetail / > when you click the datagrid control. When a user clicks the selectedItem I want this detail to display in the TextInput, which is in another component.

    I'm looking in Restaurant Finder sample. He uses exactly as I wanted to do. However, it uses a kind of AccessibleText. Is there somewhat easier to implement.

    Thank you

    One way to do this is to use the property data, most of the components inherit and use links between the custom grid and the detail view.


    Width = '100% '.
    Height = "350" >

    Now, in the light of the foregoing, I assumed that CustomerGrid is actually extending DataGrid, if this isn't the case, you will need to add additional logic to CustomerGrid. You will need to define a public property to the value of the selected item in the DataGrid inside the CustomerGrid and make it Bindable (see docs: metadata that can be related).

    Inside the CustomerDetail, bind the TextInput property data, by setting the property in the data object to which you want to display.

    Say the selectedItem (in the DataGrid) has a customerName field, you would do something like that (inside CustomerDetail).

Maybe you are looking for