Package pivot.wtk

Examples of pivot.wtk.Component$ComponentClassListenerList


                        if (messageType.equals("custom")) {
                            ArrayList<String> options = new ArrayList<String>();
                            options.add("OK");
                            options.add("Cancel");

                            Component body = null;
                            WTKXSerializer wtkxSerializer = new WTKXSerializer();
                            try {
                                body = (Component)wtkxSerializer.readObject("pivot/tutorials/alert.wtkx");
                            } catch(Exception exception) {
                                System.out.println(exception);
                            }

                            Alert alert = new Alert(MessageType.QUESTION, "Please select your favorite icon:",
                                options, body);
                            alert.setTitle("Select Icon");
                            alert.setSelectedOption(0);
                            alert.getDecorators().update(0, new ReflectionDecorator());

                            alert.open(window);
                        } else {
                            String message = (String)userData.get("message");
                            Alert.alert(MessageType.decode(messageType), message, window);
                        }
                    }
                });

                promptButton.getButtonPressListeners().add(new ButtonPressListener() {
                    public void buttonPressed(Button button) {
                        Button.Group messageTypeGroup = Button.getGroup("messageType");
                        Button selection = messageTypeGroup.getSelection();

                        Map<String, ?> userData =
                            JSONSerializer.parseMap((String)selection.getUserData().get("messageInfo"));
                        String messageType = (String)userData.get("type");

                        if (messageType.equals("custom")) {
                            ArrayList<String> options = new ArrayList<String>();
                            options.add("OK");
                            options.add("Cancel");

                            Component body = null;
                            WTKXSerializer wtkxSerializer = new WTKXSerializer();
                            try {
                                body = (Component)wtkxSerializer.readObject("pivot/tutorials/alert.wtkx");
                            } catch(Exception exception) {
                                System.out.println(exception);
View Full Code Here


    private ImageView imageView = null;
    private Window window = null;

    public void startup(Display display, Dictionary<String, String> properties) throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/lists/list_buttons.wtkx");

        imageView = (ImageView)wtkxSerializer.getObjectByName("imageView");

        ListButton listButton =
View Full Code Here

    @SuppressWarnings("unchecked")
    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/lists/list_views.wtkx");

        final Label selectionLabel =
            (Label)wtkxSerializer.getObjectByName("selectionLabel");
View Full Code Here

public class Labels implements Application {
    private Window window = null;

    public void startup(Display display, Dictionary<String, String> properties) throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/labels/labels.wtkx");

        window = new Window();
        window.setContent(content);
        window.setMaximized(true);
View Full Code Here

    public void startup(final Display display, Dictionary<String, String> properties) throws Exception {
        // pivot.wtk.Theme.setTheme(new pivot.wtk.skin.terra.TerraTheme("test"));

        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content = (Component)wtkxSerializer.readObject("pivot/tutorials/demo.wtkx");

        // Text
        PlainTextSerializer plainTextSerializer = new PlainTextSerializer("UTF-8");
        InputStream inputStream = getClass().getResourceAsStream("text_area.txt");

        Document document = null;
        try {
            document = plainTextSerializer.readObject(inputStream);
        } catch(Exception exception) {
            System.out.println(exception);
        }

        TextArea textArea = (TextArea)wtkxSerializer.getObjectByName("text.textArea");
        textArea.setDocument(document);

        final WatermarkDecorator watermarkDecorator = new WatermarkDecorator("Preview");
        watermarkDecorator.setOpacity(0.1f);
        watermarkDecorator.setFont(watermarkDecorator.getFont().deriveFont(Font.BOLD, 24));

        textArea.getDecorators().add(watermarkDecorator);

        textArea.getComponentStateListeners().add(new ComponentStateListener() {
            public void enabledChanged(Component component) {
                // No-op
            }

            public void focusedChanged(Component component, boolean temporary) {
                component.getDecorators().remove(watermarkDecorator);
                component.getComponentStateListeners().remove(this);
            }
        });

        new Action("selectImageAction") {
            public String getDescription() {
                return "Select Image Action";
            }

            public void perform() {
                Button.Group imageMenuGroup = Button.getGroup("imageMenuGroup");
                Button selectedItem = imageMenuGroup.getSelection();

                String imageName = (String)selectedItem.getUserData();

                ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
                URL imageURL = classLoader.getResource(imageName);

                // If the image has not been added to the resource cache yet,
                // add it
                Image image = (Image)ApplicationContext.getResourceCache().get(imageURL);

                if (image == null) {
                    image = Image.load(imageURL);
                    ApplicationContext.getResourceCache().put(imageURL, image);
                }

                // Update the image
                menuImageView.setImage(image);
            }
        };

        ListView iconListView = (ListView)wtkxSerializer.getObjectByName("lists.iconListView");
        iconListView.setItemDisabled(3, true);
        iconListView.setItemDisabled(4, true);

        ListView checkedListView = (ListView)wtkxSerializer.getObjectByName("lists.checkedListView");
        checkedListView.setItemChecked(0, true);
        checkedListView.setItemChecked(2, true);
        checkedListView.setItemChecked(3, true);

        menuImageView = (ImageView)wtkxSerializer.getObjectByName("menus.imageView");
        menuImageView.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener() {
            public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
                if (button == Mouse.Button.RIGHT) {
                    menuPopup.open(display, component.mapPointToAncestor(display, x, y));
                }

                return false;
            }

            public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
                return false;
            }

            public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
                return false;
            }
        });

        // Spinners
        Spinner numericSpinner = (Spinner)wtkxSerializer.getObjectByName("spinners.numericSpinner");
        initializeNumericSpinner(numericSpinner);

        Spinner dateSpinner = (Spinner)wtkxSerializer.getObjectByName("spinners.dateSpinner");
        initializeDateSpinner(dateSpinner);

        // Sliders
        SliderValueListener sliderValueListener = new SliderValueListener() {
            public void valueChanged(Slider slider, int previousValue) {
                Color color = new Color(redSlider.getValue(), greenSlider.getValue(),
                    blueSlider.getValue());
                colorBorder.getStyles().put("backgroundColor", color);
            }
        };

        redSlider = (Slider)wtkxSerializer.getObjectByName("spinners.redSlider");
        redSlider.getSliderValueListeners().add(sliderValueListener);

        greenSlider = (Slider)wtkxSerializer.getObjectByName("spinners.greenSlider");
        greenSlider.getSliderValueListeners().add(sliderValueListener);

        blueSlider = (Slider)wtkxSerializer.getObjectByName("spinners.blueSlider");
        blueSlider.getSliderValueListeners().add(sliderValueListener);

        Color color = new Color(redSlider.getValue(), greenSlider.getValue(),
            blueSlider.getValue());
        colorBorder = (Border)wtkxSerializer.getObjectByName("spinners.colorBorder");
        colorBorder.getStyles().put("backgroundColor", color);

        sortableTableView = (TableView)wtkxSerializer.getObjectByName("tables.sortableTableView");
        sortableTableViewHeader = (TableViewHeader)wtkxSerializer.getObjectByName("tables.sortableTableViewHeader");
        customTableView = (TableView)wtkxSerializer.getObjectByName("tables.customTableView");
        initializeTableViews();

        DragSource imageDragSource = new DragSource() {
            private Image image = null;
            private Point offset = null;
            private LocalManifest content = null;

            public boolean beginDrag(Component component, int x, int y) {
                ImageView imageView = (ImageView)component;
                image = imageView.getImage();

                if (image != null) {
                    imageView.setImage((Image)null);
                    content = new LocalManifest();
                    content.putImage(image);
                    offset = new Point(x - (imageView.getWidth() - image.getWidth()) / 2,
                        y - (imageView.getHeight() - image.getHeight()) / 2);
                }

                return (image != null);
View Full Code Here

                if (messageType.equals("custom")) {
                    ArrayList<String> options = new ArrayList<String>();
                    options.add("OK");
                    options.add("Cancel");

                    Component body = null;
                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
                    try {
                        body = (Component)wtkxSerializer.readObject("pivot/tutorials/alert.wtkx");
                    } catch(Exception exception) {
                        System.out.println(exception);
                    }

                    Alert alert = new Alert(MessageType.QUESTION, "Please select your favorite icon:",
                        options, body);
                    alert.setTitle("Select Icon");
                    alert.setSelectedOption(0);
                    alert.getDecorators().update(0, new ReflectionDecorator());

                    alert.open(window);
                } else {
                    String message = (String)userData.get("message");
                    Alert.alert(MessageType.decode(messageType), message, window);
                }
            }
        });

        promptButton.getButtonPressListeners().add(new ButtonPressListener() {
            public void buttonPressed(Button button) {
                Button.Group messageTypeGroup = Button.getGroup("messageType");
                Button selection = messageTypeGroup.getSelection();

                Map<String, ?> userData = JSONSerializer.parseMap((String)selection.getUserData());
                String messageType = (String)userData.get("type");

                if (messageType.equals("custom")) {
                    ArrayList<String> options = new ArrayList<String>();
                    options.add("OK");
                    options.add("Cancel");

                    Component body = null;
                    WTKXSerializer wtkxSerializer = new WTKXSerializer();
                    try {
                        body = (Component)wtkxSerializer.readObject("pivot/tutorials/alert.wtkx");
                    } catch(Exception exception) {
                        System.out.println(exception);
View Full Code Here

    private Window window = null;

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/hello.wtkx");

        window = new Window();
        window.setContent(content);
        window.setMaximized(true);
View Full Code Here

public class RadioButtons implements Application {
    private Window window = null;

    public void startup(Display display, Dictionary<String, String> properties) throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/buttons/radio_buttons.wtkx");

        // Get a reference to the button group
        RadioButton oneButton =
            (RadioButton)wtkxSerializer.getObjectByName("oneButton");
View Full Code Here

        locale = (language == null) ? Locale.getDefault() : new Locale(language);
        resources = new Resources(getClass().getName(), locale, "UTF8");

        // Load the application's UI
        WTKXSerializer wtkxSerializer = new WTKXSerializer(resources);
        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/stocktracker/stocktracker.wtkx");

        // Wire up event handlers
        stocksTableView = (TableView)wtkxSerializer.getObjectByName("stocksTableView");
        stocksTableView.getTableViewSelectionListeners().add(new TableViewSelectionListener() {
View Full Code Here

    }

    public void startup(Display display, Dictionary<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/text/text.wtkx");

        TextInput stateTextInput =
            (TextInput)wtkxSerializer.getObjectByName("stateTextInput");
View Full Code Here

TOP

Related Classes of pivot.wtk.Component$ComponentClassListenerList

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.