Package pivot.wtk

Examples of pivot.wtk.ListButton$ListButtonListenerList


        Spinner dateSpinner = new Spinner(new CalendarDateSpinnerData());
        dateSpinner.setSelectedItemKey("date");
        tableViewRowEditor.getCellEditors().put("date", dateSpinner);

        // Expense type uses a ListButton that presents the expense types
        ListButton typeListButton = new ListButton(new EnumList<ExpenseType>(ExpenseType.class));
        typeListButton.setSelectedItemKey("type");
        tableViewRowEditor.getCellEditors().put("type", typeListButton);

        // Amount uses a TextInput with strict currency validation
        TextInput amountTextInput = new TextInput();
        amountTextInput.setValidator(new CurrencyValidator());
View Full Code Here


    /**
     * Gets the query to issue to the server, authenticated if needed.
     */
    private Request getRequest() {
        ListButton protocolListButton = (ListButton)serializer.getObjectByID("request.protocol");
        ListItem protocolListItem = (ListItem)protocolListButton.getSelectedItem();
        Protocol protocol = Protocol.decode(protocolListItem.getText());
        boolean secure = protocol.isSecure();

        TextInput hostTextInput = (TextInput)serializer.getObjectByID("request.host");
        String host = hostTextInput.getText();

        TextInput portTextInput = (TextInput)serializer.getObjectByID("request.port");
        String portText = portTextInput.getText();
        int port;
        try {
            port = Integer.parseInt(portText);
        } catch (Exception ex) {
            port = secure ? 443 : 80;
        }

        TextInput pathTextInput = (TextInput)serializer.getObjectByID("request.path");
        String path = pathTextInput.getText();

        ListButton methodListButton = (ListButton)serializer.getObjectByID("request.method");
        ListItem methodListItem = (ListItem)methodListButton.getSelectedItem();

        // Construct the HTTP request
        Request httpRequest = new Request(methodListItem.getText(), protocol.toString(), host, port, path);

        TextArea textArea = (TextArea)serializer.getObjectByID("request.body");
View Full Code Here

        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/lists/list_buttons.wtkx");

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

        ListButton listButton =
            (ListButton)wtkxSerializer.getObjectByName("listButton");

        listButton.getListButtonSelectionListeners().add(new
            ListButtonSelectionHandler());

        listButton.setSelectedIndex(0);

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

    @Override
    public void install(Component component) {
        super.install(component);

        ListButton listButton = (ListButton)component;
        listButton.getListButtonListeners().add(this);
        listButton.getListButtonSelectionListeners().add(this);

        listView.setListData(listButton.getListData());
        listView.setItemRenderer(listButton.getItemRenderer());
    }
View Full Code Here

    @Override
    public void uninstall() {
        listViewPopup.close();

        ListButton listButton = (ListButton)getComponent();
        listButton.getListButtonListeners().remove(this);
        listButton.getListButtonSelectionListeners().remove(this);

        listView.setListData(new ArrayList<Object>());

        super.uninstall();
    }
View Full Code Here

    @Override
    public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
        boolean consumed = super.mouseClick(component, button, x, y, count);

        ListButton listButton = (ListButton)getComponent();

        listButton.requestFocus();
        listButton.press();

        if (listView.isShowing()) {
            listView.requestFocus();
        }
View Full Code Here

        if (keyCode == Keyboard.KeyCode.SPACE) {
            pressed = true;
            repaintComponent();
            consumed = true;
        } else if (keyCode == Keyboard.KeyCode.UP) {
            ListButton listButton = (ListButton)getComponent();
            int selectedIndex = listButton.getSelectedIndex();

            if (selectedIndex > 0) {
                listButton.setSelectedIndex(selectedIndex - 1);
                consumed = true;
            }
        } else if (keyCode == Keyboard.KeyCode.DOWN) {
            ListButton listButton = (ListButton)getComponent();
            int selectedIndex = listButton.getSelectedIndex();

            if (selectedIndex < listButton.getListData().getLength() - 1) {
                listButton.setSelectedIndex(selectedIndex + 1);
                consumed = true;
            }
        } else {
            consumed = super.keyPressed(component, keyCode, keyLocation);
        }
View Full Code Here

    @Override
    public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
        boolean consumed = false;

        ListButton listButton = (ListButton)getComponent();

        if (keyCode == Keyboard.KeyCode.SPACE) {
            pressed = false;
            repaintComponent();

            listButton.press();
        } else {
            consumed = super.keyReleased(component, keyCode, keyLocation);
        }

        return consumed;
View Full Code Here

    @Override
    public void buttonPressed(Button button) {
        if (listViewPopup.isOpen()) {
            listViewPopup.close();
        } else {
            ListButton listButton = (ListButton)button;

            if (listButton.getListData().getLength() > 0) {
                // Determine the popup's location and preferred size, relative
                // to the button
                Display display = listButton.getDisplay();

                if (display != null) {
                    int width = getWidth();
                    int height = getHeight();

                    Component content = listViewPopup.getContent();

                    // Ensure that the popup remains within the bounds of the display
                    Point buttonLocation = listButton.mapPointToAncestor(display, 0, 0);

                    Dimensions displaySize = display.getSize();
                    Dimensions popupSize = content.getPreferredSize();

                    int x = buttonLocation.x;
                    if (popupSize.width > width
                        && x + popupSize.width > displaySize.width) {
                        x = buttonLocation.x + width - popupSize.width;
                    }

                    int y = buttonLocation.y + height - 1;
                    if (y + popupSize.height > displaySize.height) {
                        if (buttonLocation.y - popupSize.height > 0) {
                            y = buttonLocation.y - popupSize.height + 1;
                        } else {
                            popupSize.height = displaySize.height - y;
                        }
                    } else {
                        popupSize.height = -1;
                    }

                    listViewPopup.setLocation(x, y);
                    listViewPopup.setPreferredSize(popupSize);
                    listViewPopup.open(listButton.getWindow());

                    if (listView.getFirstSelectedIndex() == -1
                        && listView.getListData().getLength() > 0) {
                        listView.setSelectedIndex(0);
                    }
View Full Code Here

    /**
     * Gets the query to issue to the server, authenticated if needed.
     */
    private Request getRequest() {
        ListButton protocolListButton = (ListButton)serializer.getObjectByName("request.protocol");
        ListItem protocolListItem = (ListItem)protocolListButton.getSelectedItem();
        Protocol protocol = Protocol.decode(protocolListItem.getText());
        boolean secure = protocol.isSecure();

        TextInput hostTextInput = (TextInput)serializer.getObjectByName("request.host");
        String host = hostTextInput.getText();

        TextInput portTextInput = (TextInput)serializer.getObjectByName("request.port");
        String portText = portTextInput.getText();
        int port;
        try {
            port = Integer.parseInt(portText);
        } catch (Exception ex) {
            port = secure ? 443 : 80;
        }

        TextInput pathTextInput = (TextInput)serializer.getObjectByName("request.path");
        String path = pathTextInput.getText();

        ListButton methodListButton = (ListButton)serializer.getObjectByName("request.method");
        ListItem methodListItem = (ListItem)methodListButton.getSelectedItem();

        // Construct the HTTP request
        Request httpRequest = new Request(methodListItem.getText(), protocol.toString(), host, port, path);

        TextArea textArea = (TextArea)serializer.getObjectByName("request.body");
View Full Code Here

TOP

Related Classes of pivot.wtk.ListButton$ListButtonListenerList

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.