Arrays in Custom Classes

The class below is in a document called (Node.as)
class Node {
private var _z = new Array();
public function Node(z) {
this._z[0] = z;
function getz(index) {
return this._z[index];
This is the actionscript of the main document
import Node;
//create line placeholders
var node0:Node = new Node(234);
trace(node0.getz(0));
var node1:Node = new Node(345);
trace(node0.getz(0));
var node2:Node = new Node(786);
trace(node0.getz(0));
Why does the trace yield completely different
numbers?????

In AS2, you have to instantiate the array in the constructor.
class Node {
private var _z:Array;
public function Node(z) {
this._z = new Array();
this._z[0] = z;
function getz(index) {
return this._z[index];

Similar Messages

  • Arrays within custom Classes - same array for different instances?

    Hello all,
    I have made a very simple custom class for keeping track of groups of offices for a company.  The class has a Number variable to tell it how many different offices there are, and an Array to store the individual offices by name.  It looks like this.
    class officeCluster
        static var _className:String = "officeCluster";
        // variables
        var numOffices:Number;
        var locationArray:Array = new Array();
        // functions
        function officeCluster()
            trace("officeCluster constructor");
    Very simple!
    Now, it is my understand that when I create different instances of the class, they will each have their own version of "numOffices" and their own version of "locationArray".
    When I run traces of "numOffices", this seems to be true.  For example,
    trace(manufacturingOfficeCluster.numOffices);
    trace(servicesOfficeCluster.numOffices);
    yields
    5
    4
    In the output panel, which is correct.  However, there is trouble with the locationArray.  It seems that as I assign different values to it, regardless of what instance I specify, there is only ONE array- NOT one for each instance.
    In other words,
    trace(manufacturingOfficeCluster.locationArray[1].theLocation);   // theLocation is a String.  The locationArray itself holds Objects.
    trace(servicesOfficeCluster.locationArray[1].theLocation);
    yields
    New Haven, CT
    New Haven, CT
    even though I have defined elsewhere that they are different!
    Is anyone aware of any issues partaining to using Arrays within Class instances?  Any help would be appreciated!
    note:  I've been able to work around this by creating multiple arrays within the class and using a different one for each instance, but this seems very sloppy.

    Unfortunately, the code segment you attached results in:
    12
    12
    in the output panel.   So the problem must lie elsewhere!  Let me give some more detail...
    There are several files involved. The "officeCluster" class file looks like this:
    class officeCluster
         static var _className:String = "officeCluster";
         // variables
         var numOffices:Number;
         var locationArray:Array = new Array();
         // functions
         function officeCluster()
            trace("officeCluster constructor");
    I have two actionscript files which contain object data for the individual offices.  They look like this...
    var servicesOfficeCluster = new officeCluster();
    servicesOfficeCluster.numOffices = 4;
    var newHope:Object = new Object();
    newHope.locationName = "New Hope Office";
    newHope.theLocation = "New Hope, NJ";
    //more data
    servicesOfficeCluster.locationArray[0] = newHope; //array index is incremented with each entry
    //more Objects...
    and like this...
    var manufacturingOfficeCluster = new officeCluster();
    manufacturingOfficeCluster.numOffices = 5;
    var hartford:Object = new Object();
    hartford.locationName = "Hartford Office";
    hartford.theLocation = "Hartford, CT";
    //more data
    manufacturingOfficeCluster.locationArray[0] = hartford; //array index is incremented with each entry
    //more Objects...
    As you can see, the only difference is the name of the officeCluster instance, and of course the Object data itself.  Finally, these are all used by the main file, which looks like this- I have commented out all the code except for our little test -
    import officeCluster;
    #include "manufacturingList.as"
    #include "servicesList.as"
    /*lots of commented code*/
    manufacturingOfficeCluster.locationArray[1].theLocation = "l1";
    servicesOfficeCluster.locationArray[1].theLocation = "l2";
    trace(manufacturingOfficeCluster.locationArray[1].theLocation);
    trace(servicesOfficeCluster.locationArray[1].theLocation);
    Which, unfortunately, still yields
    12
    12
    as output :\  Any ideas?  Is there something wrong with the way I have set up the class file?  Something wrong in the two AS files?  I'm really starting to bang my head against the wall with this one.
    Thanks

  • Creating custom class instances for XML nodes

    Hi guys,
    I'm trying to load an external XML document in my application
    and create an instance of a custom class for each node in the XML
    based on the value of some of their elements. The instances created
    will eventually end up in a DataGrid by the way. The problem I'm
    having is there seems to be many ways of doing small parts of this
    and I have no idea how to make them all gel. Initially I'm using
    HTTPService to load the XML file but I've seen people just use an
    XML object. Then, after that, I initially set the loaded XML to an
    ArrayCollection but others have used XMLList or XMLListCollection.
    I've no idea what's the best way to do this.
    Eventually, when I've created all of these instances by
    looping over the XML and creating them how will I make them
    bindable to the data grid? I'm guessing I'll have to group them
    somehow...
    Any help would be greatly appreciated. Thanks

    Hey Tracy,
    That is exactly what I was talking about in a previous post
    you replied to
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=585&threadid=1344350
    Anyhow, Below is some code I created to do what your saying
    somewhat dynamically. The idea being you can have many different
    object types that you may want to populate with data from XML. In
    my case I am using e4x as the result type from my web services. At
    present I have about 6 different classes that call this function.
    I'd love to get some opinions on the function. Good bad or
    ???? Any improvements etc????
    package . . . .
    import flash.utils.describeType;
    import flash.utils.getDefinitionByName;
    import flash.utils.getQualifiedClassName;
    import mx.utils.ObjectUtil;
    * Utility class to convert xml based Objects to class
    instances.
    * Takes a value object as the destination and an xmlList of
    data
    * Look through all the items in the value object. Note we
    are using classInfo..accessor since
    * our objects are bound all variables become getter /
    setter's or accessors.
    * Also note, we can handle custom objects, arrays and
    arrayCollections.
    * History
    * 03.11.2008 - Steven Rieger : Created class
    public final class XMLToInstance
    public static function xmlToInstance( destinationObject :
    Object, sourceXMLList : XMLList ) : void
    // Get the class definition in XML, from the passed in
    object ( introspection so to speak )
    var classInfo : XML = describeType( destinationObject );
    // Loop through each variable defined in the class.
    for each ( var aVar : XML in classInfo..accessor )
    // If this is String, Number, etc. . . Just copy the data
    into the destination object.
    if( isSimple( aVar.@type ) )
    destinationObject[aVar.@name] = sourceXMLList[aVar.@name];
    else
    // Dynamically create a class of the appropriate type
    var className : String = aVar.@type;
    var ObjectClass : Class = getDefinitionByName( className )
    as Class;
    var newDestObject : Object = Object( new ObjectClass());
    // If this is a custom type
    if( isCustomType( className ) && ObjectClass != null
    // Recursively call itself passing in the custom data type
    and the data to store in it.
    // I haven't tested nested objects more than one level. I
    suppose it should work.
    // Note to self. Check.
    xmlToInstance( newDestObject, sourceXMLList[aVar.@name] );
    else
    // Must be some sort of Array, Array Collection . . .
    if( ObjectClass != null )
    var anXMLList : XMLList = new XMLList(
    sourceXMLList[aVar.@name] );
    for each( var anItem : XML in anXMLList )
    // I'm sure there are more types, just not using any of them
    yet.
    if( newDestObject is Array )
    newDestObject.push( anItem )
    else
    newDestObject.addItem( anItem );
    // Add the data to the destination object. . . .
    destinationObject[aVar.@name] = newDestObject;
    } // end function objectToInstance
    public static function isSimple( dataType : String ) :
    Boolean
    * This function is pretty self explanatory.
    * Check to see if this is a simple data type. Did I miss
    any?
    * History
    * 03.11.2008 - Steven Rieger : Created function
    switch( dataType.toLowerCase() )
    case "number":
    case "string":
    case "boolean":
    return true;
    return false;
    } // end isSimple
    public static function isCustomType( className : String ) :
    Boolean
    * This function is pretty self explanatory.
    * Check to see if this is a custom data type. Add them here
    as you need. . .
    * History
    * 03.11.2008 - Steven Rieger : Created function
    var aClassName : String = className.replace( "::", "."
    ).toLowerCase();
    aClassName = aClassName.substr( aClassName.lastIndexOf( "."
    ) + 1, aClassName.length - aClassName.lastIndexOf( "." ) );
    switch( aClassName )
    case "ndatetimevo":
    case "expenselineitemvo":
    return true;
    return false;
    } // end isCustomType
    } // end class
    } // end package

  • Unit testing: Mocking custom classes with null

    Hi,
    I was trying to save time on testing the usual hashCode() and equals() methods so I got this class: http://www.cornetdesign.com/files/BeanTestCase.java.txt
    I altered it a bit as it wasn't handling standard classes only primitives.
    Anyway, I got to the point to include my own custom classes.
    I have to create a 'mock' object for my class properties, e.g. field.getType().newInstance()
    Fine, but there are some tricky instances. E.g. when I'd like to create an instance of java.net.URL which takes a URL as String in the constructor.
    This is almost impossible to automate as it has to be a valid URL format not just a random String.
    So, I thought I set them to null, e.g.
    assertTrue(o1.equals(o2))
    as both properties are null.
    Is this the right approach you think?
    I welcome any suggestions.
    My initial idea was to save enormous amount of time automating the hashCode() and equals() method tests as they took so long to write.
    Thanks

    Trouble would be that you are only testing the null branch of the equals or hashCode, which typically have to check for null, then if not null do an actual comparison.
    It's worth the effort of learning to use a package such as EasyMock to create and program mock objects. It's tidiier if you are progamming to interfaces, however, but it will mock ordinary objects, though probably not if they are final.
    What you could do is to define a factory interface, and have a table of anonymous classes wich generate various types. In effect create a library of dumy object factories.
    Something like:
    private interface DummyGenerator {
          Object generate(int idx);
          Class<?> getType();
    private final static DummyGenerator[] generatorsTable {
        new DummyGenerator() {
               public Object generate(int idx) {
                 return new URL("http://nowhere.com/" + idx);
         public Class<?> getType() { return URL.class; }
    .. generators for other classes
    private final static Map<Class<?>, DummyGenerator> genMap = new HashMap<Class<?>, DummyGenerator>(generatiorsTable.length);
    static {
        for(DummyGenerator gen : generatorsTable)
            genMap.put(gen.getType(), gen);
    }

  • Need help calling and looping custom classes

    Hi, I am writing a code with custom classes in it and another program that calls upon all of the classes in the first program. I can get the second one (L6) to call upon and execute all of the classes of the first (Foreign). However, I need the second one to loop until quit is selected from the menu on Foreign and I can't seem to figure out how to do it. Here are the codes:
    L6:
    public class lab6
    public static void main(String[] args)
    Foreign camount = new Foreign();
    camount = new Foreign();
    camount.get();
    camount.print();
    camount.intake();
    camount.convert();
    camount.vertprint();
    System.out.println(camount);
    Foreign:
    import java.util.Scanner;
    public class Foreign
    private String country;
    private int choice;
    private float dollars;
    private float conversionValue;
    private float conversionAmount;
    public Foreign()
    country = "null";
    choice = 0;
    dollars = 0;
    conversionValue = 0;
    conversionAmount = 0;
    public void get()
         Scanner Keyboard = new Scanner(System.in);
              System.out.println("Foreign Exchange\n\n");
    System.out.println("1 = U.S. to Canada");
    System.out.println("2 = U.S. to Mexico");
    System.out.println("3 = U.S. to Japan");
    System.out.println("4 = U.S. to Euro");
    System.out.println("0 = Quit");
    System.out.print("\nEnter your choice: ");
    choice = Keyboard.nextInt();
    public void print()
    System.out.print("\nYou chose " + choice);
    public void intake()
         Scanner Keyboard = new Scanner(System.in);
              if (choice >= 1 && choice <= 4)
    switch (choice)
              case 1: System.out.println("\nU.S. to Canada");
                        conversionValue = 1.1225f;
                        country = ("Canadian Dollars");
                        break;
              case 2: System.out.println("\nU.S. to Mexico");
                        conversionValue = 10.9685f;
                        country = ("Mexican Pesos");
    break;
              case 3: System.out.println("\nU.S. to Japan");
                        conversionValue = 118.47f;
                        country = ("Japanese Yen");
    break;
              case 4: System.out.println("\nU.S. to Euro");
                        conversionValue = 0.736377f;
                        country = ("European Union Euros");
    break;
                   System.out.print("\nEnter U.S. dollar amount: ");
              dollars = Keyboard.nextFloat();
    public void convert()
    conversionAmount = conversionValue * dollars;
    public void vertprint()
    System.out.println("\nCountry = " + country);
    System.out.println("Rate = " + conversionValue);
    System.out.println("Dollars = " + dollars);
    System.out.println("Value = " + conversionAmount);
    public String toString()
    String line;
    line = "\n" + country + " " + conversionValue + " " + dollars + " " + conversionAmount;
    return line;
    I appreciate any help anyone can give me. This is driving me crazy. Thanks.

    1. first you need to write method to get choice value from Foreign class.
    simply add this method.
       public class Foreign {
          // ... Add this
          public int getChoice() {
             return choice;
       }2. Then in your main, you can obtain with previos method.
    public static void main(String[] args) {
       Foreign camount = new Foreign();
       // remove this. you alredy create an instance in last statement.
       //camount = new Foreign();
       int choice = 0;
       do {
          camount.get();
          choice = camount.getChoice();
          // your process...
       } while (choice != 0);
    }

  • Use of deployment classpath or shared-libraries to pick-up "custom" classes

    Hi,
    I’m trying to determine an approach to dealing with how classes are found in a deployed ADF application via classpath, etc. I’ve tried to explain the situation below as best I can so it’s clear. If you have any comments/suggestions as to how this could be done, it would be much appreciated
    Current Application structure:
    Consists of an application initially deployed to OC4J 10.1.3.4 using an alesco-wss.ear file
    Application contains a single Web Module, initially deployed as wss.war file within the alesco-wss.ear file above.
    The Web Module (wss) was built in JDeveloper 10.1.3.4 using 2 projects, a Model and ViewController project, and uses ADFBC.
    The Model project seems to also generate an alesco-model.jar file in the /WEB-INF/lib/ folder, even though Model classes are in the /WEB-INF/classes/ folder below?
    Exploded structure of application on application server looks something like:
    applications/alesco-wss/META-INF/
    /application.xml <- specifies settings for the Application such as Web Module settings
    /wss/
    /app/ <- directory containing application .jspx pages protected by security
    /images/ <- directory containing application images
    /infrastructure/ <- directory containing .jspx files for login, logout and error reduced security
    /skins/ <- directory containing Skin image, CSS and other files
    /WEB-INF/
    /classes/ <- directory containing application runtime class files as per package sub-directories
    /lib/ <- JAR files used by application (could move some to shared-libaries?) – seems to contain alesco-model.jar
    /regions/ <- directory containing .jspx pages used for Regions within JSPX template page
    /templates/ <- directory containing template .jspx pages used for development (not really required for deployment)
    /adf-faces-config.xml
    /adf-faces-skins.xml
    /faces-config.xml
    /faces-config-backing.xml
    /faces-config-nav.xml
    /region-metadata.xml
    /web.xml
    testpage.jspx <- Publicly accessible page just to test
    The application runs successfully using the above deployment structure.
    We plan to use the exploded deployment structure so that updates to pages, etc. can be applied individually rather than requiring construction and re-deployment of complete .EAR or .JAR files.
    What I’m trying to determine/establish is whether there is a mechanism to cater for a customisation of a class, where such a class would be used instead of the original class, perhaps using a classpath mechanism or shared library?
    For example, say there is a class “talent2.alesco.model.libraries.ModelUtil.class”, this would in the above structure be found under:
    applications/alesco-wss/META-INF/classes/talent2/alesco/model/libraries/ModelUtil.class
    Classes using the above class would import “talent2.alesco.model.libraries.ModelUtil”, so they effectively use that full-reference to the class (talent2.alesco.model.libraries as a path, either expanded or within a JAR).
    From the Oracle Containers for J2EE Developer’s Guide 10.1.3 page 3-17, it lists the following:
    Table 3–1 Configuration Options Affecting Class Visibility
    Classloader Configuration Option
    Configured shared library <code-source> in server.xml
    <import-shared-library> in server.xml
    app-name.root <import-shared-library> in orion-application.xml
    <library> jars/directories in orion-application.xml
    <ejb> JARs in orion-application.xml
    RAR file: all JARs at the root.
    RAR file: <native-library> directory paths.
    Manifest Class-Path of above JARs
    app-name.web.web-mod-name WAR file: Manifest Class-Path
    WAR file: WEB-INF/classes
    WAR file: WEB-INF/lib/ all JARs
    <classpath> jars/directories in orion-web.xml
    Manifest Class-Path of above jars.
    search-local-classes-first attribute in orion-web.xml
    Shared libraries are inherited from the app root.
    We have reasons why we prefer not to use .JAR files for these “non-standard” or “replaced” classes, so prefer an option that doesn’t involve creating a .JAR file.
    Our ideal solution would be to have such classes placed in an alternate directory that is referred to in a classpath such that IF a class exists in that location, it will be used instead of the one in the WEB-INF/classes/ directories, and if not such class is found it would then locate it in the WEB-INF/classes/ directories.
    - Can a classpath be set to look for such classes in a directory?
    - Do the classes have to replicate the original package directory structure within that directory (<dir>/talent2/alesco/model/libraries)?
    - If the class were put in such a directory, without replicating the original package directory structure, I assume the referencing “import” statements would not locate it correctly.
    - Is the classpath mechanism “clever” enough to search the package directory structure to locate the class (i.e. just points to <dir>)?
    - Or would the classpath mechanism require each individual path replicating the package structure to be added (i.e. <dir>/talent2/alesco/model/libraries/ and any other such package path)?
    If we are “forced” to resort to the use of JAR files, does a JAR file used for the purpose of overwrite/extending a sub-set of classes in the original location need to contain ALL related package classes? Or does it effectively “superset” classes it finds in all JAR files, etc. in the whole classpath? That is, it finds talent2.alesco.model.libraries.ModelUtil in the custom.jar file and happily goes on to get the remainder of talent2.alesco.model.libraries classes in the other core JAR/location. Or does it need all of them to be in the first JAR file for that package?
    Any help would be appreciated to understand how these various class visibility mechanisms could be used to achieve what is required would be appreciated.
    Gene

    So, nobody's had any experience with deploying an ADF application, and providing a means for a client to place custom classes in such a way as they're used in preference to the standard application class, effectively to implement a customised class without overwriting the original "standard" class?
    Gene

  • Add button to a datagrid with custom class

    Hi.
    I have a custom class that i put in the dataprovider to a datagrid. And when i column with buttons i get the following error.
    ReferenceError: Error #1069: Property null not found on COMPONENTS.Output.OutputFile and there is no default value.
    at mx.controls::Button/set data()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\Button.as:873]
    at mx.controls::DataGrid/http://www.adobe.com/2006/flex/mx/internal::setupRendererFromData()[E:\dev\3.0.x\framework s\projects\framework\src\mx\controls\DataGrid.as:1646]
    at mx.controls::DataGrid/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\m x\controls\DataGrid.as:1606]
    at mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\ mx\core\UIComponent.as:5670]
    at mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framewor k\src\mx\managers\LayoutManager.as:519]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:669]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
    at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]
    What shuld i do?
    Thanks for help.

    If you are talking SE54 and Maintenance Views, when I do an SM30 on the Maintenance View and do SYSTEM->STATUS, I see GUI STATUS ZULG on program SAPLSVIM.  If you look at that status, I see two buttons with dynamic text.  The first one is call GPRF and has dynamic text VIM_PR_STAT_TXT_CH.  You can find a suitable PBO event to set the text of that function code and if that works, find a suitable PAI event to respond to that function.
    I recall finding some documentation on customizing the GUI STATUS but no luck today trying to find it.
    Let us know how it goes.

  • Xcode 6.1.1 Custom Class Outlets Missing

    I'm running through the basic Apple tutorial on iOS App Development https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapi OS/index.html#//apple_ref/doc/uid/TP40011343-CH2-SW1
    Running Xcode Version 6.1.1 (6A2008a)
    After creating custom View Controller and TableView Controller classes (Tutorial:Storyboards) I find that although the .m files appear in Build Phases they do not appear in the drop down menu for custom class.  If I enter the name manually it correctly opens the .h files when clicking on the right arrow to the right of the custom name.
    The standard outlets of View Controller (Search Display Controller & View), do not appear in the connections inspector of the custom class.
    A test IBAction method does not appear as an option when connecting a Bar Button Item to the Exit object of the Custom View Controller.
    Searching the internet for a solution I can find lots of similar stories with random work arounds, none of which have worked for me.  However, most of these have been for previous versions of Xcode and one user reported that upgrading to 6.1 solved the problem.
    I have redone this a few time to ensure that it isn't finger trouble and I do have a number of years of cocoa/Xcode experience, I'm just getting used to storyboards.
    I have tried:
    Clean project / Delete Derived Data / Relaunch Xcode
    Delete references to .h & .m files of custom classes and then added them back in.
    Is there any way of 'forcing' Xcode to recheck for Outlets and Actions in custom classes?

    To find out where th problem is,  either Xcode or something in your environment, you should try to run Xcode as a different user.
    The guest account is ideal for this as your are sure you will get a clean environment. You could also make a new user account and try running from there. If Xcode starts then the problem is something in your original user environment. If Xcode fails to stsrt with the new account then there is a system wide problem.
    BTW is your account an admin account or a regular account?
    regards

  • Build app with ODT and Oracle UDT - Error while creating custom class

    Hello CShay,
    I am testing you sample code to create UDT with ASP.Net app. It is also published in Oracle magazine.
    The article is also published at following link:
    http://www.oracle.com/technology/oramag/oracle/08-may/o38net.html
    I am able to successfully implement all the steps before "Using Custom Class Wizard". When I right click on any of the object (CUSTOMER_OBJ, PHONELIST_OBJ, and ADDRESS_OBJ) and select Generate Custom Class, I get the following error:
    Oracle custom class wizard.
    Class can be generated only for either C#, VB or Managed C++ projects.
    Am I missing any thing?
    Thanks in advance for your help.

    Yes I confirm that I choose File->New Website.
    I don't see the following option
    File -> New Project, and then under Visual C#, select ASP.NET Web Application
    I am using VS2005 Professional Edition.
    The options I see under Visual C# are:
    If I click on
    Windows tab:
    Windows Application
    Windows Control Library
    Console Application
    Empty Project
    Class Library
    Web Control Library
    Window Servcie
    Crystal Report Application
    and Search Online Templates in My Templates tab.
    Couple of options for Smart Device which also doesn't include ASP.Net
    then Database, Starter kits and Office tabs which also doesn't include ASP.net thing.
    I don't know how did you see that option or you might be using different version of VS (Enterprise).
    But right now I am stuck.
    Please provide me your valuable comments.
    Thanks for your help.

  • Calling an array from another class

    Ok I have this little program that I created to display values stored in an array. Well, I want my array to automatically be populated with the same values that are in another array that resides in a different class. Here is my code for the class that I want the values to be displayed:
    import javax.swing.*;
    import java.awt.*;
    public class GUIRead extends JFrame
         double[] interest = new double[3];
         MemicCSVReader[] interestObjectArray = new MemicCSVReader[3];
         interestObjectArray[0] = new MemicCSVReader();
         interestObjectArray[1] = new MemicCSVReader();
         interestObjectArray[2] = new MemicCSVReader():
         for(int x = 0; x < 3; x++)
         JPanel display = new JPanel();
         JTextField interestText = new JTextField(10);
         JPanel display2 = new JPanel();
         JTextField interestText2 = new JTextField(10);
         JPanel display3 = new JPanel();
         JTextField interestText3 = new JTextField(10);
         public GUIRead()
              super("Test");
              setSize(160,200);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
              GridLayout config = new GridLayout(3,1);
              FlowLayout config2 = new FlowLayout(FlowLayout.LEFT,10,10);
              Container pane = getContentPane();
              pane.setLayout(config2);
              display.setLayout(config2);
              display.add(interestText);
              interestText.setText(interest[0]);
              interestText.setEditable(false);
              pane.add(display);
              display2.setLayout(config2);
              display2.add(interestText2);
              interestText2.setText(interest[1]);
              interestText2.setEditable(false);
              pane.add(display2);
              display3.setLayout(config2);
              display3.add(interestText3);
              interestText3.setText(interest[2]);
              interestText3.setEditable(false);
              pane.add(display3);
              setContentPane(pane);
         public static void main(String[] args)
              GUIRead run = new GUIRead();
    Here is my code that I want the double[] interest array to pull it's data from:
    public class MemicCSVReader
         double interestArray[];
         MemicCSVReader()
              String[] interestString = {"5.5","5.35","5.75"};
              for(int x = 0; x < 3; x++)
                   interestArray[x] = Double.parseDouble(interestString[x]);
    }

    Ok, thanks for your help. Now I have another problem. I can't get the values to display. Here is my code:
    This is the program that runs the application:
    import javax.swing.*;
    import java.awt.*;
    public class GUIRead extends JFrame
         MemicCSVReader readCSV = new MemicCSVReader();
         double[] interestDouble = readCSV.getInterestArray();
         String[] interest;
         JPanel display = new JPanel();
         JTextField interestText = new JTextField(10);
         JPanel display2 = new JPanel();
         JTextField interestText2 = new JTextField(10);
         JPanel display3 = new JPanel();
         JTextField interestText3 = new JTextField(10);
         public GUIRead()
              super("Test");
              setSize(160,200);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
              GridLayout config = new GridLayout(3,1);
              FlowLayout config2 = new FlowLayout(FlowLayout.LEFT,10,10);
              Container pane = getContentPane();
              pane.setLayout(config2);
              display.setLayout(config2);
              display.add(interestText);
              interestText.setEditable(false);
              pane.add(display);
              display2.setLayout(config2);
              display2.add(interestText2);
              interestText2.setEditable(false);
              pane.add(display2);
              display3.setLayout(config2);
              display3.add(interestText3);
              interestText3.setEditable(false);
              pane.add(display3);
              setContentPane(pane);
         public void actionPerformed()
              for(int x = 0; x < 3; x++)
                   interest[x] = Double.toString(interestDouble[x]);
              interestText.setText(interest[0]);
              interestText2.setText(interest[1]);
              interestText3.setText(interest[2]);
         public static void main(String[] args)
              GUIRead run = new GUIRead();
    This is the file that it pulls the array from:
    public class MemicCSVReader
         private double[] InterestArray = new double[3];
         MemicCSVReader()
              double[] InterestArray = {5.5,5.35,5.75};
         public double[] getInterestArray()
              return InterestArray;
    }

  • Reproducing Incident Form Elements in a Custom Class

    Hello again everyone,
    I am trying to rollout a completely separate module in SCSM to record MACD (Move/Add/Change/Delete) requests. I decided to use the OOB incident module as my base class as it already contained many fields I require (I inherited the properties
    and relationships) and created a new form assembly in Visual Studio to wire the properties to.
    After created the form and labels, I imported the .dll into the Authoring Tool so I can just drag out each property from the MP explorer onto the form. Everything works except for the last few fields which are a bit more complex than a standard list or textbox.
    I cannot seem to add the controls for the more complicated items like "Affected Services" or "Affected Items", when I try to drag them out to the form I get an error saying cardinality is not set to 1... I am guessing this is because
    its trying to map a relationship between a workitem and a service instead of my custom class and a service...
    So I went back into Visual Studio and added a ListView to the form, thinking I will have to wire the data bindings inside the form itself. However, I am stuck as I am not sure where "Services" are being written to, as I will need this location
    to reference in my empty ListView. I have provided my code and commented where I believe I am missing logic. Thank you in advance for any help!
    Note: "servicerelatestoworkitem" is not actually an object, my logic is conceptual and I still have not found which class/object the list of services is being written to.
    C# Code containing button logic (an add button to add a service to the ListView, and a delete button to remove a service from the ListView.
    private void add_services_button_Click(object sender, RoutedEventArgs e)
       // Open list of Services here, allow user to pick a service, then add selected service to "servicerelatestoworkitem"
       // AffectedServicesListView is populated from servicerelatestoworkitem
    private void del_services_button_Click(object sender, RoutedEventArgs e)
        // Test to see if item is being selected and display selected item to confirm ability to manipulate variable
        try
            var itemSelected = ListView.GetIsSelected(AffectedServicesListView);
            MessageBox.Show(itemSelected.ToString());
        catch (Exception ex)
            MessageBox.Show(ex.Message);
        // Remove selected item from servicerelatestoworkitem and refresh AffectedServicesListView
    XAML Code containing the list view and two buttons: (Note: The binding is most likely incorrect, I was just experimenting with it)
    <ListView x:Name="AffectedServicesListView" HorizontalAlignment="Left" Height="95" Margin="10,414.6,0,0" VerticalAlignment="Top" Width="521" ItemsSource="{Binding Path=AffectedServicesListView, Mode=Default, UpdateSourceTrigger=PropertyChanged}">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn/>
                                </GridView>
                            </ListView.View>
                        </ListView>
                        <Button x:Name="add_services_button" Content="" HorizontalAlignment="Left" Margin="470.55,382.749,0,0" VerticalAlignment="Top" Width="27.674" Height="26.851" Click="add_services_button_Click" BorderBrush="{x:Null}">
                            <Button.Background>
                                <ImageBrush ImageSource="add.png"/>
                            </Button.Background>
                        </Button>
                        <Button x:Name="del_services_button" Content="" HorizontalAlignment="Left" Margin="503.224,382.749,0,0" VerticalAlignment="Top" Width="27.776" Height="26.851" Click="del_services_button_Click" BorderBrush="{x:Null}">
                            <Button.Background>
                                <ImageBrush ImageSource="delete.png"/>
                            </Button.Background>
                        </Button>

    Cardinality is a property of relationships classes, not a property of specific relationships. each type of relationship has it's own cardinality values, but the engine only really recognizes "one" and "many". it makes sense to say that
    the "affected user" relationship is many to one, because Each work item can have one and only one affected user, but each users may be the affected user of many work items. The Related work items relationship is a many to many, because each workitem
    may be related to many other work items. it doesn't make sense to say this specific relationship between this IR and that user is "many to one", because each instance is only between one specific object and another specific objects. the cardinality
    just controls how many of those specific relationships instances can exist for each type of relationship. 
    There are no out of the box controls for many to many relationships. the Instance Picker control is designed to support one to one and many to one relationships. you'd have to write your own controls for support many to one relationships. Consider Travis
    Wright's SR Example for 2010, since most of this code should execute in 2012 and 2012r2 with only minor modifications. 
    You'd have to either find the control that defines it, like with the history tab, or recreate it using the
    authoring tool or
    Visual Studio. 

  • Capture Customer Class in time of BP creation from Screen

    Hi All,
    I am facing a problem that I need to capture  Customer Class , Sales Area Template and ID type in time of BP creation in DCHCK event. I have to check if user is putting these value correctly or not. If user entered wrong value then I have to through error message and not to save to BP.
    Foe example I am using 'BUP_BUPA_BUT000_GET' to get all other data along with BP type and so on.
    Plesae help regarding this if any one is aware of it.
    Thanks & Regards
    Ajoy

    Hi,
    asaha... I want to know how it would be done ?
    by ABAP customization or in the CRM IMG itself ?
    can you brief about it ..
    Thanks
    " RA "

  • SE24 or In-line Declaration of Custom Class to be Used in a Custom Exit ???

    After our implementation of a custom screen in EXIT_SAPLIE01_007, the function-group XQSM contained the following custom elements:
    XQSM
        Function Modules
          EXIT_SAPLIE01_007     (this just includes ZXQSMU06)
        PBO Modules
          STATUS_9000
        PAI Modules
          USER_COMMAND_9000
        SCREENS
          9000                  (custom screen (modal dialog box))   
        GUI_STATUS
          9000                  (status for custom screen) 
        INCLUDES
          ZXQSMI01              (contains PAI module) 
          ZXQSMO01              (contains PBP module)
          ZXQSMTOP              (declares custom global variables)
          ZXQSMZZZ              (this just includes ZXQSMI01/ZXQSMO01
          ZXQSMU06              (this calls custom screen 9000)
    Then the users decided they wanted an editable ALV on custom screen 9000 (to handle multi-item GR postings in MIGO, not just single-item postings.)
    Since I never coded an editable ALV before, I first created a working editable ALV program from the SAP demo program BCALV_EDIT_03 plus some additions/modifications kindly provided by Uwe Schieferstein down in the ABAP Objects Forum.
    But now I'm stuck because I don't know which components of the XQSM function group I should put the following pieces of code in:
    1)
    class lcl_event_receiver definition deferred.
    data: g_event_receiver type ref to lcl_event_receiver.
    2)
    class lcl_event_receiver definition.
      public section.
      private section.
    endclass.
    3)
    class lcl_event_receiver implementation.
    endclass.
    Can someone please tell me where (1-3) belong inside XQSM - what components they should be put into?
    Or should I just build a custom class in SE24 and use it in the exit ???  (By "use it", I mean instantiate it and call its methods.)
    It seems to me that if I could define the class in SE24,it would be a lot easier, because everything else except (1-3) above clearly belongs in the PBO or PAIof the screen.

    Hello David
    In thread
    how to activate or deactivate a user-exit based a specific condition
    I have described a general strategy for implementing CMOD/SMOD exits. In your case, I would create a function group <b>ZXQSM</b> having two function modules:
    - <b>Z_EXIT_SAPLIE01_007</b> (= copy of EXIT_SAPLIE01_007) => calls the following fm
    - <b>Z_EXIT_SAPLIE01_007_SPEC</b> (-> specific exit that is executed only if certain conditions are fulfilled
    All you implementations for you editable ALV grid belong into your customer function group ZXQSM.
    Regards
      Uwe

  • Problem Using Custom Classes in UCCX8.5.1 SU3

    Dear All,
    My team is facing problem in using Java custom classes for UCCX 8.5.1 SU3
    The problem is that we have created some conditional prompts for currency in different languages, our custom java class contains two mathods GetEnglishString(parameter set) and GetUrduString(parameter set). We are able to use/call both methods one by one and both at same time in CCX Editor and validate the script successfully but when we set the script as application it failed.
    We tried to use both methods one by one and found that script with GetEnglishString is working ok but when we place GetUrduString (alone as well) MIVR logs say that method is unknown altough CCX Editor does not give us any error. We triend to restard Administration and Engine Services several time but to no avail. If somebody know the reason and solution kindly share it ASAP.
    Regards
    Kashif Surhio

    Hi
    In that case I would double check you have uploaded the file, and restart the server completely. In testing we found that restarting the engine didn't always reload the classes.
    Aaron

  • Parsing XML in a Custom Class Problem

    Hi, I am trying to parse an XML file from a class within my web app. It isn't a servlet, just a custom class to parse the xml.
    However, I keep getting a null document printed when I try to print the document to the log file. This is the class:public class XMLParser
         Document document;
         public XMLParser()
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setValidating(true);
              factory.setNamespaceAware(true);
              try
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   document = builder.parse(new File("SiteDescriptor.xml"));
              catch(SAXException sxe)
                   // Error generated during parsing
                   Exception x = sxe;
                   if(sxe.getException() != null)
                        x = sxe.getException();
                   x.printStackTrace();
              catch(ParserConfigurationException pce)
                   pce.printStackTrace();
              catch(IOException ioe)
                   ioe.printStackTrace();
              System.out.println("\n\n\n\n\n\n\n"+document+"\n\n\n\n\n");
    }I know this code works as I use the exactly the same code in another application with the same XML file.
    This is the XML file:
    <root host="http://localhost:8080">
         <branch name="Home Page" shortname="/" type="Home Page" instanceid="44987" typeid="1227">
              <branch name="Films Archive" shortname="/films" type="Branch" instanceid="96354" typeid="1778">
                   <leaf name="Evil Dead" shortname="/films/evil_dead" type="Films" instanceid="58985" typeid="1147"/>
                   <leaf name="1984" shortname="/films/1984" type="Films" instanceid="49741" typeid="1147" />
              </branch>
         </branch
    </root>And this is what I get when i print the document to the log file:
    [#document: null]
    Does anyone know why I cant get the class to read the document? I'm not getting any file not found exceptions or any other errors in the log.
    Cheers,
    Paul

    Hi duffymo, I have tried as you suggested. I created a ServletContextListener implementation and in my web.xml file I have defined the XML file as a <context-param> and I have also defined the listener.
    The ServletContextListener implementation creates the XML file as a resource using getResourceAsStream() and passes the InputStream to my parser. However, the parser still doesn't seem to work and prints out a null document in the log file: [#document: null]. Any ideas??
    The web.xml file:
               <context-param>
              <param-name>siteDescriptor</param-name>     
              <param-value>/WEB-INF/SiteDescriptor.xml</param-value>
         </context-param>
              <listener>
              <listener-class>cms.beans.InitializeXML</listener-class>
         </listener>
    ......and the ServletContextListener is:
    public class InitializeXML implements ServletContextListener
         static InputStream in = null;
         public void contextInitialized(ServletContextEvent sce)
              ServletContext context = sce.getServletContext();
              String siteDescriptor = context.getInitParameter("siteDescriptor");
              try
                   in = context.getResourceAsStream(siteDescriptor);
              catch(Exception e)
                   context.log("Error creating xml resource: " + e);
         public void contextDestroyed(ServletContextEvent sce)
         public static InputStream getXMLResource()
              return in;
    }Thanks,
    Paul

Maybe you are looking for

  • Can we remove the default status field from OIM

    hi, even when my i am not mapping any field to the OIM status field , it is taking Active as default value. i dont require that field so is it possible to remove the default status field of OIM. i am using database GTC connector for trusted recon.

  • MacMini as media center with eyeTV

    I'm trying to collect some facts and thoughts about the idea of using the MacMini as a media center at home. There seems to be some hard feelings regarding FrontRow 2.0 in Leopard, but I can't see that they would have any greater impact in the set up

  • Inventory Qty & Value posting.

    I am creating a delivery note on which the delivery date is say 20 dec 08, and posting date is 15 jan 09 Therefore, The value of inventory is posted on 15 jan and qty is reduced on 20 dec ... right ? (At least if we look at the  inventory posting and

  • How do I take away the security lock screen?

    My Airbook has a security lock for certain websites which I did not set.  How do I take it away?  My apple ID password is not working.

  • Please could someone confirm the Graphics card needed to support a Eizo ColorEdge CG275W monitor, resolution 2560x1440

    Hello, community, Please could someone confirm the Graphics card needed to support a Eizo ColorEdge CG275W monitor, resolution 2560x1440. I currently have a Mac Pro with a NVIDIA GeForce 7300 GT VRAM (Total):          256 MB, which I'm guessing by it