Package org.onemind.awtbridge.peer

Examples of org.onemind.awtbridge.peer.BridgePeer


            com = (Component)tree.getCellEditor().getTreeCellEditorComponent(tree, value, true, true, model.isLeaf(value), 0);           
        } else
        {
            com = (Component)tree.getCellRenderer().getTreeCellRendererComponent(tree, value, true, true, model.isLeaf(value), 0, true);           
        }
        BridgePeer childPeer = context.getContext().getPeer(com);
        if (childPeer == null)
        {
            tree.add(com);
            com.addNotify();
            childPeer = context.getContext().getPeer(com);
        }
        //setting the size?
       
        // masquerade the peer id
        if (edit)
        {
            String origId = childPeer.getId();
            String newId = peer.getId() + "_" + treePath;
            childPeer.setId(newId); //fake it
            try
            {
                context.renderOutput(com, output);
            } finally
            {
                childPeer.setId(origId); //set it back               
            }
        } else
        { //just render
            try
            {
View Full Code Here


         */
        public void dispatch()
        {
            try
            {
                BridgePeer peer = (BridgePeer) getSource();
                TableModel model = _table.getModel();
                int rows = model.getRowCount();
                int cols = model.getColumnCount();
                for (int i = 0; i < rows; i++)
                {
                    //handle cell events
                    for (int j = 0; j < cols; j++)
                    {
                        boolean edit = model.isCellEditable(i, j);
                        if (edit)
                        {
                            TableCellEditor editor = _table.getCellEditor(i, j);
                            Component com = _table.prepareEditor(editor, i, j);
                            BridgePeer childPeer = _context.getContext().getPeer(com);
                            if (childPeer == null)
                            {
                                _table.add(com); //forge the peer creation
                                com.addNotify();
                                childPeer = _context.getContext().getPeer(com);
                            }
                            String oldId = childPeer.getId();
                            String newId = peer.getId() + "_" + i + "_" + j;
                            childPeer.setId(newId);
                            try
                            {
                                if (((DefaultMapInputDelegate) childPeer.getInputDelegate()).hasEvent(childPeer, _inputForm))
                                {
                                    if (_table.editCellAt(i, j))
                                    {
                                        ((BridgeEventQueue)_context.getEventQueue()).setImmediateDispatch(true);
                                        try
                                        {
                                            childPeer.processInput(_context, _inputForm);
                                        } finally
                                        {
                                            ((BridgeEventQueue) _context.getEventQueue()).setImmediateDispatch(false);
                                        }
                                    } else
                                    {
                                        _logger.severe("Cannot focus cell on " + i + ", " + j);
                                    }
                                }
                            } finally
                            {
                                childPeer.setId(oldId);
                            }
                        }
                    }
                }
            } catch (InputException ex)
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void handleInput(Object comObject, Object input) throws InputException
    {
        BridgePeer peer = (BridgePeer) getContext().getPeer(comObject);
        if (peer != null)
        {
            peer.processInput(this, input);
            //handleInput(peer, input);
        } else
        {
            _logger.warning("Component " + comObject + " has no peer");
            //throw new IllegalStateException("Component " + comObject + " has no peer");
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void renderOutput(Object comObject, Object output) throws RenderingException
    {
        BridgePeer peer = getContext().getPeer(comObject);
        if (peer != null)
        {
            peer.render(this, output);
        } else
        {
            throw new IllegalStateException("component " + comObject + " has no peer");
        }
    }
View Full Code Here

        if (key.equals("class"))
        {
            appendAttribute(sb, "class", obj.getClass().getName());
        } else if (key.equals("id"))
        {
            BridgePeer peer = null;
            if (obj instanceof Component)
            {
                peer = (BridgePeer) ((Component) obj).getPeer();
            } else if (obj instanceof MenuComponent)
            {
                peer = (BridgePeer) ((MenuComponent) obj).getPeer();
            }
            if (peer != null)
            {
                appendAttribute(sb, "id", peer.getId());
            }
        } else if (key.equals("handler"))
        {
            InheritableValueMap map = opts.getOptions("handler");
            String handler = (String) map.resolve(obj.getClass());
View Full Code Here

        {
            TableCellRenderer renderer = table.getCellRenderer(row, col);
            com = table.prepareRenderer(renderer, row, col);
            com.setEnabled(false);
        }
        BridgePeer childPeer = context.getContext().getPeer(com);
        if (childPeer == null)
        {
            table.add(com);
            com.addNotify();
            childPeer = context.getContext().getPeer(com);
        }
        Rectangle rect = table.getCellRect(row, col, false);
        com.setSize(rect.getSize());
        // masquerade the peer id
        String origId = childPeer.getId();
        String newId = peer.getId() + "_" + row + "_" + col;
        childPeer.setId(newId); //fake it
        try
        {
            context.renderOutput(com, output);
        } finally
        {
            childPeer.setId(origId); //set it back
            table.removeEditor(); //make the table not in edit state
        }
    }
View Full Code Here

    {
        JTable tb = (JTable) peer.getComponentObject();
        JTableHeader header = tb.getTableHeader();
        if (header != null)
        {
            BridgePeer headerPeer = context.getContext().getPeer(header);
            if (headerPeer == null)
            {
                tb.add(header);
                header.addNotify();
                headerPeer = context.getContext().getPeer(header);
View Full Code Here

        JTable table = header.getTable();
        Component com = renderer.getTableCellRendererComponent(table, column
                .getHeaderValue(), false, false, 0, 0);
        Rectangle rect = header.getHeaderRect(col);
        com.setSize(rect.getSize());
        BridgePeer cellPeer = context.getContext().getPeer(com);
        if (cellPeer == null)
        {
            header.getTable().add(com);
            com.addNotify();           
            cellPeer = context.getContext().getPeer(com);
        }
//      masquerade the peer id
        String origId = cellPeer.getId();
        String newId = peer.getId() + "_" + + col;
        cellPeer.setId(newId); //fake it
        try
        {
            context.renderOutput(com, output);
        } finally
        {
            cellPeer.setId(origId); //set it back
            //table.removeEditor(); //make the table not in edit state
        }
        //context.renderOutput(com, output);
    }
View Full Code Here

TOP

Related Classes of org.onemind.awtbridge.peer.BridgePeer

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.