/** * Get Tab with ID * * @param AD_Tab_ID * @return tab or null */ public UITab getTab(int AD_Tab_ID) { Integer tabKey = Integer.valueOf(AD_Tab_ID); UITab tab = m_tabs.get(tabKey); if (tab == null) { // Check added for referenced tabs if (m_referencetabs.get(tabKey) != null) return m_referencetabs.get(tabKey); throw new CompiereStateException("No such tab:" + AD_Tab_ID); } // find in window return tab; } // getTab
void isReadable(SelectionKey k) { EventableChannel ec = (EventableChannel) k.attachment(); long b = ec.getBinding(); if (ec.isWatchOnly()) { if (ec.isNotifyReadable()) eventCallback(b, EM_CONNECTION_NOTIFY_READABLE, null); } else { myReadBuffer.clear(); try { ec.readInboundData(myReadBuffer); myReadBuffer.flip(); if (myReadBuffer.limit() > 0) { if (ProxyConnections != null) { EventableChannel target = ProxyConnections.get(b); if (target != null) { ByteBuffer myWriteBuffer = ByteBuffer.allocate(myReadBuffer.limit()); myWriteBuffer.put(myReadBuffer); myWriteBuffer.flip(); target.scheduleOutboundData(myWriteBuffer); } else { eventCallback(b, EM_CONNECTION_READ, myReadBuffer); } } else { eventCallback(b, EM_CONNECTION_READ, myReadBuffer); } } } catch (IOException e) { UnboundConnections.add(b); } } }
public SocketChannel detachChannel(long sig) { EventableSocketChannel ec = (EventableSocketChannel) Connections.get(sig); if (ec != null) { UnboundConnections.add(sig); return ec.getChannel(); } else { return null; } }
public boolean startProxy(long from, long to) { // lazy init for proxy support check quickly in isReadable if (ProxyConnections == null) { ProxyConnections = new HashMap<Long, EventableChannel>(); } EventableChannel target = Connections.get(to); if (target != null) { ProxyConnections.put(from, target); return true; } else { return false; } }
/** * Get Field * * @param AD_Field_ID id * @param windowNo relative windowNo * @return field or null */ public UIField getField(int AD_Field_ID, int windowNo) { Integer key = Integer.valueOf(AD_Field_ID); UIField field = m_fields.get(key); if (field == null) { UIFieldVOFactory fieldFactory = new UIFieldVOFactory(); UIFieldVO vo = fieldFactory.get(m_context, AD_Field_ID); // m_context.setSOTrx(windowNo, isSOTrx); if (vo != null) { field = new UIField(vo); field.initialize(m_context, windowNo); log.warning("Loaded directly: " + field); // SOTrx may not // be correct m_fields.put(key, field); // save in cache } } // create new return field; } // getField
void addNewConnections() { ListIterator<EventableSocketChannel> iter = DetachedConnections.listIterator(0); while (iter.hasNext()) { EventableSocketChannel ec = iter.next(); ec.cleanup(); } DetachedConnections.clear(); ListIterator<Long> iter2 = NewConnections.listIterator(0); while (iter2.hasNext()) { long b = iter2.next(); EventableChannel ec = Connections.get(b); if (ec != null) { try { ec.register(); } catch (ClosedChannelException e) { UnboundConnections.add(ec.getBinding()); } } } NewConnections.clear(); }
public boolean isNotifyWritable(long sig) { return Connections.get(sig).isNotifyWritable(); }
public void setNotifyWritable(long sig, boolean mode) { ((EventableSocketChannel) Connections.get(sig)).setNotifyWritable(mode); }
public Object[] getPeerName(long sig) { return Connections.get(sig).getPeerName(); }
public void startTls(long sig) throws NoSuchAlgorithmException, KeyManagementException { Connections.get(sig).startTls(); }
public void closeConnection(long sig, boolean afterWriting) { EventableChannel ec = Connections.get(sig); if (ec != null) if (ec.scheduleClose(afterWriting)) UnboundConnections.add(sig); }
public void sendDatagram(long sig, ByteBuffer bb, String recipAddress, int recipPort) { (Connections.get(sig)).scheduleOutboundDatagram(bb, recipAddress, recipPort); }
public void setCommInactivityTimeout(long sig, long mills) { Connections.get(sig).setCommInactivityTimeout(mills); }
public void sendData(long sig, ByteBuffer bb) throws IOException { EventableChannel channel = Connections.get(sig); if (channel != null) { channel.scheduleOutboundData(bb); } }
public NodeVO getNode(String key) { return m_nodes.get(key); }
public void sendData(long sig, ByteBuffer bb) throws IOException { Connections.get(sig).scheduleOutboundData(bb); }