Package nextapp.echo2.app

Examples of nextapp.echo2.app.Extent


       
        return windowPane;
    }
   
    private void positionWindowPane(WindowPane windowPane) {
        Extent positionExtent = new Extent(nextPosition, Extent.PX);
        windowPane.setPositionX(positionExtent);
        windowPane.setPositionY(positionExtent);
        nextPosition += 20;
        if (nextPosition > 200) {
            nextPosition = 0;
View Full Code Here


            });
            addButton("Add Modal Window In A Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    WindowPane w1 = new WindowPane();
                    w1.setStyleName("Default");
                    w1.setWidth(new Extent(650));
                    w1.setHeight(new Extent(450));
                    w1.setTitle("Just A Window");
                    targetContentPane.add(w1);
                   
                    ContentPane c1 = new ContentPane();
                    final Button b1 = new Button("Click me:");
                    b1.setStyleName("Default");
                    b1.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            b1.setText(b1.getText() + "!");
                        }
                    });
                    c1.add(b1);

                    w1.add(c1);
                   
                    WindowPane w2 = new WindowPane();
                    w2.setStyleName("Default");
                    final Button b2 = new Button("Click me:");
                    b2.setStyleName("Default");
                    b2.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            b2.setText(b2.getText() + "!");
                        }
                    });
                    w2.add(b2);
                   
                    w2.setTitle("But this one is modal.");
                    w2.setModal(true);
                   
                    c1.add(w2);
                }
            });
            addButton("Add Constrained Size Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    WindowPane windowPane = createSimpleWindow("Constrained");
                    windowPane.setMinimumWidth(new Extent(400));
                    windowPane.setMaximumWidth(new Extent(500));
                    windowPane.setMinimumHeight(new Extent(200));
                    windowPane.setMaximumHeight(new Extent(280));
                    targetContentPane.add(windowPane);
                }
            });
            addButton("Add Default-Border Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    final WindowPane windowPane = new WindowPane();
                    positionWindowPane(windowPane);
                    windowPane.setTitle("Default-Border Window #" + windowNumber++);
                    targetContentPane.add(windowPane);
                   
                    Column windowPaneColumn = new Column();
                    windowPane.add(windowPaneColumn);
                    windowPaneColumn.add(new Label("First Name:"));
                    windowPaneColumn.add(new TextField());
                    windowPaneColumn.add(new Label("Last Name:"));
                    windowPaneColumn.add(new TextField());
                }
            });
            addButton("Add Immovable Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    WindowPane windowPane = createSimpleWindow("Immovable");
                    windowPane.setMovable(false);
                    targetContentPane.add(windowPane);
                }
            });
            addButton("Add Fixed Size Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    WindowPane windowPane = createSimpleWindow("Fixed Size");
                    windowPane.setResizable(false);
                    targetContentPane.add(windowPane);
                }
            });
            addButton("Add Immovable Fixed Size Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    WindowPane windowPane = createSimpleWindow("Immovable Fixed Size");
                    windowPane.setMovable(false);
                    windowPane.setResizable(false);
                    targetContentPane.add(windowPane);
                }
            });
            addButton("Add SplitPane Window (No Close Icon)", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    final WindowPane windowPane = new WindowPane();
                    windowPane.setClosable(false);
                    positionWindowPane(windowPane);
                    targetContentPane.add(windowPane);
                    windowPane.setTitle("SplitPane Window #" + windowNumber++);
                    windowPane.setTitleInsets(new Insets(10, 5));
                    windowPane.setStyleName("Default");
                    windowPane.setTitleBackground(new Color(0x2f2f4f));
                    windowPane.setWidth(new Extent(500, Extent.PX));
                    windowPane.setHeight(new Extent(300, Extent.PX));
                    SplitPane splitPane = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new Extent(42));
                    SplitPaneLayoutData splitPaneLayoutData;
                   
                    Button okButton = new Button("Ok");
                    okButton.addActionListener(new ActionListener() {
                        /**
                         * @see nextapp.echo2.app.event.ActionListener#actionPerformed(nextapp.echo2.app.event.ActionEvent)
                         */
                        public void actionPerformed(ActionEvent e) {
                            windowPane.getParent().remove(windowPane);
                        }
                    });
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0x5f5f9f));
                    splitPaneLayoutData.setInsets(new Insets(8));
                    splitPaneLayoutData.setAlignment(new Alignment(Alignment.CENTER, Alignment.DEFAULT));
                    splitPaneLayoutData.setOverflow(SplitPaneLayoutData.OVERFLOW_HIDDEN);
                    okButton.setLayoutData(splitPaneLayoutData);
                    okButton.setWidth(new Extent(100));
                    okButton.setStyleName("Default");
                    splitPane.add(okButton);
                   
                    Label contentLabel = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0xefefff));
                    contentLabel.setLayoutData(splitPaneLayoutData);
                    splitPane.add(contentLabel);
                   
                    windowPane.add(splitPane);
                }
            });
   
            addButton("Add Multiple SplitPane Nautilus Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    final WindowPane windowPane = new WindowPane();
                    windowPane.setStyleName("Default");
                    windowPane.setWidth(new Extent(500, Extent.PX));
                    windowPane.setHeight(new Extent(500, Extent.PX));
                    windowPane.setTitle("SP Nautilus Window #" + windowNumber++);
                    windowPane.add(new SplitPaneNestedTest(new Extent(50)));
                    positionWindowPane(windowPane);
                    targetContentPane.add(windowPane);
                }
            });
           
            addButton("Add Multiple SplitPane Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    final WindowPane windowPane = new WindowPane();
                    positionWindowPane(windowPane);
                    targetContentPane.add(windowPane);
                    windowPane.setTitle("Multiple SplitPane Window #" + windowNumber++);
                    windowPane.setTitleInsets(new Insets(10, 5));
                    windowPane.setStyleName("Default");
                    windowPane.setTitleBackground(new Color(0x2f2f4f));
                    windowPane.setWidth(new Extent(700, Extent.PX));
                    windowPane.setHeight(new Extent(500, Extent.PX));
                   
                    SplitPane splitPane1 = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL, new Extent(100));
                    splitPane1.setStyleName("DefaultResizable");
                    SplitPaneLayoutData splitPaneLayoutData;
                   
                    Label label;
                   
                    label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0x3fbf5f));
                    splitPaneLayoutData.setInsets(new Insets(5));
                    label.setLayoutData(splitPaneLayoutData);
                    splitPane1.add(label);

                    SplitPane splitPane2 = new SplitPane(SplitPane.ORIENTATION_VERTICAL, new Extent(120));
                    splitPane2.setStyleName("DefaultResizable");
                   
                    SplitPane splitPane3 = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL, new Extent(200));
                    splitPane3.setStyleName("DefaultResizable");
                    splitPane2.add(splitPane3);
                   
                    SplitPane splitPane4 = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL, new Extent(300));
                    splitPane4.setStyleName("DefaultResizable");
                    splitPane2.add(splitPane4);
                   
                    label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
View Full Code Here

    }
   
    public void testMappedTypeface() {
        Style style = styleSheet.getStyle(Component.class, "alpha");
        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        assertEquals(new Font(Font.VERDANA, Font.BOLD, new Extent(24, Extent.PT)), font);
    }
View Full Code Here

   
    public void testMultipleSpecifiedTypefaces() {
        Style style = styleSheet.getStyle(Component.class, "bravo");
        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        Font.Typeface customFace = new Font.Typeface("Verdana", new Font.Typeface("Arial"));
        assertEquals(new Font(customFace, Font.BOLD, new Extent(24, Extent.PT)), font);
    }
View Full Code Here

   
    public void testStyleConstants() {
        Style style = styleSheet.getStyle(Component.class, "charlie");
        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        assertEquals(new Font(Font.VERDANA, Font.BOLD | Font.ITALIC | Font.UNDERLINE | Font.OVERLINE | Font.LINE_THROUGH,
                new Extent(24, Extent.PT)), font);
    }
View Full Code Here

    }
   
    public void testInlineTypeface() {
        Style style = styleSheet.getStyle(Component.class, "delta");
        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        assertEquals(new Font(Font.VERDANA, Font.BOLD, new Extent(24, Extent.PT)), font);
    }
View Full Code Here

    /**
     * Test extent addition.
     */
    public void testAdd() {
        assertEquals(Extent.add(_50_EM, _50_EM), new Extent(100, Extent.EM));
    }
View Full Code Here

   
    /**
     * Test equality.
     */
    public void testEquals() {
        assertEquals(new Extent(20, Extent.CM), new Extent(20, Extent.CM));
        assertFalse(new Extent(20, Extent.CM).equals(new Extent(21, Extent.CM)));
        assertFalse(new Extent(20, Extent.MM).equals(new Extent(21, Extent.CM)));
    }
View Full Code Here

    /**
     * Test conversion to millimeters.
     */
    public void testToMm() {
        assertEquals(20, new Extent(20, Extent.MM).toMm());
        assertEquals(20, new Extent(2, Extent.CM).toMm());
        assertEquals(2540, new Extent(100, Extent.IN).toMm());
        assertEquals(2540, new Extent(7200, Extent.PT).toMm());
        assertEquals(2540, new Extent(600, Extent.PC).toMm());
       
        try {
            new Extent(1, Extent.EM).toMm();
            fail("Did not throw IllegalStateException.");
        } catch (IllegalStateException ex) {
            // Expected.
        }
       
        try {
            new Extent(1, Extent.EX).toMm();
            fail("Did not throw IllegalStateException.");
        } catch (IllegalStateException ex) {
            // Expected.
        }
       
        try {
            new Extent(1, Extent.PERCENT).toMm();
            fail("Did not throw IllegalStateException.");
        } catch (IllegalStateException ex) {
            // Expected.
        }
       
        try {
            new Extent(1, Extent.PX).toMm();
            fail("Did not throw IllegalStateException.");
        } catch (IllegalStateException ex) {
            // Expected.
        }
    }
View Full Code Here

    /**
     * Test conversion to points.
     */
    public void testToPoint() {
        assertEquals(20, new Extent(20, Extent.PT).toPoint());
        assertEquals(7200, new Extent(2540, Extent.MM).toPoint());
        assertEquals(7200, new Extent(254, Extent.CM).toPoint());
        assertEquals(7200, new Extent(100, Extent.IN).toPoint());
        assertEquals(7200, new Extent(600, Extent.PC).toPoint());
       
        try {
            new Extent(1, Extent.EM).toPoint();
            fail("Did not throw IllegalStateException.");
        } catch (IllegalStateException ex) {
            // Expected.
        }
       
        try {
            new Extent(1, Extent.EX).toPoint();
            fail("Did not throw IllegalStateException.");
        } catch (IllegalStateException ex) {
            // Expected.
        }
       
        try {
            new Extent(1, Extent.PERCENT).toPoint();
            fail("Did not throw IllegalStateException.");
        } catch (IllegalStateException ex) {
            // Expected.
        }
       
        try {
            new Extent(1, Extent.PX).toPoint();
            fail("Did not throw IllegalStateException.");
        } catch (IllegalStateException ex) {
            // Expected.
        }
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Extent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.