Is it possible to extend two classes?

I want to do something like :
public class C extends A, B {
public class E extends A, D {
}The two classes have things in A in common, but have to extend other different classes (B, D) as there are other differences.

Make A an interface. I mean it. Make A an interface.Thanks for the suggestion but I have identical code to duplicate and wanted an abstract class
class A{
   private String commonValue;
   public String getCommonValue() { return commonValue; }
   public void processSomething() {
       // Will be identical code for every class needing A
}I guess I need to make another abstract class and have that extend and than the parent class extend this..
Just seems annoying to duplicate the same code 5 times
Message was edited by:
smiles78

Similar Messages

  • Is it possible to maintain two class type for a material

    Dear All,
    Is it possible to maintain two different class type for a material.
    If a material assigned with the batch and the material is a part of variant configuration, then how to handle this scenario.
    For Batch Management, class type will be 023, for Variant Configuration class type will be 200.
    How to handle this scenario.
    Please explain.
    Regards,
    Mullairaja
    Edited by: MullaiRaja on Jan 5, 2011 5:19 AM

    Mr.Raja
    As far as my knowledge, it does NOT make sense to assign a material to more than one class type.
    We can assign many classes to  a single class type of  a material.
    For configurable material, create the material using material type : KMAT.
    & then, activate the 'batch management" control in the material master, for that material.
    Pls revert with feedback.
    Hope, that helps you.
    Rgds
    Sumanth.Gururaj
    Consultant/Systems Analyst - SAP SD/MM

  • Is there another way to extends two classes?

    hi
    I was wondering if anyone knows how to have one class to inherit two other classes methods?
    I know that extending the main class with the two other classes are an invalid, just wondering is there another alternative to solve this problem?
    Thank
    J

    I don't know the MHP class, but you could do the following:
    if MHP.Button inherits feom awt.Button you may not have anything to do except change the constructor. You will be able to assign an MHP Button to an awt reference.
    If MHP button is a truly seperate class, create an Interface with all the button methods you use. Then create a subclass of the MHP button which implements the interface and an awt subclass. Both these subclasses will be assignable to your interface reference.
    I have done this with a button and JButton below. Of course this was not strictly necessary in this case because JButton extends from the awt Button class.
    package package4;
    import javax.swing.*;
    import java.awt.*;
    interface MyButton {
        // add ALL the rest of the methods you use!
        void setText(String txt);
        void show();
    class myJButton extends JButton implements MyButton {
    class myAWTButton extends Button implements MyButton {
        // AWTButton and JButton not quite compatible - call different function
        public void setText(String str) {
          setLabel(str);
    public class Class2 extends Object {
       JFrame myframe ;
       MyButton button;
       JPanel jp;
      public Class2() {
        myframe = new JFrame() ;
        jp = new JPanel();
        myframe.setSize(500,500);
        myframe.setVisible(true);
        myframe.getContentPane().add(jp);
      void addJButton() {
        button = new myJButton();
        button.setText("DEFAULT");
        jp.add( (Component) button);
      void addAWTButton() {
        button = new myAWTButton();
        button.setText("DEFAULT");
         jp.add( (Component) button);
      void setButtonText(String str)
          button.setText(str);
      public static void main(String[] args) {
        Class2 awt = new Class2();
        awt.addAWTButton();
        awt.myframe.show();
        Class2 swing = new Class2();
        swing.addJButton();
        swing.myframe.setLocation(500,0);
        swing.myframe.show();
          // now we can use the same method on both
          swing.setButtonText("SWING!!!");
          awt.setButtonText("AWT!!!");
    }In practice you would probably have a factory mettod to produce each type of button.

  • Is it possible to extend bytearrayoutputstream to a new class

    hi is it possible to extend byteArrayoutputStream class to my new class so that i can directly access the buf[] (instace of bytearrayoutputstream), if so how to do it and what are the functions i need to override and provide me any tutorials or topics on this....

    manju_hawk wrote:
    hi is it possible to have my new class extend byteArrayoutputStreamYes (fixed slightly).
    manju_hawk wrote:
    so that i can directly access the buf[] (instace of bytearrayoutputstream),Though why would you want to do that? You can already access the buffer as ByteArrayOutputStream.toByteArray() outside of that class. Regardless, see [the Inheritance trail|http://java.sun.com/docs/books/tutorial/java/IandI/subclasses.html] of the Java tutorial for more information on overriding methods. I don't think you'd need to override many methods in your ByteArrayOutputStream subclass though, just read(byte[], int, int) and write(byte[], int, int) probably.
    Edited by: Looce on Nov 12, 2008 1:18 AM (added more information)

  • Searching for extended ABAP Classes documentation

    Hi,
    I'm a newbie to this forum (perhaps I'm a newbie in an abap too - with my 1.5 yrs abaping) but I'm interested in a few topics related to classes available in the repository:
    1. Where can I find full and detailed info (means description of interfaces both public and private/static) on classes included in a dev.class SLIS, SCET, especially specific ones - currently I'm looking for a documentation on class <cl_alv_changed_data_protocol>, because the info supplied in the repository is not so obviously clear for me.
    2. Can someone point me to a SAP cource/academy -name(s) related to the public classes related to a gui programming and!!!! their support-classes (such as mentioned one above) - which is most important.
    3. (specific question) In the OO framework(s) I worked with in my background there was a possibility to 'extend' some class' behaviour (usualy adding interface). Is there any possibility in a SAP environment to do this and if yes where can I find a docu/info on how to achieve this? Is this achieved only with a related access key?
    4. Please could someone provide me a dev.class names with demo-programs (such as SLIS, SCET) related (mostly) to a GUI-programming?
    Perhaps checking the source of the demo-reports supplied in these dev.classes would help me, but occasionaly it's a bit more complicated and time-consuming than to check a related docu, isn't it?
    The info-sources I have (and used widely) are:
    a) html-documentation with my (ok, our) installation > 4.6C (both integrated into an environment and CHM-help).
    b) 'Controls Technology - Workbench edition' - which I would recommend to all the programmers interested in this area.
    c) 'An Easy Reference for ALV Grid Control'  by Serdar SIMSEKLER (BTW, thank you very, very much Serdar! for providing this reference to the public, I found it very usefull)
    d) of cource, the Class Builder via Repository Browser (se80) which usually and unfortunately doesn't report me any class information when asked.
    e) occasionaly google-ing the world with a specific question and checking this fourm or some related one(s) in the sap community and in de.alt.comp.sap-r3 newsgroup (unfortunately for me the last one is basicaly with postings in German, which makes it unusable to me).
    Perhaps most of you would agree there is a lack of information on these topics. Or, of course, I'm still a newbie and don't know how/where to find it
    Please note, answers in sort of 'Feel free to ask with a specific question here...' are not the answer(s) I'm looking for I know this possiblilty and am using it :-).
    Finaly, one question off topic and related mostly to the moderators:
    Is there an intention or even better a possibility to achieve this forum via NNTP-protocol (means using a standard news-client)? It would be great for me if it's possible or is intended to become possible - I'm using a news-client to track few newsgroups (forums) and it would be great not to switch to a different browser to track this one, which is IMHO the best english-speaking abap-related forum.
    Many thanks in advance.
    Best Regards,
    Ivaylo Mutafchiev
    BC Consultant - Abap developer
    VBS Ltd.
    Varna. Bulgaria
    Message was edited by: Ivaylo Mutafchiev

    From within SE80 choose menu Environment->Controls Examples.  This will lead you to many fine Enjoy Control Example programs.
    Also SAP had a class several years ago called BC412 ABAP Dialog Programming Using EnjoySAP Controls.  It might still be around in some format.

  • Extending a class with a qualifier?

    Hi,
    i have a doubt regarding extending a class with qualifier(in Java)? to my knowledge it is not possible. but some one said this is possible ...
    can some one lemme know..
    Is it possible to extend a class with a qualifier?
    i mean class A extends class B(privately/protectedly etc..)
    class A extends private/protected B{}// is there a way to do some thing like this? can we
    can v reduce the acess level while extending it (public to private) so that v can extends calss as if it is a private class..
    Thanks
    Kish.

    I don't fully understand the question, but you can say:
    public class B
        private class A extends B
    }or
    public class B
    private class A extends B
    Except there are problems with that, class A would need a get method in order to get an instance of class A
    Hope this helps,
    Radish21

  • ?Is it possible to create a javafx class without extending Application class ? If yes, how

    Is it possible to create a javafx class without extending Application class ? If yes, how ?

      There is no  such thing as a javafx  class.  It is a regular  java class.  The Aapplication class is  the entry
    point  for JavaFX application.  You have to extend the Application class to create Javafx  application .

  • One performance view for two classes, possible?

    Hi there,
    My system is still running 2007 R2. I am writing a MP now which contains two classes. There are few performance collection rules targeting those two classes. I want to create one performance view to display performance data for BOTH classes. Is it possible?
    I already created an instance group and added both classes as member of the group. By using the group, I can created one alert view to display alerts from either class. Can I use the same trick for the performance view? Thanks!

    In addition, we also can add a dashboard view with two columns for the two classes, and add performance widget for each column.
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Two class needs to be extends, So I need some  WorkAround ...

    I have a Simple Question
    for accessing SAP PI MAPPING API in ECLIPSE .
    I need to extend one class AbstractTransformation ....
    similary for getting SAX Parser functionalty in ECLIPSE , I need to extend class DefaultHandler..
    So How to Handle this Case : Two class needs to be extends and I know only one class can be extend .
    So JAVA GURUS , I need some workaround .
    Regards
    PS

    Hi,
    First of all Java does not allow multiple inheritance ie u can extend from only one base class.
    work around :
    write two seperate java class say
    1. myJavaMapping.java which extends AbstractTransformation.
    2. mySaxParser.java which extends DefaultHandler
    And now create an object of mySaxParser in ur myJavaMapping class(see below code).
                    mySaxParser parser = new mySaxParser(out);                             //Out is the outputstream
              SAXParserFactory factory = SAXParserFactory.newInstance(); //standard class
              try
                   SAXParser saxParser = factory.newSAXParser();              //standard class
                   this.out = out;
                   saxParser.parse(in, parser);                                                 //begin parsing                                                                               
    // in is inputstream object & has input XML
              catch(Exception e)
                   e.printStackTrace();
    Hope it is clear,
    Anand

  • Is it possible to Extend Request Offering Class ??

    Hi,
    We extend the Request Offering Class in a new MP, added two properties, sealed and Imported to SM successfully. 
    Though extended properties are listed in each instance of Request Offering, we are not able  to set value to the extended property.
    Eg: Get-SCClassInstance -Class $reqOffClass | %{$_defaultProperty1 = "value"; $_.ExtendedProperty1 = "Value"; Update-SCClassInstance -Instance $_}
    The above code executes without throwing any error, but the Extendedproperty1 wasn't set, despite the DefaultProperty1 is updated with the provided value.
    We extended the Request Offering Class as like extending other classes, which are working fine.  
    Is there any specific configuration needs to be done to extend RequestOffering Class other  than 'Extention="true"'??
    Please Advice!!!!
    Thanks and Regards, Narayana Babu

    Below is the definition of Custom relationship created between WorkItem and Request Offering...
    <RelationshipTypeID="ServiceManager.CloudServices.WorkItemToUpdateRequestOffering"Accessibility="Public"Abstract="false"Base="System!System.Reference"><SourceID="WorkItem"MinCardinality="0"MaxCardinality="2147483647"Type="System_WorkItem_Library!System.WorkItem"/><TargetID="RequestOfferings"MinCardinality="0"MaxCardinality="2147483647"Type="System_ServiceCatalog_Library!System.RequestOffering"/></RelationshipType>
    Though there's a default Relationship between this two "WorkItemRelatesToRequestIOffering", we tried to configure it with that RelationShip ID as well, but doesn't works either...
    Thanks and Regards, Narayana Babu

  • I have a Cisco/Linksys WRT-54G wireless router and 2 Airport Extremes (the small ones that plug directly into the wall). Is it possible to extend the network from the router using these two AEs? I have a DVD player and Ext HD plugged into the router too..

    I have a Cisco/Linksys WRT-54G wireless router and 2 Airport Extremes (the small ones that plug directly into the wall). Is it possible to extend the network from the router using these two AEs? I have a DVD player and Ext HD plugged into the router too. Any ideas? I'm guessing the only way is to do what I've seen in these community pages which states that it can be done but it will drop the bandwidth by 50%. Thoughts?? Thanks!

    The Cisco/Linksys WRT-54G was one of the very few routers said to be compatible with Apple's implementation of WDS (Wireless Distribution System) settings.
    The info that I have on file indicates that only the WRT-54G versions 4 and under were compatible, so that would be one bridge to cross.
    Even if you find that your Cisco/Linksys might be the right version, Apple never published instructions on how to configure the Express devices with other manufactures, so users were left to their own devices to try to figure out how to get things working. Apple's instructions to connect to other Apple devices are in the link below:
    WDS network
    If you were hoping to use 2 Express devices in this type of configuration...even if it works...the bandwidth penalties will be extremely severe.
    The first Express drops the bandwidth (and speed) on the entire network in half and the second halves everything again. So, the result, in effect would be a "g" wireless network running at 25% speed. Few users would consider installing this type of network.
    At this point, it becomes one of those things where the fact that you might be able to do something does not mean that there would be much value in doing so. But, it is your decision to decide if you want to try to proceed.

  • Is Two Classes that call methods from each other possible?

    I have a class lets call it
    gui and it has a method called addMessage that appends a string onto a text field
    i also have a method called JNIinterface that has a method called
    sendAlong Takes a string and sends it along which does alot of stuff
    K the gui also has a text field and when a button is pushed it needs to call sendAlong
    the JNIinterface randomly recieves messages and when it does it has to call AddMessage so they can be displayed
    any way to do this??

    Is Two Classes that call methods from each other possible?Do you mean like this?
       class A
         static void doB() { B.fromA(); }
         static void fromB() {}
       class B
         static void doA() { A.fromB(); }
         static void fromA() {}
    .I doubt there is anyway to do exactly that. You can use an interface however.
       Interface IB
         void fromA();
       class A
         IB b;
         A(IB instance) {b = instance;}
         void doB() { b.fromA(); }
         void fromB() {}
       class B implements IB
         static void doA() { A.fromB(); }
         void fromA() {}
    .Note that you might want to re-examine your design if you have circular references. There is probably something wrong with it.

  • Is it possible to register two same Listener in a component?

    Hi all,
    Is it possible to register two same Listener in a component and also set the execution hierarcy?

    And here some code that seems to workimport javax.swing.JButton;
    import javax.swing.JFrame;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    public class Test {
        boolean firstAdapterCalled = false;
        boolean secondAdapterCalled = false;
        MyFirstAdapter  ma1;
        MySecondAdapter ma2;
        public Test() {
         JFrame frame = new JFrame ("Test");
         JButton butt = new JButton("Press Me");
         frame.getContentPane().add(butt);
         frame.pack();
         frame.setVisible(true);
         ma1 = new MyFirstAdapter();
         ma2 = new MySecondAdapter();
         butt.addMouseListener(ma1);
         butt.addMouseListener(ma2);
        public static void main (String [] args) {
         Test t = new Test();
        class MyFirstAdapter extends MouseAdapter {
         public void mouseClicked(MouseEvent e) {
             System.out.println("Called first adapter");
             firstAdapterCalled = true;
             ma2.mouseClicked(e);
        class MySecondAdapter extends MouseAdapter {
         public void mouseClicked(MouseEvent e) {
             if (!firstAdapterCalled) {
              System.out.println("First adapter not called yet...");
              return;
             System.out.println("Second adapter called");
             firstAdapterCalled = false;
    }

  • Things Visible in Two Classes

    I'm developing a program using two classes: "Analysis.class" and "AnalysisCalc.class", each in separate files. I don't desire to import either class via package design. I'm trying to call a method from "AnalysisCalc.class" using variables visible to both classes. The intent of the program is to decrement a variable using a while loop. The intent of using "AnalysisCalc.class" is to manage my code better rather than consolidate all the code in "Analysis.class". How do I modify the following source code for these classes?
    (NOTE: Don't worry about other aspects of program such as I/O since I know how to handle that )
    // Analysis Program: Analysis.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Analysis extends JApplet implements ActionListener {
         double variableX;
         boolean variableA, variableB;
         public void init()
              variableX = 0;          
              variableA = true;
              variableB = true;
         } // end method init     
         public void strt()
              while(variableB){                    
                   rundata();
                   if( variableX < 10 )
                        variableB = false;
         }  // end method strt
         strt();
    } //end class Analysis
    // AnalysisCalc.java
    public class AnalysisCalc {  
         // AnalysisCalc constructor
         public AnalysisCalc()
              rundata( );
         public void rundata( )
              if( variableA == true)
                   variableX = 100;
                   variableA = false;
              variableX--;
    } // end class AnalysisCalc

    OK, forget the code I posted previously.
    The following code in files Trajectory.java and Calculate.java have a similar problem. I'm trying to get my method set up simple with a decrement logic because later the logic for the method will become more complex. I want to keep all this complex code out of the Trajectory.java file and manage it from the Calculate.java file. I would set up package and import design, but my ISP will not accept package design in building website since fully qualified names must be used to avoid naming conflicts.
    key code segments in file trajectory.java, being analogous to Analysis.java, include--->
    Calculate Z = new Calculate();
    while(sentinel){
    Z.rundata();
    if( altitude < 10 )
    sentinel = false;
    The file analogous to AnalysisCalc.java is Calculate.java
    // Trajectory Analysis Program: Trajectory.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Trajectory extends JApplet implements ActionListener {
         final double MAX = 90.0;
         final double MIN = -90.0;
         final double MAX_ALTITUDE = 2000000.0;
         final double MIN_ALTITUDE = 0.0;
         private JTextArea introductionArea, resultsArea;
         private JLabel spanLabel, chordLabel,
              thicknessLabel, massLabel, altitudeLabel, velocityLabel,
              trajectory_angleLabel, time_incrementLabel, rotation_factorLabel,
              calculationLabel, resultsLabel;
         private JTextField spanField, chordField, thicknessField,
              massField, altitudeField, velocityField, trajectory_angleField,
              time_incrementField, rotation_factorField;
         private JButton startButton, resetButton, contButton, abortButton;
         String introduction_string, span_string, chord_string, thickness_string, mass_string,
              altitude_string, velocity_string, trajectory_angle_string,
              time_increment_string, rotation_factor_string, results_string;
         public double span, chord, thickness, mass, altitude, velocity, trajectory_angle, time_increment,
              rotation_factor, distance, velocity_fps, elapsed_time;
         boolean value, sentinel;
         // create objects
         public void init()
              Calculate Z = new Calculate();
              span = 0;
              chord = 0;
              thickness = 0;
              mass = 0;
              altitude = 0;
              velocity = 0;
              trajectory_angle = 0;
              time_increment = 0;
              rotation_factor = 0;
              distance = 0;
              velocity_fps = 0;
              elapsed_time = 0;
              velocity_fps = 0;
              elapsed_time = 0;
              value = true;
              sentinel = true;
              introduction_string =
                   "DEBRIS TRAJECTORY PROGRAM\n" 
                   + "designed by Weldon K. Chafin, Jr.\n\n"
                   + "Inspired by the brave heroes of the Columbia Accident "
                   + "of February 1, 2003.\n\n"
                   + "This program determines trajectory for an object modeled "
                   + "as a rectangular prism having given mass falling through "
                   + "the atmosphere. The object is assumed to oscillate with same "
                   + "frequency about all six possible permutations for axis "
                   + "angular velocity vectors as the means to simulate "
                   + "equally likely random events.\n\n"
                   + "NOTE: This program is still under construction. "
                   + "I predict this program will be fully functional by October 4, 2003. "
                   + "Then it should have calculation capability comparable to the C++ program version I created "
                   + "for the Columbia Accident Investigation Board (CAIB) to predict locations of Columbia debris. "
                   + "In fact, the CAIB forwarded my program as an analytical tool to NASA "
                   + "JSE Early Sightings Assessment Team tasked with finding high interest "
                   + "Columbia debris items via radar imaging.";
              span_string = "";
              chord_string = "";
              thickness_string = "";
              mass_string = "";
              altitude_string = "";
              velocity_string = "";
              trajectory_angle_string = "";           
              time_increment_string = "";
              rotation_factor_string = "";
              results_string = "";
              // create container & panel
              Container container = getContentPane();     
              Panel panel = new Panel( new FlowLayout( FlowLayout.LEFT));
              container.add( panel );
              // set up vertical boxlayout
              Box box = Box.createVerticalBox();
              Box inputbox1 = Box.createHorizontalBox();
              Box inputbox2 = Box.createHorizontalBox();
              Box inputbox2a = Box.createHorizontalBox();
              Box inputbox2b = Box.createHorizontalBox();
              Box inputbox2c = Box.createHorizontalBox();
              Box inputbox2d = Box.createHorizontalBox();
              Box inputbox3 = Box.createHorizontalBox();
              Box buttonbox = Box.createHorizontalBox();
              // set up introduction
              introductionArea = new JTextArea( introduction_string, 10, 50 );
              introductionArea.setEditable( false );
              box.add( new JScrollPane( introductionArea ) );
              box.add( Box.createVerticalStrut (10) );
              box.add( inputbox1);
              box.add(inputbox2a);
              Dimension minSize = new Dimension(5, 15);
              Dimension prefSize = new Dimension(5, 15);
              Dimension maxSize = new Dimension(Short.MAX_VALUE, 15);
              inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up span
              spanLabel = new JLabel( "span (feet)" );
              spanField = new JTextField(5 );
              inputbox2a.add( spanLabel );
              inputbox2a.add( spanField );
              inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));          
              // set up chord
              chordLabel = new JLabel( "chord (feet)" );
              chordField = new JTextField(5 );
              inputbox2a.add( chordLabel );
              inputbox2a.add( chordField );
              inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));     
              // set up thickness
              thicknessLabel = new JLabel( "thickness (feet)" );
              thicknessField = new JTextField(5 );
              inputbox2a.add( thicknessLabel );
              inputbox2a.add( thicknessField );
              inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));
              box.add( Box.createVerticalStrut (10) );
              box.add(inputbox2b);
              inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up mass
              massLabel = new JLabel( "mass (slugs)" );
              massField = new JTextField(5);
              inputbox2b.add( massLabel );
              inputbox2b.add( massField );
              inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));     
              // set up altitude
              altitudeLabel = new JLabel( "altitude (feet)");
              altitudeField = new JTextField(5 );
              inputbox2b.add( altitudeLabel );
              inputbox2b.add( altitudeField );
              inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up velocity
              velocityLabel = new JLabel( "velocity (Mach Number)");
              velocityField = new JTextField(5);
              inputbox2b.add( velocityLabel );
              inputbox2b.add( velocityField );
              inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
              box.add( Box.createVerticalStrut (10) );
              Dimension minSize2c = new Dimension(160, 15);
              Dimension prefSize2c = new Dimension(160, 15);
              Dimension maxSize2c = new Dimension(Short.MAX_VALUE, 15);
              box.add(inputbox2c);
              inputbox2c.add(new Box.Filler(minSize2c, prefSize2c, maxSize2c));
              // set up trajectory_angle
              trajectory_angleLabel = new JLabel( "trajectory angle (degrees)");
              trajectory_angleField = new JTextField(5);
              inputbox2c.add( trajectory_angleLabel );
              inputbox2c.add( trajectory_angleField );
              inputbox2c.add(new Box.Filler(minSize2c, prefSize2c, maxSize2c));
              box.add( Box.createVerticalStrut (10) );
              Dimension minSize2d = new Dimension(50, 15);
              Dimension prefSize2d = new Dimension(50, 15);
              Dimension maxSize2d = new Dimension(Short.MAX_VALUE, 15);
              box.add(inputbox2d);
              inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
              // set up time_increment
              time_incrementLabel = new JLabel( "time increment (seconds)" );
              time_incrementField = new JTextField(5);
              inputbox2d.add( time_incrementLabel );
              inputbox2d.add( time_incrementField );
              inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
              // set up rotation_factor
              rotation_factorLabel = new JLabel( "rotation factor (number)" );
              rotation_factorField = new JTextField(5);
              inputbox2d.add( rotation_factorLabel );
              inputbox2d.add( rotation_factorField );
              inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
              box.add( Box.createVerticalStrut (10) );
              box.add( buttonbox);
              Dimension minSizeB = new Dimension(10, 30);
              Dimension prefSizeB = new Dimension(10, 30);
              Dimension maxSizeB = new Dimension(Short.MAX_VALUE, 30);
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up start
              startButton = new JButton( "START" );
              buttonbox.add( startButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up reset
              resetButton = new JButton( "RESET" );
              buttonbox.add( resetButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up cont
              contButton = new JButton( "CONTINUE" );
              buttonbox.add( contButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up abort
              abortButton = new JButton( "ABORT" );
              buttonbox.add( abortButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              box.add( Box.createVerticalStrut (10) );          
              // set up results
              resultsArea = new JTextArea( results_string, 6, 50 );
              resultsArea.setEditable( false );
              box.add( new JScrollPane( resultsArea ) );
              // add box to panel
              panel.add( box );
              // register event handlers
              spanField.addActionListener( this );
              chordField.addActionListener( this );          
              thicknessField.addActionListener( this );
              massField.addActionListener( this );
              altitudeField.addActionListener( this );
              velocityField.addActionListener( this );          
              trajectory_angleField.addActionListener( this );
              time_incrementField.addActionListener( this );
              rotation_factorField.addActionListener( this );
              startButton.addActionListener( this );
              resetButton.addActionListener( this );
              contButton.addActionListener( this );
              abortButton.addActionListener( this );
              reset();
         } // end method init     
         public void t_r_a_test (double trajectory_angle) throws Tare {   
              if (trajectory_angle > MAX || trajectory_angle < MIN)
                          throw new Tare("\ntrajectory_angle "
                   + trajectory_angle + " is outside of allowable range\n\n" 
                   + "Try another value for the trajectory angle\n"
                   + "( " + MIN + " <= trajectory angle <= " + MAX + " )" );
         }  // end method t_r_a_test
         public void a_r_e_test (double altitude) throws Are {   
              if ( altitude > MAX_ALTITUDE )
                          throw new Are("\naltitude "
                   + altitude + " is outside of allowable range\n\n" 
                   + "Try value for altitude\n"
                   + "( " + MIN_ALTITUDE + " <= altitude <= "
                   + MAX_ALTITUDE + " )" );
         }  // end method a_r_e_test
         public void n_v_test (boolean value) throws Nve {   
              if ( value == false ){
                   if( span < 0 ){
                         span = 0;
                               throw new Nve("\nValue for "
                        + " span must not be negative\n\n" 
                        + "Try another value ");
                   if( chord < 0 ){
                         chord = 0;
                               throw new Nve("\nValue for "
                        + " chord must not be negative\n\n" 
                        + "Try another value ");
                   if( thickness < 0 ){
                         thickness = 0;
                               throw new Nve("\nValue for "
                        + " thickness must not be negative\n\n" 
                        + "Try another value ");
                   if( mass < 0 ){
                         mass = 0;
                               throw new Nve("\nValue for "
                        + " mass must not be negative\n\n" 
                        + "Try another value ");
                   if( altitude < 0 ){
                        altitude = 0;
                               throw new Nve("\nValue for "
                        + " altitude must not be negative\n\n" 
                        + "Try another value ");
                   if( velocity < 0 ){
                        velocity = 0;
                               throw new Nve("\nValue for "
                        + " velocity must not be negative\n\n" 
                        + "Try another value ");
                   if( time_increment < 0 ){
                        time_increment = 0;
                               throw new Nve("\nValue for "
                        + " time increment must not be negative\n\n" 
                        + "Try another value ");
                   if( rotation_factor < 0 ){
                        rotation_factor = 0;
                               throw new Nve("\nValue for "
                        + " rotation factor must not be negative\n\n" 
                        + "Try another value ");
              } //end if( value == false )
         }  // end method n_v_test
         // process events
         public void actionPerformed( ActionEvent event )
              // process spanField
              if( event.getSource() == spanField ) {
                   span_string = spanField.getText();
                   span = Double.parseDouble( span_string);
              // process chordField
              if( event.getSource() == chordField ) {
                   chord_string = chordField.getText();
                   chord = Double.parseDouble( chord_string);
              // process thicknessField
              if( event.getSource() == thicknessField ) {
                   thickness_string = thicknessField.getText();
                   thickness = Double.parseDouble( thickness_string);
              // process massField
              if( event.getSource() == massField ) {
                   mass_string = massField.getText();
                   mass = Double.parseDouble( mass_string);
              // process altitudeField
              if( event.getSource() == altitudeField ){
                   altitude_string = altitudeField.getText();
                   altitude = Double.parseDouble( altitude_string);
              // process velocityField
              if( event.getSource() == velocityField ){
                   velocity_string = velocityField.getText();
                   velocity = Double.parseDouble( velocity_string);
              // process trajectory_angleField
              if( event.getSource() == trajectory_angleField ){
                   trajectory_angle_string = trajectory_angleField.getText();
                   trajectory_angle = Double.parseDouble( trajectory_angle_string);
              // process time_incrementField
              if( event.getSource() == time_incrementField ){
                   time_increment_string = time_incrementField.getText();
                   time_increment = Double.parseDouble( time_increment_string);
              // process rotation_factorField
              if( event.getSource() == rotation_factorField ){
                   rotation_factor_string = rotation_factorField.getText();
                   rotation_factor = Double.parseDouble( rotation_factor_string);
              // process startButton event
              if ( event.getSource() == startButton )                
                   strtb();               
              // process resetButton event
              if ( event.getSource() == resetButton )
                   reset();
              // process contButton event
              if ( event.getSource() == contButton )
                   cont();
              // process abortButton event
              if ( event.getSource() == abortButton )
                   abort();
         } // end method actionPerformed
         public void strtb()
              try{          
                   span = Double.parseDouble( spanField.getText() );
                   chord = Double.parseDouble( chordField.getText() );
                   thickness = Double.parseDouble( thicknessField.getText() );
                   mass = Double.parseDouble( massField.getText() );
                   altitude = Double.parseDouble( altitudeField.getText());
                   velocity = Double.parseDouble( velocityField.getText());
                   trajectory_angle = Double.parseDouble( trajectory_angleField.getText());
                   time_increment = Double.parseDouble( time_incrementField.getText() );     
                   rotation_factor = Double.parseDouble( rotation_factorField.getText() );          
                   if( span < 0 || chord < 0 || thickness < 0 || mass < 0
                        || altitude < 0 || velocity < 0
                        || time_increment < 0 || rotation_factor < 0 )
                   value = false;
                   t_r_a_test( trajectory_angle );
                   n_v_test( value );
                   a_r_e_test( altitude );
                   while(sentinel){
                        Z.rundata();
                        if( altitude < 10 )
                             sentinel = false;
                   results();
                   resultsArea.setText( results() );
              }//end try
              // process improperly formatted input
              catch ( NumberFormatException numberFormatException ) {
                   JOptionPane.showMessageDialog( this,
                   "You must enter numbers in decimal format or integers"     ,
                   "Invalid Number Format" ,
                   JOptionPane.ERROR_MESSAGE );
              } // end catch NumberFormatException
              catch ( ArithmeticException arithmeticException ) {
                   JOptionPane.showMessageDialog( this,
                   arithmeticException.toString(), "Arithmetic Exception" ,
                   JOptionPane.ERROR_MESSAGE );
              } // end catch ArithmeticException
              catch ( Tare tare ) {
                        JOptionPane.showMessageDialog( this,
                        tare.toString(), "-90 <= range <= 90 " ,
                        JOptionPane.ERROR_MESSAGE );
              } // end catch Tare
              catch ( Nve nve ) {
                        JOptionPane.showMessageDialog( this,
                        nve.toString(), " value less than zero" ,
                        JOptionPane.ERROR_MESSAGE );
              } // end catch Nve
              catch ( Are are ) {
                        JOptionPane.showMessageDialog( this,
                        are.toString(), " value greater than maximum" ,
                        JOptionPane.ERROR_MESSAGE );
              } // end catch Are
         }  // end method strtb
         public void reset()
              span_string = "";
              chord_string = "";
              thickness_string = "";
              mass_string = "";
              altitude_string = "";
              velocity_string = "";
              trajectory_angle_string = "";
              time_increment_string = "";
              rotation_factor_string = "";
              results_string = "";
              spanField.setText( span_string );
              chordField.setText( chord_string );
              thicknessField.setText( thickness_string );
              massField.setText( mass_string );
              altitudeField.setText( altitude_string );
              velocityField.setText( velocity_string );
              trajectory_angleField.setText( trajectory_angle_string );
              time_incrementField.setText( time_increment_string );
              rotation_factorField.setText( rotation_factor_string );
              resultsArea.setEditable( true );
              resultsArea.setText( results_string );
              resultsArea.setEditable( false );
              span = 0;
              chord = 0;
              thickness = 0;
              mass = 0;
              altitude = 0;
              velocity = 0;
              trajectory_angle = 0;
              time_increment = 0;
              rotation_factor = 0;
              distance = 0;
              velocity_fps = 0;
              elapsed_time = 0;
              value = true;
         }   // end method reset
         public void cont()
         //later
         public void abort()
         //later
         public String results()
         results_string =
         "Distance =\t\t" + distance + " miles\n"
         + "Altitude =\t\t" + altitude + " feet\n"
         + "Trajectory Angle =\t" + trajectory_angle + " degrees\n"
         + "Velocity =\t\t" + velocity_fps + " feet per second\n"
         + "Elapsed Time =\t\t" + elapsed_time + " seconds\n";
         return results_string;
    } //end class Trajectory// Trajectory Analysis Program: Calculate.java
    public class Calculate {  
         Trajectory T = new Trajectory();
         // Calculate constructor
         public Calculate()
              rundata( );
         public void rundata( )
         T.altitude--;
    } // end class Calculate

  • How to map a custom enum list to a custom form property in an extended incident class

    Hi,
    I'm struggeling to understand how to map a custom enum list to a custom form property in an extended incident class.
    Here's what i want to have happen:
    I am going to publish a request offering on my SMPortal for allowing users to submit basic IT incidents. I want the form to include "Whom does this problem affect" (answers(This is the custom enum list): Me, Multiple Users, Whole department or Whole
    company), "What is the problem about", "Description" and "Attachments".
    Here's what i've done:
    In the authoring tool i created a MP for the custom enum list and put only the list in it. I sealed the MP and imported it.
    I created another unsealed MP called TST.Incident.Library for storing incident library customizations and extended the incident class to add an extension class i called ClassExtension_Affected scope with a custom property i called AffectedScope. Then i am trying
    to set the datatype of this property to "list". In the "select a list" dialog i cannot chose my previously sealed MP with the custom enum list in it. Why?
    - Do i need to scratch the sealed MP and put the custom enum list in the latter TST.Incident.Library MP instead?
    - If so, can i do that and keep this MP unsealed, or will i get an error on import saying "Unsealed management packs should not contain type definitions"
    - Should i create one sealed MP for both the custom enum list and the extension class + custom property?

    Hi,
    Authoring Tool simply isn't informed about your list. Open the sealed management pack where you define the root of the list in the Authoring Tool and in the same time open TST.Incident.Library. You will have two opened MPs in the Authoring
    Tool and be able to add a custom list for your custom field.
    Cheers,
    Marat
    Site: www.scutils.com  Twitter:
      LinkedIn:
      Facebook:

Maybe you are looking for