Math in Dial shape element wrong

The math in the dial is just wrong. When it reports 9 edges, only 8 are visible because you cheat and use two elements in the same place! The flaw is revealed, if the user changes the angle to less than 360 degrees. The tools should produce a correct radial array with only the visible elements counting.
Mylenium

The math in the dial is just wrong. When it reports 9 edges, only 8 are visible because you cheat and use two elements in the same place! The flaw is revealed, if the user changes the angle to less than 360 degrees. The tools should produce a correct radial array with only the visible elements counting.
Mylenium

Similar Messages

  • Problem using comma separated list with nested table element

    Hi,
    I have a comma separated list like that:
    H23004,H24005,T7231,T8231,T9231And want to create a function which is creating a where clause for each element with an output like that:
    UPPER('H23004') IN (UPPER(charge))
    OR UPPER('H23005') IN (UPPER(charge))
    OR UPPER('T7231') IN (UPPER(charge))
    OR UPPER('T8231') IN (UPPER(charge))
    OR UPPER('T9231') IN (UPPER(charge))Here is my test function which doesn't work correctly:
    create or replace function FNC_LIST_TO_WHERE_CLAUSE(v_list in VARCHAR2) return varchar2 is
    -- declaration of list type
    TYPE batch_type IS TABLE OF pr_stamm.charge%TYPE;
    -- variable for Batches
    v_batch batch_type := batch_type('''' || replace(v_list,',',''',''') || '''');
    return_script varchar2(1000);
    BEGIN
    -- loop as long as there are objects left
    FOR i IN v_batch.FIRST .. v_batch.LAST
    LOOP
       --DBMS_OUTPUT.PUT_LINE(offices(i));
       -- create where clause
       IF i = 1 THEN
         return_script := 'UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       ELSE
         return_script := return_script || ' OR UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       END IF;
    END LOOP;
    return (return_script);
    end;The out put looks like that:
    UPPER('H23004','H24005','T7231','T8231','T9231') IN (UPPER(charge))I have no idea what I do wrong? It calculates the amount of array element wrong! (v_batch.LAST should be 5.)
    v_batch.FIRST = 1
    v_batch.LAST = 1
    Regards,
    Tobias

    try this....
    declare
    text varchar2(1000) := 'H23004,H24005,T7231,T8231,T9231';
    v_where varchar2(1000);
    begin
    text := text||',';
    while instr(text,',') <> 0
    loop
    v_where := v_where || 'UPPER('''||substr(text,1,instr(text,',',1)-1)||''' IN (UPPER(charge)) OR ';
         text := substr(text,instr(text,',',1)+1);
    end loop;
    v_where := substr(v_where,1,length(v_where)-3);
    dbms_output.put_line(v_where);
    end;
    convert this one into function ...

  • Math in Java

    What is wrong with Java's math. It adds double wrong sometimes. Why is this? Is there a way to hard-code it so it will add right?
    Regards,
    Collin

    And it's not a Java thing. C/C++ have it, as I'd imagine C# does, as do many other languages.
    It's a natural consequence of two things:
    1) trying to represent an infinite number of values with a finite number of bits.
    2) the fact that some things that can be represented exactly in base-10 (what we humans use) cannot be represented exactly in base-2 (what 'puters use).
    For instance 0.1 base-10 cannot be represented exactly in base-2. In base-10, 0.1 is 1/10, 0.01 is 1/100, etc. In base-2, 0.1 is 1/2, 0.01 is 1/4, 0.001 is 1/8, etc. There is no way--absolutely no way--to represent 1/10 exactly in that notation with a finite number of digits.
    http://docs.sun.com/source/806-3568/ncg_goldberg.html

  • Filling in a shape with a dot pattern

    Hi there,
    I have this shape of a light which I am trying to fill with a dot pattern but when applied it cuts some of the dots off.
    How can I avoid this?
    Ideally it would also follow the 3 dimensional shape of the object, like the first picture.
    This is correct style of pattern I'm trying to achieve but wrong shape (I did not create this one) :
    This is the right shape but wrong pattern style:
    Thanks for your help!
    Charles

    Thanks, I've cleaned up the shape manually as the the tutorial suggested but it still doesn't quiet look right.
    Is there a way I can perhaps manipulate the pattern in order to follow to 3D shape whilst keeping the dots round?

  • How to delete a shape for real in JSFL (possible bug)

    I have this big JSFL project I'm working on that involves deleting a raw shape (ungrouped) and then replacing it with another one.  The problem is that the original shape doesn't always actually get erased (I haven't figured out the precise circumstances where this happens yet though).  Even if it does get deleted, though, when I draw the new shape on the stage (using Path.makeShape), the new shape has extra vertices where its edges cross those of the original shape.  So even if I end up with the correct-looking shape on the stage without the one that was there before, my shape I just created is likely to have extraneous vertices (and I need the vertices to be unchanged).
    Some details:
    First I select all the shape elements in a frame by looping through the frame elements, adding any with elementType == "shape" and isGroup == false to an array, and then set fl.getDocumentDom().selection to be that array.  Then I call  fl.getDocumentDom().deleteSelection().  Then I call myPath.makeShape() on a path I created previously.
    So does anyone know of a workaround for this?  I've tried changing the selection and changing currentFrame to something else and back, but those didn't help.  I tried deleting the shapes earlier -- before I do the work of building my path -- but still the same problem.
    One idea I've just had: perhaps I could group the shape I'm going to delete and then delete the group.  Maybe that would solve it?
    Anyway, if anyone has any ideas about this please let me know.  If any Adobe people are hanging out here, does this sound like a bug?  If so, is there a workaround for it?
    -David

    I tried the grouping idea that I mentioned and yes, grouping the to-be-deleted shape before deleting it solved my problem.  The question still stands, though: Is this phenomenon a bug?  Can anyone from Adobe comment on this?
    -David

  • How do you subtract different values for specific array elements?

    Hi LabVIEW Community,
    I am new to LabVIEW and Im working on my first application. One of my challenges that I am having problems solving is how to  subtract specific values from specific elements in an array.
    My aplication is to measure the distance between a sensor and a magnet, however the initial distance for each sensor  to magnet is different. I have converted the voltage to a distance using the Math Node for each element and now need to  correct these values by subtracting their individual initial value.
    The source is a 1D array of DBL64  consisting of 32 elements and each of these values needs to have a different value subtracted.
    eg:
    Element 1 - 5.557
    element 2  - 2,34
    element 3 - 7,654  and so on
    I have tried to seperate (index the array) and subtract the values from each element and then combine them again. This has not been effetive. I need to write these values to an .txt file and also use them in another calculation.
    I have attached my attemted sub VI.
    Any advise would be really apprecieated.
    Solved!
    Go to Solution.
    Attachments:
    Sub VI Split Array_Correct Distance.vi ‏36 KB

    You don't need to overthink it. There's a really simple method. Generate an array that contains all your offsets you want.  Then subtract it off.
    It's the same VI with this change:
    Attachments:
    Sub VI Split Array_Correct Distance_LV12_MOD.vi ‏24 KB

  • Smart dialing option bug

    Hello!
    Smart dialing option is wrong for my country Ukraine (+380). With this option i can't send SMS for numbers like +380xxyyyyyyy. How to disable smart dialing at all? After a few hours of playing with this option (i set country USA +1, city code 380 and number 9 digits) i can send SMS for the numbers which starts 0xx but not +380xx. Inside my country  numeration starts from 0 then 2 digit code and 7 digit number, example 0-63-1234567. And Contact name does not displayed if contacts number saved without country code +380. Running on Z10 STL100-4 with firmware 10.2.1.1925

    Here is info about dialing plan in Ukraine:
    The international dialing code of Ukraine - 380
    Ukrainian mobile operators use a private numbering plan that is the same length all fixed telephone numbers in the country.
    In international format phone numbers are 12 digits long
    +380 Yy xxxxxxx to call to Ukraine from abroad , where:
        + - Way to an international call prefix ;
        380 - the dial code of Ukraine ;
        yy - two-digit area code or mobile operator ;
        xxxxxxx - seven-digit phone number.
    This dialing method is used for calls to Ukraine from outside the country .
    The national format ( for calls within the country) phones have a length of 10 digits . Instead of 380 ( an international call prefix and the international code of Ukraine) 0 typed ( code for long-distance communication or inter-operator communication) , two-digit number or a mobile operator in the region , the seven-digit phone number.
    0yyxxxxxxx to call on Ukraine, where:
        0 - way out on the long-distance line or to another operator within the country;
        yy - two-digit area code or mobile operator ;
        xxxxxxx - seven-digit phone number.
    This dialing method is used for calls within the country.
    For mobile communication codes issued in the general stream , there is no dedicated range for non-geographic zones.
    To call from Ukraine to other countries should be typed
    00 code_country kod_regiona nomer_abonenta calls from Ukraine abroad , where:
        00 - way to an international call prefix ( from mobile phones dialed +);
        code_country - dialing code of the destination country ;
        kod_regiona - dialing code of the region of interest ;
        nomer_abonenta - the phone number you want to call .
    The transition from the old set of rules ( at 8 and 8-10) to the new ( at 0 and 00) was carried out in the night from 13 to 14 October 2009 in accordance with the Ministry of Transport and Communications of Ukraine .

  • ArrayList e .RangeCheck(int)line 546

    Hi guys I am working on this project
    in few word
    I have to draw different shape on a panel
    moreover when two similar shapes collide ( 2 circles ) they make a bigger circle
    when st change direction
    almost everything works
    import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.Comparator;
    import java.util.Iterator;
    import javax.swing.JPanel;
    class ShapePanel extends JPanel implements ActionListener {
         private static final long serialVersionUID = 1L;
         public static ArrayList <Shape>shapes;
         private javax.swing.Timer animationTmr;
         int speed;
         PlaySound audioClip = new PlaySound();
         private float heigth;
         private float width;
         private int shape1;
         private int shape2;
         public ShapePanel() {
              shapes = new ArrayList<Shape>();
              animationTmr = new javax.swing.Timer(80, this); //interval, ActionListener
              animationTmr.start();
         public ArrayList<Shape> getShapes()
              return shapes;
         public void addSquare(int x, int y,int w,int h, int shapeType) {
              shapes.add(new Square(this,x, y,width, heigth, shapeType));
              repaint();
              System.out.println(shapes.size());
         public void addCircle(int x, int y,int w,int h, int shapeType) {
              shapes.add(new Circle(this, x, y,width, heigth, shapeType));
              repaint();
              System.out.println(shapes.size());
         public void addRectangle(int x, int y,int w,int h,  int shapeType) {
              shapes.add(new Rectangle(this, x, y,width, heigth, shapeType));
              repaint();
              System.out.println(shapes.size());
         public void addStar(int x, int y,int w,int h, int shapeType) {
              shapes.add(new Star(this, x, y,width, heigth, shapeType));
              repaint();
              System.out.println(shapes.size());
         public void paintComponent(Graphics g) { //called Whenever panel needs
              super.paintComponent(g); //re-displaying:
              Iterator<Shape> it = shapes.iterator(); //Iterate through Balls calling
              g.setColor(Menu.getColor());
              g.fillRect(0, 0, this.getWidth(), this.getHeight());
              while (it.hasNext()) { //each one's paint method
                   it.next().paint(g);
         public void actionPerformed(ActionEvent ev) {      
              //On timer tick,
              Iterator<Shape> it = shapes.iterator(); //Iterate through Balls calling
              while (it.hasNext()) { //each one's updatePos() method
                   it.next().updatePos();
              checkTypeCollision();
              handleCollision();
              repaint();
        private void checkTypeCollision()
              //we iterate through all the balls, checking for collision
              for(int i=0;i<shapes.size();i++)
                   for(int j=0;j<shapes.size();j++)
                             if(i!=j)
                                  if(collide(shapes.get(i), shapes.get(j)))
                                            shape1=shapes.get(i).shapeType;
                                            shape2=shapes.get(j).shapeType;
                                             if(shape1==shape2)
                                             /*     int     newX = (int) ((shapes.get(i).getCenterX() + (shapes.get(j).getCenterX()/2))/2);
                                                  int newY = (int) ((shapes.get(i).getCenterY() + (shapes.get(j).getCenterY() /2))/2);
                                                 float newWidth =   shapes.get(i).getWidth()+(shapes.get(j).getWidth()/2);
                                                 float newHeigth = shapes.get(i).getHeigth()+(shapes.get(j).getHeigth()/2);
                                                 int newShapeType = shapes.get(i).shapeType;
                                                       if(shapes.get(i).getShapeType()==1)
                                                            shapes.remove(j); //remove shape element at j
                                                            shapes.remove(i); //remove shape element at j
                                                            System.out.println("SIZE IS==="+     shapes.size());
                                                            System.out.println("newx====="+newX);
                                                            System.out.println("newy====="+newY);
                                                            System.out.println("newWidth====="+newWidth);
                                                            System.out.println("newx====="+newHeigth);
                                             //               shapes.add(new Rectangle(this,newX,newY,530,530,newShapeType));
                                                            System.out.println("SIZE IS==="+     shapes.size());
                                                       //     repaint();
                                                       if(shapes.get(i).getShapeType()==2)
                                                            shapes.remove(j); //remove shape element at j
                                                            shapes.remove(i); //remove shape element at j
                                                  //          shapes.add(new Circle(this,newX,newY,newWidth,newHeigth,newShapeType));
                                                       //     repaint();
                                                       if(shapes.get(i).getShapeType()==3)
                                                            shapes.remove(j); //remove shape element at j
                                                            shapes.remove(i); //remove shape element at j
                                                            shapes.add(new Square(this,newX,newY,newWidth,newHeigth,newShapeType));
                                                       if(shapes.get(i).getShapeType()==3)
                                                            shapes.remove(j); //remove shape element at j
                                                            shapes.remove(i); //remove shape element at j
                                                            //shapes.add(new Star(this,newX,newY,newWidth,newHeigth,newShapeType));
                                                       //     repaint();
         private void handleCollision()
              //we iterate through all the balls, checking for collision
              for(int i=0;i<shapes.size();i++)
                   for(int j=0;j<shapes.size();j++)
                             if(i!=j)
                                  if(collide(shapes.get(i), shapes.get(j)))
                                        shapes.get(i).hit(shapes.get(j));
                                       shapes.get(j).hit(shapes.get(i));                                   
         boolean collide(Shape b1, Shape b2)
              double wx=b1.getCenterX()-b2.getCenterX();
              double wy=b1.getCenterY()-b2.getCenterY();
              //we calculate the distance between the centers two
              //colliding balls (theorem of Pythagoras)
              double distance=Math.sqrt(wx*wx+wy*wy);
              if(distance<b1.shapeSize)     
                   audioClip.playRectangle();
                   return true;          
                   else return false;     
         public static int vectorSize()
              return shapes.size();
    }the drawing stops and
    i have this error after a while
    arrayList<e>.RangeCheck(int)line 546
    moreover it doesn t draw a bigger shape as i want with the line
    shapes.add(new Circle(this,newX,newY,newWidth,newHeigth,newShapeType));
                                                       help please the deadline is Tomorrow;

    Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 4, Size: 4
         at java.util.ArrayList.RangeCheck(ArrayList.java:546)
         at java.util.ArrayList.get(ArrayList.java:321)
         at ShapePanel.checkTypeCollision(ShapePanel.java:156)
         at ShapePanel.actionPerformed(ShapePanel.java:77)
         at javax.swing.Timer.fireActionPerformed(Timer.java:271)
         at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    it doesn t compile because is part of a bigger project

  • QUICK MAX DUKE DOLLARS!!!

    Project.java is a simple drawing program.
    Modify the program to draw not only circles, but rectangles,
    filled circles, filled rectanges and lines. Modify the program
    so the user can change the color of a shape and clear the
    drawing.
    Use proper object orient techniques in making your modifications.
    There is some code that is in the sample program that could
    be improved. Make any modifications that you feel are necessary
    to improve the code. The code simple shows you how to perform
    the drawing operations.
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    * This is a simply drawing program which lets the user draw basic shapes
    * (lines, ovals and rectangles). This program currently only lets the
    * user draw ovals, and the only color displayed is black.
    * The drawing program uses rubberbanding so that the user can see the
    * shape as they drag it. When the use clicks down on the mouse it
    * sets the starting, or anchor, point for the drawing. When they release
    * the button the shape is drawn. As the user holds down the button and
    * drags the mouse, the shape is constantly displayed.
    public class Project extends Panel
    Panel controlPanel; // Contains for controls to determine shape and color
    ScrollPane drawPane; // A scrollable drawing pane
    Label shapeLabel; // A label for the shape drop down list
    Label colorLabel; // a label for the color drop down list
    Choice shapeChoice; // Drop down list (combbox) for selecting the shape
    Choice colorChoice; // drop down lsit for selecting the color
    Button clearButton; // For clearing the drawing canvas
    Color currentColor = Color.black; // The current color used to draw shapes
    DrawCanvas drawCanvas; // a Canva on which we draw the shapes
    Vector shapes; // A vector to hold all of the shapes
    protected String []shapeTypes = {"circle", "rectangle", "filled circle",
    "filled rectangle", "line" };
    protected String []colors = {"red", "blue", "green", "yellow", "orange",
    "white", "black", "gray", "dark gray", "light gray",
    "cyan", "magenta", "pink"};
    Point anchorPoint; // The anchor point
    Point endPoint; // The point where the mouse was released
    Point stretchPoint; // The point where the user dragged the mouse to
    Point lastPoint; // The previous drag point
    boolean firstTime = true; // first time drawing this shape?
    * Add GUI components
    public Project()
    // GridBagLayout is the most powerful and difficult to
    // use Layout manager
    // The layout manager determines were components are placed on
    // the screen. There is no need to modify it in any way.
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gc = new GridBagConstraints();
    // Create the control panel
    setLayout(gbl);
    controlPanel = new Panel();
    setConstraints(controlPanel, gbl, gc, 0, 0,
    GridBagConstraints.REMAINDER, 1, 0, 0,
    GridBagConstraints.CENTER,
    GridBagConstraints.NONE,
    0, 0, 0, 0);
    add(controlPanel, gc);
    shapeLabel = new Label("Shape"); // The Label for the shape drop down list
    controlPanel.add(shapeLabel);
    shapeChoice = new Choice(); // The dropdown list
    controlPanel.add(shapeChoice);
    colorLabel = new Label("Color"); // The label or the color drop down list
    controlPanel.add(colorLabel);
    colorChoice = new Choice(); // The drop down list
    controlPanel.add(colorChoice);
    clearButton = new Button("Clear"); // the clear button
    controlPanel.add(clearButton); // Doesn't do anything
    // Event handelers
    // Handle the event when the user selects a new shape
    shapeChoice.addItemListener(new ShapeHandler());
    // Event when user selects new color
    colorChoice.addItemListener(new ColorHandler());
    // Event when user click clear button
    clearButton.addActionListener(new ClearHandler());
    //Create the drawing area
    drawPane = new ScrollPane();
    setConstraints(drawPane, gbl, gc, 0, 1,
    GridBagConstraints.REMAINDER, 1, 1, 1,
    GridBagConstraints.CENTER,
    GridBagConstraints.BOTH,
    5, 0, 5, 0);
    add(drawPane, gc);
    drawPane.setSize(300,300);
    drawCanvas = new DrawCanvas(400,400);
    drawPane.add(drawCanvas);
    initShapes(); // initialize the shape choice control
    initColors(); // initialzie the color choice control
    shapes = new Vector();
    // Convenience method for GridBagLayout
    private void setConstraints(
    Component comp,
    GridBagLayout gbl,
    GridBagConstraints gc,
    int gridx,
    int gridy,
    int gridwidth,
    int gridheight,
    int weightx,
    int weighty,
    int anchor,
    int fill,
    int top,
    int left,
    int bottom,
    int right)
    gc.gridx = gridx;
    gc.gridy = gridy;
    gc.gridwidth = gridwidth;
    gc.gridheight = gridheight;
    gc.weightx = weightx;
    gc.weighty = weighty;
    gc.anchor = anchor;
    gc.fill = fill;
    gc.insets = new Insets(top, left, bottom, right);
    gbl.setConstraints(comp, gc);
    // Initialize the shape control
    private void initShapes()
    for(int i = 0; i < shapeTypes.length; i++){
    shapeChoice.add(shapeTypes);
    // Initialzie the color control
    private void initColors()
    for(int i = 0; i < colors.length; i++){
    colorChoice.add(colors);
    * Handle the shape selection
    * This doesn't currently do anything
    public class ShapeHandler implements ItemListener
    public void itemStateChanged(ItemEvent e)
    // Use get index method to get the index of the chosen shape
    // shapeType = shapeChoice.getSelectedItem();
    * Handle the color seclection
    * This doesn't do anything either
    public class ColorHandler implements ItemListener
    public void itemStateChanged(ItemEvent e)
    String color = colorChoice.getSelectedItem();
    System.out.println("Selected color " + color);
    // Handle the clear button
    // This doesn't do anything
    public class ClearHandler implements ActionListener
    public void actionPerformed(ActionEvent e)
    * A canvas to draw on
    public class DrawCanvas extends Component
    int width; // The Width of the Canvas
    int height; // The Height of the Canvas
    /** Create an area to draw on
    *@param width - the width of the drawing area
    *@param height - the height of the drawing area
    public DrawCanvas(int width, int height)
    // Handle mouse press and release events
    addMouseListener(new MouseHandler());
    // handle mouse drag events
    addMouseMotionListener(new MouseDragHandler());
    this.width = width;
    this.height = height;
    * Draw all of the shapes
    * Not very efficient
    public void paint(Graphics g)
    for (Enumeration e = shapes.elements() ; e.hasMoreElements() ;)
    Circle c = (Circle )e.nextElement();
    System.out.println("drawing Circle " + c.toString());
    c.draw(g);
    * Let everyone know what the preferred size of the drawing
    * canvas is
    public Dimension getPreferredSize()
    return new Dimension(width, height);
    * Used with rubberbanding. The way to erase a shape is
    * to draw it again in XOR mode.
    private void eraseLast(Graphics g)
    int x, y;
    int width, height;
    if (anchorPoint == null || lastPoint == null)
    return;
    // The draw methods assume that the width and height are
    // not negative so we do the following caculations to
    // insure that they are not
    if (anchorPoint.x < lastPoint.x)
    x = anchorPoint.x;
    else
    x = lastPoint.x;
    if (anchorPoint.y < lastPoint.y)
    y = anchorPoint.y;
    else
    y = lastPoint.y;
    width = Math.abs(lastPoint.x - anchorPoint.x);
    height = Math.abs(lastPoint.y - anchorPoint.y);
    // Draw the circle (or oval) at the rectagle bounded by
    // the rectange with the upper left hand corner of x,y
    // and with the specified width and height
    g.drawOval(x, y, width, height);
    // To draw a rectable
    //g.drawRect(x, y, width, height);
    // To draw a Filled Oval
    //g.fillOval(x, y, width, height);
    // To draw a Filled Rect
    //g.fillRect(x, y, width, height);
    // To draw a line
    //g.drawLine(anchorPoint.x, anchorPoint.y, lastPoint.x, lastPoint.y);
    * Do the rubber band drawing
    private void drawRubber(Graphics g)
    int x, y;
    int width, height;
    if (anchorPoint.x < stretchPoint.x)
    x = anchorPoint.x;
    else
    x = stretchPoint.x;
    if (anchorPoint.y < stretchPoint.y)
    y = anchorPoint.y;
    else
    y = stretchPoint.y;
    width = Math.abs(stretchPoint.x - anchorPoint.x);
    height = Math.abs(stretchPoint.y - anchorPoint.y);
    g.drawOval(x, y, width, height);
    * Handle the start and end of rubberbanding. At the end
    * draw the final shape
    public class MouseHandler extends MouseAdapter
    // Get the starting point
    public void mousePressed(MouseEvent e)
    anchorPoint = e.getPoint(); // Point where mouse was clickec
    firstTime = true; // The first point
    // Get the end point
    public void mouseReleased(MouseEvent e)
    endPoint = e.getPoint(); // Point where mouse was released
    Graphics g = getGraphics(); // Get the object to draw on
    g.setXORMode(getBackground()); // Set XOR mode
    eraseLast(g); // Erase the previous shape
    // Add the shape to our vector
    //Obviously you will need to do something different here
    shapes.addElement( new Circle(anchorPoint, endPoint, currentColor));
    repaint(); // Repaint the entire drawing
    g.dispose(); // Need to dispose of Graphics objects
    * Handle the rubber banding
    public class MouseDragHandler extends MouseMotionAdapter
    // Every time the mouse is moved while the mouse button is pressed
    public void mouseDragged(MouseEvent e)
    Graphics g = getGraphics();
    g.setXORMode(getBackground());
    stretchPoint = e.getPoint(); // Get the point we just dragged to
    if (firstTime == true)
    firstTime = false; // nothing to erase the first time
    else
    eraseLast(g); // Erase the last drawing
    drawRubber(g); // Draw the new one
    g.dispose(); // Anytime we do a getGraphics we must dispose of it
    lastPoint = stretchPoint; // Set the lastPoint to lastest last point
    * In real program this should extend Shape or implement a Shape
    * interface and it should be in it's own file
    * Note that even though this is called Circle, it is really an oval
    public class Circle
    int x, y; // X and Y cooridinates of bounding rectangle (upper left)
    int width, height; // width and height of bounding rectangle
    Point p2; // opposite corner of bounding retangle
    Color color; // color of circle
    public Circle(Point p1, Point p2, Color color)
    // The width and height cannot be negative.
    // x and y must always be the upper left corner
    if ( p1.x < p2.x)
    x = p1.x;
    else
    x = p2.x;
    if (p1.y < p2.y)
    y = p1.y;
    else
    y = p2.y;
    width = Math.abs( p2.x - p1.x);
    height = Math.abs(p2.y - p1.y);
    this.color = color;
    * This method is called automatically by repaint and whenever the
    * window needs to be redrawn
    public void draw(Graphics g)
    Color c = g.getColor(); // Save the current color
    g.setColor(color); // Set the color to draw the circle
    g.drawOval(x, y, width, height); // draw the circle
    g.setColor(c); // set the color back to what is was before
    * a toString method is a convienent way of
    * displaying the attributes of a class
    public String toString()
    return "Circle " + color + width + height;
    * Main method creates a Frame and adds in our drawing control
    public static void main(String []args)
    // Create the main window
    Frame frame = new Frame();
    // add a listener to close the window properly
    frame.addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e){
    System.exit(0); // simply exit
    // Create our control
    Project panel = new Project();
    // add it to our window
    frame.add(panel, BorderLayout.CENTER);
    // size our window to 640 by 480 pixels
    frame.setSize(640, 480);
    // display our window
    frame.setVisible(true);
    }

    Sure, I'll do it, no problem... Anything to help a fellow hard working computer science student... I'm just curious what college you attend. Could you tell me? I promise I'll get you the code then.

  • Consecutive numbers in java?

    I am creating a slot machine class with 3 rotating disks and every disk contains the integers 0 - 9. The user will input 3 numbers of their choosing and the amount they are wagering. I am only to use if statements, i cant use arrays or random number generators or anything like that. I am having difficulty figuring out how i would tell my program to check the numbers the user inputs to make sure they are consecutive numbers in ANY order. Any number meaning it could be 1 2 3, 1 3 2, 2 1 3, 2 3 1, 3 2 1, 3 1 2.
    so far i've got this for my slot machine class:
    public class SlotMachine
    private int DiskOne;
    private int DiskTwo;
    private int DiskThree;
    private int AmountWagered;
    public SlotMachine(int diskOne,int diskTwo,int diskThree,int amountWagered)
    this.DiskOne = diskOne;
    this.DiskTwo = diskTwo;
    this.DiskThree = diskThree;
    this.AmountWagered = amountWagered;
    public int getDiskOne()
    return this.DiskOne;
    public int getDiskTwo()
    return this.DiskTwo;
    public int getDiskThree()
    return this.DiskThree;
    public int getAmountWagered()
    return this.AmountWagered;
    public String amountWon()
    if (DiskOne == DiskTwo && DiskTwo == DiskThree)
    return "All 3 Numbers The Same" + AmountWagered * 100;
    else if(DiskOne == DiskTwo || DiskTwo == DiskThree || DiskOne == DiskThree)
    return "Any 2 Numbers The Same" + AmountWagered * 4;
    else if() // This is where i need some help =/ anyone?
    return "3 Consecutive Numbers In Any Order" + AmountWagered * 20;
    else
    return "You Lose";
    }

    okay here it goes.
    Arithmetic progression talks about sequence of numbers
    Let the master sequnce of numbers be
    1 2 3 4 5 6 7 8 9and occurance of sub sequence of the above sequence is to be detected.
    (For simplicity we assume sequence starts from ONE)
    Arithmetic progression says
    T(n) = a+ (n-1)*d
    where
    a = fist term of the progression
    T(n) means number that occurs at Nth position
    d = common difference between two consecuitive numbers'd' would be ONE for the original sequence, as each consecutive number is ONE greater than the previous one.
    POSITIVE SCENARIO:
    Let the input sequence be
    7 6 8First arrange this in increasing order and the sequence becomes
    6 7 8Now this CAN be arithmetic progression (but we still dont know now!)
    This is how we validate-
    a = 1 (as the sequence starts from 1)
    n = 6 (first number after arranging in ascending order)
    (In other words, I'm saying that 6th position in original sequence should have '6')
    d = 3rd number - 2nd number = 8 - 7 = 1
    T(6) = a + (n-1) * d
         = 1 + (6-1) * 1
         = 1 + 5
         = 6The above math means that 6th element of the original sequence is '6' which is CORRECT. Let us now check the thrid element of the input sequence 6 7 8
    T(8) = a + (n-1) * d
         = 1 + (8-1) * 1
         = 1 + 7
         = 8The above math means that 8th element of the original sequence is '8' which is CORRECT. The two checks have passed.
    This is what we have done till now: for given sequence of *6 7 8*, we verified that 6th place in the original sequence is '6' and 8th place is '8' as depicted by the input sub sequence *6 7 8*. As both match, the sequence *6 7 8* is declared to be sub sequence of the original sequence. In other words, the input jumbled sequence *7 6 8* is sub sequence of the original sequence irrespetive of the order.
    Note that we sort the numbers to ensure even jumbled input can also be validated!
    NEGATIVE SCENARIO:
    We now check if the logic developed till now does identify wrong sequences as WRONG.
    Let the input now be
    5 9 1Arrange in ascending order first, so the sequence would be
    1 5 9
    a = 1 (as the sequence starts from 1)
    n = 1 (first number after arranging in ascending order)
    (In other words, with this assumption, I'm saying that 1st position should have '1' in the sequence)
    d = 3rd number - 2nd number = 9 - 5 = 4
    T(1) = a + (n-1) * d
         = 1 + (1-1) * 4
         = 1 + (1 - 1) * 4
         = 1 + 0
         = 1The above math means that 1st element of the original sequence is '1' which is CORRECT as depicted by the input sub sequence. Let us now check the thrid element of the input sequence 1 5 9
    T(9) = a + (n-1) * d
         = 1 + (9-1) * 4
         = 1 + (8) * 4
         = 1 + 32
         = 33The above math means that 9th position in the original sequence is 33 which is NOT (the 9th position in the original sequence is 9).
    This is what we have done till now: for given sequence of *1 5 9*, we verified that 1st place in the original sequence is '1' and 9th place is '33' as depicted by the input sub sequence *1 5 9*. As the second check fails, the sequence *1 5 9* is declared that it is not a sub sequence of the original sequence. In other words, the input jumbled sequence *5 9 1* is NOT sub sequence of the original sequence irrespetive of the order.
    Now you put this in a Java program_ :)
    Edited by: DynamicBasics on Oct 21, 2010 1:39 AM
    Corrected formatting tags

  • Instantiate Inheritance?

    Hey I'm writing a shape inheritance program where I'm supposed to create a main class, a shape class, a 4 different dimension classes, and 4 different shape classes. I wrote a similar program in C# and so tried transferring over some of the code but the instantiate process doesn't seem to be working. Specifically every line of code below has the same error except the last one.
    The first 5 lines
    "Cannot find symbol
    Symbol: Class Shape (Exchanging shape with, Point, Line, Circle, etc depending on the line)
    Location: Class Shapes.Main"
    The last line gives the error "Shapes.Shape is abstract; cannot be instantiated"
    Shape s = new Shape();
    I assume this is the real cause to the problem, but I'm unaware of what to do..
            Shape[] s = new Shape[4];
            s[0] = new Point(1, 2, 3);
            s[1] = new Line(new Point(2, 3, 4), new Point(4, 5, 6));
            s[2] = new Circle(new Point(5, 2, 8), 20);
            s[3] = new Sphere(new Point(4, 2, 3), 45);
    Shape s = new Shape();I provided a 4 classes, the main, the shapes class, 1 of the dimensions, and 1 of the shapes.
    package Shapes;
    @author student
    *public class Main {*
    *@param args the command line arguments*
        public static void main(String[] args) {
            Shape[] s = new Shape[4];
            s[0] = new Point(1, 2, 3);
            s[1] = new Line(new Point(2, 3, 4), new Point(4, 5, 6));
            s[2] = new Circle(new Point(5, 2, 8), 20);
            s[3] = new Sphere(new Point(4, 2, 3), 45);
            Shape s = new Shape();
            //For Loop with if statements in order
            for (int i = 0; i < s.Length; i++) //to check identifier type
                if (s[i] instanceof Point) {
                    Point P = (Point) s;
    if (s[i] instanceof Line) {
    Line L = (Line) s[i];
    L.GetLength();
    if (s[i] instanceof Circle) {
    Circle C = (Circle) s[i];
    if (s[i] instanceof Sphere) {
    Sphere B = (Sphere) s[i];
    } //Calling Print and Move statements
    s[i].Print();
    s[i].Move(2, 2, 2);
    s[i].Print();
    System.out.println("\n");
    package shapes;
    @author Student
    *abstract class Shape {*
    * protected int ShapeID;*
    * static private int X = 1000;*
    * //Shape Constructor*
    * public Shape() {*
    * ShapeID = X;*
    * X++;*
    * //Get Method for ID*
    * public int GetID() {*
    * return ShapeID;*
    * //toString
    +    public abstract void Print();+
    +    abstract public void Move(int a, int b, int c);+
    *+}+* package shapes;
    abstract class ZeroDShape extends Shape {
    abstract public void Print();
    abstract public void Move(int a, int b, int c);
    }package shapes;
    * @author Student
    class Sphere extends ThreeDShape {
    private double Volume;
    private Point Loc;
    //Constructor
    public Sphere(Point A, double R) {
    Loc = A;
    Volume = 4 / 3 * Math.PI * (R * R * R);
    //Get Volume Method
    public double GetVolume() {
    return Volume;
    //Print Method
    public void Print() {
    System.out.println("Sphere:");
    System.out.println(super.toString());
    System.out.println("Volume = " + Volume);
    System.out.println("Location Sphere: " + Loc + "\n");
    //Move Method
    public void Move(int a, int b, int c) {
    Loc.Move(a, b, c);
    }Any advice or feedback would be much appreciated, thank you in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Wolverine72 wrote:
    The last line gives the error "Shapes.Shape is abstract; cannot be instantiated"Absolutely correct.
    Shape s = new Shape();Absolutely wrong. You never use new with an abstract class. They are written specifically for extension, and you use it with the subclass.
    I assume this is the real cause to the problem, but I'm unaware of what to do..Well I guess the question is: why are you doing it? You've already set up your shapes.
    Plus, the following looks very suspicious:
    static private int X = 1000;
    //Get Method for ID
    public int GetID() {
       return ShapeID;
    }The whole point of polymorphism is to avoid exactly this kind of dispatch-type logic.
    Don't "get a method for the ID"; override it correctly in your subclass. Java will make sure that the correct method is called.
    HIH
    Winston

  • Webcharts3D Question

    All,
    I have a question regarding WebCharts3D. I've created some
    gauge charts in PNG format. Each gauge displays "high level" data
    for a certain category. Now what I've been asked to do is to make
    the gauge "clickable" - i.e. make it a hyperlink to another page
    that will provide greater detail regarding the gauge's category.
    Initially I thought it'd be a no brainer to create a link.
    However when I tried it, it doesn't work.
    <a href="test.cfm">#chartTag#</a>
    The #chartTag# falls within an opening/closing cfoutput and
    when I mouseover the gauge I see the URL in the status bar and the
    mouse turns from pointer to hand - just as a link typcially acts.
    But when I click it, nothing happens.
    Is there any way to add a link to a chart created via
    WebCharts3D on CF8?
    Thanks!
    Brian

    One way is to set the action property of
    elements to a javascript function:
    javascript:goToSomeOtherPage()
    Then add the javascript function in your cfm page to do the
    redirect
    function goToSomeOtherPage() {
    window.location = 'SomeOtherPage.cfm';
    Alternately, you can set the action to a URL.
    EDIT: Nevermind. I am thinking MX7 dial chart elements.
    Though there should be a chart level action or event handler you
    can use. I do not know the setting name off the top of my
    head.

  • Error in Java console

    Hi experts
    when I run Network UI Element
    to presnt org Chart
    I get in  IE->Tools->Java Console
    the follow error:
    <<<--- Applet.destroy(): AppWin0/JNET --->>>
    <<<--- EXIT for AppWin0/JNET --->>>
    java.lang.NullPointerException
         at sun.plugin.javascript.ocx.JSObject.eval(Unknown Source)
         at com.sap.tc.webdynpro.ace.Acf2JavaScriptClient$1.run(Acf2JavaScriptClient.java:55)
         at java.lang.Thread.run(Unknown Source)
    ACF 7.1000.0.71
    <<< frog.jar: version 5.4.6  02/01/06  sap.theme: null >>>

    this is the file:
    // This file has been generated partially by the Web Dynpro Code Generator.
    // MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.
    // ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.
    package co.il.bnhp;
    // IMPORTANT NOTE:
    // ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED
    // BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN
    // AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateOrgTree).
    // OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY
    // A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS
    // OF IMPORT STATEMENTS.
    //@@begin imports
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.StringWriter;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.OutputKeys;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerFactoryConfigurationError;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.sax.SAXSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.DOMException;
    import org.w3c.dom.DOMImplementation;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Entity;
    import org.w3c.dom.Node;
    import org.w3c.dom.Text;
    import org.xml.sax.SAXException;
    import co.i.bnhp.model.Zhr_Rfc_Disp_Manger_Employees2_Input;
    import co.il.bnhp.wdp.IPrivateOrgTree;
    import co.il.bnhp.wdp.IPublicOrgTree;
    import com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException;
    import com.sap.tc.webdynpro.progmodel.api.WDResourceFactory;
    import com.sap.tc.webdynpro.services.sal.deployment.api.WDAliasResolvingException;
    import com.sap.tc.webdynpro.services.sal.url.api.WDURLGenerator;
    import com.sap.tc.webdynpro.services.sal.url.api.WDWebResource;
    import com.sap.tc.webdynpro.services.sal.url.api.WDWebResourceType;
    //@@end
    //@@begin documentation
    //@@end
    public class OrgTree
    Logging location.
      private static final com.sap.tc.logging.Location logger =
        com.sap.tc.logging.Location.getLocation(OrgTree.class);
      static
        //@@begin id
        String id = "$Id$";
        //@@end
        com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);
    Private access to the generated Web Dynpro counterpart
    for this controller class.  </p>
    Use <code>wdThis</code> to gain typed access to the context,
    to trigger navigation via outbound plugs, to get and enable/disable
    actions, fire declared events, and access used controllers and/or
    component usages.
    @see co.il.bnhp.wdp.IPrivateOrgTree for more details
      private final IPrivateOrgTree wdThis;
    Root node of this controller's context. </p>
    Provides typed access not only to the elements of the root node
    but also to all nodes in the context (methods node<i>XYZ</i>())
    and their currently selected element (methods current<i>XYZ</i>Element()).
    It also facilitates the creation of new elements for all nodes
    (methods create<i>XYZ</i>Element()). </p>
    @see co.il.bnhp.wdp.IPrivateOrgTree.IContextNode for more details.
      private final IPrivateOrgTree.IContextNode wdContext;
    A shortcut for <code>wdThis.wdGetAPI()</code>. </p>
    Represents the generic API of the generic Web Dynpro counterpart
    for this controller. </p>
      private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdControllerAPI;
    A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>
    Represents the generic API of the Web Dynpro component this controller
    belongs to. Can be used to access the message manager, the window manager,
    to add/remove event handlers and so on. </p>
      private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;
      public OrgTree(IPrivateOrgTree wdThis)
        this.wdThis = wdThis;
        this.wdContext = wdThis.wdGetContext();
        this.wdControllerAPI = wdThis.wdGetAPI();
        this.wdComponentAPI = wdThis.wdGetAPI().getComponent();
      //@@begin javadoc:wdDoInit()
      /** Hook method called to initialize controller. */
      //@@end
      public void wdDoInit()
        //@@begin wdDoInit()
        buildDOM();
        //@@end
      //@@begin javadoc:wdDoExit()
      /** Hook method called to clean up controller. */
      //@@end
      public void wdDoExit()
        //@@begin wdDoExit()
        //@@end
      //@@begin javadoc:wdDoPostProcessing()
    Hook called to handle data retrieval errors before rendering.
    After doModifyView(), the Web Dynpro Framework gets all context data needed
    for rendering by validating the contexts (which in turn calls the supply
    functions and supplying relation roles). In this hook, the application
    should handle the errors which occurred during validation of the contexts.
    Using preorder depth-first traversal, this hook is called for all component
    controllers starting with the current root component.
    Permitted operations:
    - Flushing model queue
    - Creating messages
    - Reading context and model data
    Forbidden operations:
    - Invalidating model data
    - Manipulating the context
    - Firing outbound plugs
    - Creating components
    @param isCurrentRoot true if this is the root of the current request
      //@@end
      public void wdDoPostProcessing(boolean isCurrentRoot)
        //@@begin wdDoPostProcessing()
        //@@end
      //@@begin javadoc:wdDoBeforeNavigation()
    Hook before the navigation phase starts.
    This hook allows you to flush the model queue and handle any
    errors that occur. Firing outbound plugs is allowed in this hook.
    Using preorder depth-first traversal, this hook is called for all component
    controllers starting with the current root component.
    @param isCurrentRoot true if this is the root of the current request
      //@@end
      public void wdDoBeforeNavigation(boolean isCurrentRoot)
        //@@begin wdDoBeforeNavigation()
        //@@end
      //@@begin javadoc:wdDoApplicationStateChange()
    Hook that informs the application about a state change.
    <p>
    This hook is called e.g. to tell the application that will be
    <ul>
    <li>left via a suspend plug and therefore should go into a suspend/sleep
         mode with minimal need of resources. errors that occur. Firing
         outbound plugs is allowed in this hook.
    <li>left due to a timeout and could write it's state to a data base if the
         user comes back later on
    </ul>
    The concrete reason is available via IWDApplicationStateChangeInfo
    <p>
    <b>Important</b>: This hook is called for the top level component only!
    @param stateChangeInfo contains the information about the nature of the state change
    @param stateChangeReturn allows the application to ask for a different state change.
           The framework is allowed to ignore it considering i.e. the current resources situation.
      //@@end
      public void wdDoApplicationStateChange(com.sap.tc.webdynpro.progmodel.api.IWDApplicationStateChangeInfo stateChangeInfo, com.sap.tc.webdynpro.progmodel.api.IWDApplicationStateChangeReturn stateChangeReturn)
        //@@begin wdDoApplicationStateChange()
        //@@end
      //@@begin javadoc:buildDOM()
      /** Declared method. */
      //@@end
      public void buildDOM( )
        //@@begin buildDOM()
         //  File fileName = new File ("orgchart.xml");
          wdThis.wdGetEmpUserIdInterface().getemp();
         wdContext.currentContextElement().setPernrRet(wdContext.currentContextElement().getPernrRet());
                Zhr_Rfc_Disp_Manger_Employees2_Input input = new co.i.bnhp.model.Zhr_Rfc_Disp_Manger_Employees2_Input();
                wdContext.nodeZhr_Rfc_Disp_Manger_Employees2_Input().bind(input);
                 input.setP_Pernr("1511");
               //input.setP_Pernr(wdContext.currentContextElement().getPernrRet());               
                   try{
                        String xmlFile =WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), "//tmp//tipex.xml");
                        File  file = new File(xmlFile);
                        //Creating an empty XML Document
                        //We need a Document
                        input.execute();
                        wdContext.nodeSource().invalidate();
                        DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
                        DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
                   //     DOMImplementation impl = docBuilder.getDOMImplementation();
                        Document doc = docBuilder.newDocument();
                        //Creating the XML tree
                                  Element SapJNETData = doc.createElement("SAPJNetData");                              
                                SapJNETData.setAttribute("version","1.0");
                            doc.appendChild(SapJNETData);
                          //  Element typeRepository = doc.createElement("TypeRepository");
                          //  typeRepository.setAttribute("href","
    tmp
    TypeRepository.xml");
                           // SapJNETData.appendChild(typeRepository);
                                Element typeRepository = doc.createElement("TypeRepository");
                                  typeRepository.setAttribute("id","orgchart");
                                  typeRepository.setAttribute("version","1.0");
                                  SapJNETData.appendChild(typeRepository);
                                Element color = doc.createElement("COLOR");
                                typeRepository.appendChild(color);
                                Element type1 = doc.createElement("type");
                                 type1.setAttribute("name","OCBlue");
                                 Element rgb1 = doc.createElement("rgb");
                                Text textRGB1 = doc.createTextNode("0,0,128");
                                color.appendChild(type1);
                                rgb1.appendChild(textRGB1);
                                type1.appendChild(rgb1);
                                Element type2 = doc.createElement("type");
                                 type2.setAttribute("name","OCGray");
                                  Element rgb2 = doc.createElement("rgb");
                                 Text textRGB2 = doc.createTextNode("215,220,216");
                                  color.appendChild(type2);
                                  rgb2.appendChild(textRGB2);
                                  type2.appendChild(rgb2);                      
                                Element type3 = doc.createElement("type");
                                  type3.setAttribute("name","OCGrayer");
                                  Element rgb3 = doc.createElement("rgb");
                                  Text textRGB3 = doc.createTextNode("195,200,196");
                                  color.appendChild(type3);
                                  rgb3.appendChild(textRGB3);
                                  type3.appendChild(rgb3);
                                Element type4 = doc.createElement("type");
                                  type4.setAttribute("name","OCLighter");
                                  Element rgb4 = doc.createElement("rgb");
                                  Text textRGB4 = doc.createTextNode("235,240,236");
                                  color.appendChild(type4);
                                  rgb4.appendChild(textRGB4);
                                  type4.appendChild(rgb4);
                                Element layout = doc.createElement("LAYOUT");
                                  typeRepository.appendChild(layout);
                                Element typeLayout = doc.createElement("type");
                                  typeLayout.setAttribute("name","OCLayout");
                                 Element style = doc.createElement("style");
                                 Text textStyle = doc.createTextNode("VERTICAL_FLOW");
                                  layout.appendChild(typeLayout);
                                  typeLayout.appendChild(style);
                                  style.appendChild(textStyle);
                                Element label = doc.createElement("LABEL");
                                  typeRepository.appendChild(label);
                                Element typeLabel1 = doc.createElement("type");
                                typeLabel1.setAttribute("name","OCLabelBase");
                                Element colorLabel = doc.createElement("color");
                                  colorLabel.setAttribute("type","Black");
                                Element font1 = doc.createElement("font");
                                  Element size1 = doc.createElement("size");
                              Text textSize1 = doc.createTextNode("12");
                                Element multiLine =doc.createElement("multiLine");
                                Text textMultiLine=doc.createTextNode("TRUE");
                                Element hAlign = doc.createElement("halign");
                                Text textHalign = doc.createTextNode("CENTER");
                                Element hAlignText = doc.createElement("halignText");
                                 Text textHalignText = doc.createTextNode("CENTER");
                                 Element border1 = doc.createElement("border");
                                 Element insets1 = doc.createElement("insets");
                                 insets1.setAttribute("top","3");
                                 Element typeLabel2 = doc.createElement("type");
                                 typeLabel2.setAttribute("name","OCLabelOrgUnit");
                                 typeLabel2.setAttribute("inherits","OCLabelBase");
                                 Element colorLabel2 = doc.createElement("color");
                                  colorLabel2.setAttribute("type","OCBlue");
                                  Element fillColorLabel2 = doc.createElement("fillColor");
                                  fillColorLabel2.setAttribute("type","OCGrayer");
                                  Element font2 = doc.createElement("font");
                                  Element style2 = doc.createElement("style");
                                  Text textStyle2 = doc.createTextNode("BOLD");
                                  Element border2 = doc.createElement("border");
                                  Element thickness = doc.createElement("thickness");
                                  Text textThickness = doc.createTextNode("1");
                                 Element Side = doc.createElement("sides");
                                 Text textSide = doc.createTextNode("SOUTH");
                                 Element typeLabel3 = doc.createElement("type");
                                  typeLabel3.setAttribute("name","OCLabelNumber");
                                  typeLabel3.setAttribute("inherits","OCLabelBase");
                                  Element colorLabel3 = doc.createElement("color");
                                  colorLabel3.setAttribute("type","OCBlue");
                                  Element size3 = doc.createElement("size");
                                  Text textSize3 = doc.createTextNode("40,0");
                                  Element halign3 = doc.createElement("halign");
                                  Text textHalign3 = doc.createTextNode("RIGHT");
                                 Element multiLine3 = doc.createElement("multiline");
                                  Text textMultiLine3 = doc.createTextNode("FALSE");
                                  Element border3 = doc.createElement("border");
                                  Element Thickness3 = doc.createElement("thickness");
                                  Text textThickness3 = doc.createTextNode("1");
                                  Element insets3 = doc.createElement("insets");
                                  insets3.setAttribute("top","0");
                                 Element Sides3 = doc.createElement("sides");
                                 Text textSides3 = doc.createTextNode("NORTH,WEST");
                                Element typeLabel4 = doc.createElement("type");
                                  typeLabel4.setAttribute("name","OCLabelChief");
                                typeLabel4.setAttribute("inherits","OCLabelBase");
                                Element font4 = doc.createElement("font");
                                Element style4 = doc.createElement("style");
                                Element border4 = doc.createElement("border");
                                Element insets4 = doc.createElement("insets");
                                insets4.setAttribute("top","6");
                                Element edgeT = doc.createElement("EDGE");
                                Element typeEdge= doc.createElement("type");
                                typeEdge.setAttribute("name","OCLink");
                                Element Shape = doc.createElement("shape");
                                Element ThickNess =doc.createElement("thickness");
                                Element targetDeco = doc.createElement("targetdeco");
                                targetDeco.setAttribute("shape","NONE");
                                Element nodeT = doc.createElement("NODE");
                                Element typeNode = doc.createElement("type");
                                typeNode.setAttribute("name","OCNodeBase");
                                Element shape = doc.createElement("shape");
                                shape.setAttribute("type","Box");
                                Element fillColor = doc.createElement("fillColor");
                                fillColor.setAttribute("type","OCGray");
                                Element borderNode = doc.createElement("border");
                                Element styleNode = doc.createElement("style");
                                Element plugs = doc.createElement("plugs");
                                plugs.setAttribute("min","0");
                                plugs.setAttribute("position","SOUTH");
                                plugs.setAttribute("positionMode","CENTRIC");
                                Element socket = doc.createElement("sockets");
                                socket.setAttribute("min","0");
                                 socket.setAttribute("position","NORTH");
                                  socket.setAttribute("positionMode","CENTRIC");
                                Element OCNode = doc.createElement("type");
                                OCNode.setAttribute("name","OCNode");
                                OCNode.setAttribute("inherits","OCNodeBase");
                                Element OCNodeShape = doc.createElement("shape");
                                Element OCNodeSize = doc.createElement("size");
                                OCNodeSize.setAttribute("pack","true");
                                Element OClayout = doc.createElement("layout");
                                OClayout.setAttribute("type","OCLayout");
                                Element OCNodeArrowUp = doc.createElement("type");
                                OCNodeArrowUp.setAttribute("name","OCNodeArrowUp");
                                OCNodeArrowUp.setAttribute("inherits","OCNodeBase");
                                Element OCNodeArrowShape = doc.createElement("shape");
                                Element OcNodeArrowSize = doc.createElement("size");
                                Element OcNodeArrowLabel = doc.createElement("label");
                                Element OcNodeArrowicon = doc.createElement("icon");
                                Element OcNodeArrowHalign = doc.createElement("halign");
                                Element OCNodeArrowDown = doc.createElement("type");
                                   OCNodeArrowDown.setAttribute("name","OCNodeArrowDown");
                                  OCNodeArrowDown.setAttribute("inherits","OCNodeArrowUp");
                                   Element OCNodeArrowDownLabel = doc.createElement("label");
                                   Element OcNodeArrowDownIcon = doc.createElement("icon");
                                Element NodeGraph = doc.createElement("Graph");
                                Element OCGraph = doc.createElement("type");
                                OCGraph.setAttribute("name","OCGraph");
                                Element direction = doc.createElement("direction");
                                Element components = doc.createElement("components");
                                Element OCGraphLayouts = doc.createElement("layouts");
                                Element types = doc.createElement("types");
                                Element OCGraphlayout = doc.createElement("layout");
                                OCGraphlayout.setAttribute("type","TREE");
                                Element property1 = doc.createElement("property");
                                property1.setAttribute("name","STYLE");
                                property1.setAttribute("value","VARIABLE_SIZE");
                                Element property2 = doc.createElement("property");
                                property2.setAttribute("name","OFFS_X");
                                  property2.setAttribute("value","50");
                                Element property3 = doc.createElement("property");
                                property3.setAttribute("name","OFFS_Y");
                                  property3.setAttribute("value","30");
                                Element Graph = doc.createElement("Graph");
                                Graph.setAttribute("type","OCGraph");
                                 Graph.setAttribute("version","1.0");
                                 Element layouts = doc.createElement("layouts");
                                 layouts.setAttribute("onLoad","TREE");
                                 Element view = doc.createElement("view");
                                 Element grid = doc.createElement("grid");
                                 Text TextGrid = doc.createTextNode("80,80");
                                Element UserInterface = doc.createElement("userInterface");
                                UserInterface.setAttribute("version","1.0");
                                Element mode = doc.createElement("mode");
                                label.appendChild(typeLabel1);
                                  typeLabel1.appendChild(colorLabel);
                                  typeLabel1.appendChild(font1);
                                font1.appendChild(size1);
                                  size1.appendChild(textSize1);
                                typeLabel1.appendChild(multiLine);
                                multiLine.appendChild(textMultiLine);
                                typeLabel1.appendChild(hAlign);
                                hAlign.appendChild(textHalign);
                                typeLabel1.appendChild(hAlignText);
                                  hAlignText.appendChild(textHalignText);
                                  typeLabel1.appendChild(border1);
                                  border1.appendChild(insets1);
                                  label.appendChild(typeLabel2);
                                  typeLabel2.appendChild(colorLabel2);
                                  typeLabel2.appendChild(fillColorLabel2);
                                  typeLabel2.appendChild(font2);
                                  font2.appendChild(style2);
                                  style2.appendChild(textStyle2);
                                  typeLabel2.appendChild(border2);
                                  border2.appendChild(thickness);
                                  thickness.appendChild(textThickness);
                                  border2.appendChild(Side);
                                  Side.appendChild(textSide);
                                  label.appendChild(typeLabel4);
                                  typeLabel4.appendChild(font4);
                                  font4.appendChild(style4);
                                  style4.appendChild(doc.createTextNode("BOLD"));
                                  typeLabel4.appendChild(border4);
                                  border4.appendChild(insets4);
                                  label.appendChild(typeLabel3);
                                  typeLabel3.appendChild(colorLabel3);
                                  typeLabel3.appendChild(size3);
                                  size3.appendChild(textSize3);
                                  typeLabel3.appendChild(halign3);
                                  halign3.appendChild(textHalign3);
                                  typeLabel3.appendChild(multiLine3);
                                  multiLine3.appendChild(textMultiLine3);
                                  typeLabel3.appendChild(border3);
                                  border3.appendChild(Thickness3);
                                  Thickness3.appendChild(textThickness3);
                                  border3.appendChild(insets3);
                                 insets3.setAttribute("top","0");
                                  border3.appendChild(Sides3);
                                  Sides3.appendChild(textSides3);
                                typeRepository.appendChild(edgeT);
                                edgeT.appendChild(typeEdge);
                                typeEdge.appendChild(Shape);
                                Shape.appendChild(doc.createTextNode("BENT"));
                                typeEdge.appendChild(ThickNess);
                                ThickNess.appendChild(doc.createTextNode("1"));
                                typeEdge.appendChild(targetDeco);
                                typeRepository.appendChild(nodeT);
                                nodeT.appendChild(typeNode);
                                typeNode.appendChild(shape);
                                shape.appendChild(fillColor);
                                shape.appendChild(borderNode);
                                borderNode.appendChild(styleNode);
                                styleNode.appendChild(doc.createTextNode("RAISED"));
                                typeNode.appendChild(plugs);
                                typeNode.appendChild(socket);
                                nodeT.appendChild(OCNode);
                                OCNode.appendChild(OCNodeShape);
                                OCNodeShape.appendChild(OCNodeSize);
                                OCNodeSize.appendChild(doc.createTextNode("150,0"));
                                OCNode.appendChild(OClayout);
                                nodeT.appendChild(OCNodeArrowUp);
                                OCNodeArrowUp.appendChild(OCNodeArrowShape);
                                OCNodeArrowShape.appendChild(OcNodeArrowSize);
                                OcNodeArrowSize.appendChild(doc.createTextNode("22,21"));
                                OCNodeArrowUp.appendChild(OcNodeArrowLabel);
                                OcNodeArrowLabel.appendChild(OcNodeArrowicon);
                                OcNodeArrowicon.appendChild(doc.createTextNode("apps/orgchart/arrow-up.gif"));
                                OcNodeArrowLabel.appendChild(OcNodeArrowHalign);
                                OcNodeArrowHalign.appendChild(doc.createTextNode("CENTER"));
                                nodeT.appendChild(OCNodeArrowDown);
                                OCNodeArrowDown.appendChild(OCNodeArrowDownLabel);
                                OCNodeArrowDownLabel.appendChild(OcNodeArrowDownIcon);
                                OcNodeArrowDownIcon.appendChild(doc.createTextNode("apps/orgchart/arrow-down.gif"));
                                typeRepository.appendChild(NodeGraph);
                                NodeGraph.appendChild(OCGraph);
                                OCGraph.appendChild(direction);
                                direction.appendChild(doc.createTextNode("TOP_BOTTOM"));
                                OCGraph.appendChild(components);
                                  components.appendChild(doc.createTextNode("OCNode"));
                                OCGraph.appendChild(OCGraphLayouts);
                                OCGraphLayouts.appendChild(types);
                                types.appendChild(doc.createTextNode("TREE"));
                                OCGraphLayouts.appendChild(OCGraphlayout);
                                OCGraphlayout.appendChild(property1);
                                OCGraphlayout.appendChild(property2);
                                OCGraphlayout.appendChild(property3);                                                                                   
                                SapJNETData.appendChild(UserInterface);
                                UserInterface.appendChild(mode);
                                mode.appendChild(doc.createTextNode("SELECTONLY"));
                                  SapJNETData.appendChild(Graph);
                                  Graph.appendChild(layouts);
                                  Graph.appendChild(view);
                                  view.appendChild(grid);
                                  grid.appendChild(TextGrid);
                                for (int i=0; i<wdContext.nodeZhr_Rfc_Employees2().size(); i++) {
                                  IPublicOrgTree.IEmpElement Emp = wdContext.nodeEmp().createEmpElement();
                                  IPublicOrgTree.IZhr_Rfc_Employees2Element curEmp = wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(i);
                                  Element node  = doc.createElement("node");
                                  node.setAttribute("id",curEmp.getEmp_Pernr());
                                   node.setAttribute("type","OCNode");
                                   Element label1 = doc.createElement("label");
                                   label1.setAttribute("type","OCLabelOrgUnit");
                                   Text TextLabel1 = doc.createTextNode(curEmp.getEmp_Name());
                                   Element label2 = doc.createElement("label");
                                   label2.setAttribute("type","OCLabelChief");
                                   Text TextLabel2 = doc.createTextNode(curEmp.getEmp_Pernr());
                                   Graph.appendChild(node); 
                                   node.appendChild(label1);
                                   label1.appendChild(TextLabel1);
                                   node.appendChild(label2);
                                   label2.appendChild(TextLabel2);
                                   wdContext.nodeEmp().addElement(Emp);
                                   for (int i=0; i<wdContext.nodeZhr_Rfc_Employees2().size()-1; i++) {
                                       IPublicOrgTree.IEmpElement Emp = wdContext.nodeEmp().createEmpElement();
                                       IPublicOrgTree.IZhr_Rfc_Employees2Element  curEmp = wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(i);
                                       for (int j=i1; j<wdContext.nodeZhr_Rfc_Employees2().size(); j+)          
                                        if (wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(i).getEmp_Pernr().equals(wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(j).getEmp_Manager()))
                                            Element edge  = doc.createElement("edge");
                                            edge.setAttribute("type","OCLink");
                                            Element from = doc.createElement("from");
                                            from.setAttribute("node",curEmp.getEmp_Pernr());
                                            Element to = doc.createElement("to");
                                            to.setAttribute("node",wdContext.nodeZhr_Rfc_Employees2().getZhr_Rfc_Employees2ElementAt(j).getEmp_Pernr());
                                            Graph.appendChild(edge);
                                            edge.appendChild(from);
                                            edge.appendChild(to);
                             //     typeLabel3.appendChild()
                             //   Element font = doc.createElement("font");
                             //     .appendChild(color);
                             //   type1.appendChild(rgb1);
                                  //create a comment and put it in the root element
                             //     Comment comment = doc.createComment("Just a thought");
                             //     type1.appendChild(comment);
                                  //create child element, add an attribute, and add to root
                             //     Element child = doc.createElement("child");
                                  //child.setAttribute("name", "value");
                                  //type.appendChild(child);
                                  //add a text element to the child
                        //Output the XML
                        //set up a transformer
                        TransformerFactory transfac = TransformerFactory.newInstance();
                        Transformer trans = transfac.newTransformer();
                        trans.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-8");
                        trans.setOutputProperty(OutputKeys.INDENT, "yes");
                        //create string from xml tree
                        StringWriter sw = new StringWriter();
                       StreamResult result = new StreamResult(file);
                       DOMSource source = new DOMSource(doc);
                        trans.transform(source, result);
                        wdContext.currentContextElement().setXmlString(sw.toString());
                   } catch (DOMException e) {
                        wdComponentAPI.getMessageManager().reportException("2-"+e.getMessage(),true);
                   } catch (TransformerConfigurationException e) {
         

  • DVI and HDMI

    Hi..
      I bought a new 24" 1080p HD LCD Monitor which has both DVI and HDMI inputs.. but my VGA Card is NX7600GS-T2D256EH which has 2 DVI out puts... Do I need to buy a VGA card with HDMI output to get 1080p HD resoulution or can I get 1080p output using DVI?
    Thx

    Quote from: Richard on 11-April-07, 20:48:30
    kamalmawa,
    Yes, 2048x1536 and 2560x1600 are both greater then 1920×1080.
    But then again, I never studied new math, so I could be wrong.
    Richard
    some guy told me that I must have HDMI for 1080p and he also told me about 1080p and 1080i which really made me confused...
    I found an article about DVI simply explained in here http://en.wikipedia.org/wiki/DVI
    But I wanted to confirm with you guys as you guys more experienced in this kind of things..
    Thx again for the reply Richard..
    Kamal

  • Using LG CU320 as a Bluetooth Modem

    I was able to connect my LG CU320 Cingular Phone as a bluetooth modem and verified a 217 kilobits per second connection.
    I got some of this information from http://www.howardforums.com/showthread.php?t=874483.
    Click on the Bluetooth icon in the menu bar and choose setup bluetooth device.
    Choose Mobile phone.
    You'll have to make sure you phone is "visible" from the bluetooth menu (may have that wrong, not sure how LG does it yet)
    Follow the instructions from your mac's bluetooth assistant
    Choose use Address book (if you want, don't know how that works yet) and as connection for internet.
    For settings choose high speed direct connection.
    for string (or number): 99**1#
    for username: [email protected]
    for password: CINGULAR1
    all is case sensitive (that means use capital letters).
    I know it seems weird but choose Sprint PCS Vision as the modem script. This is because the new 3G on Cingular is based on similar Sprint PCS Vision.
    Open up Internet connect from the Applications folder, click on Bluetooth and choose connect. This should work. Others are welcome to add their two cents.

    Are you in a UMTS area? I tried the same thing with my CU320.. Same settings and it starts to connect then immediatly disconnects.. I see the phone say "Connecting" then almost immediatly it says "Disconnecting".. My powerbook then says something about the modem disconnecting unexpectly and to try again.. I wonder if the dialing script is wrong, or if I am missing something else.. I am in a EDGE only area, so I wonder if it has to do with that and when UMTS launches here in a few months if that problem will go away?

Maybe you are looking for

  • Problem identify OBJECTS access for a session

    Hi when a try to see what object is take to determined session the database hands consult and close conections. The select clause is "select OBJECT from v$access where SID=<NUM>", this sentence consuming big cpu time, all system have a high numer of

  • Passing data to other classes

    I have two seperate classes in my program. The class with main sends an LinkedList to the other class with this statement... PanelB a = new PanelB(); a.setLink(points);Then in my other class I have this code... public LinkedList q;Then I have a subcl

  • Operating Systems supported

    Is it possible to run any web based dreamweaver application  in linux? What are the Operating system that Dreamweaver application supports? Please reply. It's urgent.

  • PS Elements 2.0  ???

    I recently purchased PS elements 2.0 at a garage sale.  Is it worth installing?  I realize it is an old version.  lindasew 47

  • The arrow keys on my wireless keyboard no longer scroll.

    The arrow keys on my wireless keyboard no longer respond or scroll. They will page down with the fn/command key, but do not respond by themselves. How can I fix this? This is with an iMac, 10.7.5. Thanks..