@Override public void setPrincipal(Principal principal) { super.setPrincipal(principal); // Put the session into the region to serialize the principal if (getManager() != null) { // TODO convert this to a delta getManager().add(this); DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Cached principal: " + principal); // mgr.logCurrentStack(); } } }
/** * Set a new id for this session.<br/> * Before setting the new id, it removes itself from the associated * manager. After the new id is set, this session adds itself to the * session manager. * * @param id * the new session id */ protected void setIdForRelocate( final String id ) { if ( this.id == null ) { throw new IllegalStateException( "There's no session id set." ); } if ( this.manager == null ) { throw new IllegalStateException( "There's no manager set." ); } /* * and mark it as a node-failure-session, so that remove(session) does * not try to remove it from memcached... (the session is removed and * added when the session id is changed) */ setNote( MemcachedSessionService.NODE_FAILURE, Boolean.TRUE ); manager.remove( this ); removeNote( MemcachedSessionService.NODE_FAILURE ); this.id = id; manager.add( this ); }
public class TestLifecycle extends MyAppScreen implements FieldChangeListener { private final ABNTextEdit txt1; private final ButtonField btn1; private final ButtonField btn2; public TestLifecycle() { final Manager manager = getMainManager(); txt1 = new ABNTextEdit(); manager.add(txt1); btn1 = new ButtonField("Dialog", ButtonField.CONSUME_CLICK); btn1.setChangeListener(this); manager.add(btn1); btn2 = new ButtonField("Screen", ButtonField.CONSUME_CLICK); btn2.setChangeListener(this); manager.add(btn2); } public void fieldChanged(final Field field, final int context) { if (field == btn1) { Dialog.alert("Example alert"); } else if (field == btn2) { UiApplication.getUiApplication().pushScreen(new TestLifecycle()); } } }
public class ManyToManyTest { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("JPA"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); Project p1 = new Project("Project 1"); Project p2 = new Project("Project 2"); Project p3 = new Project("Project 3"); Manager m1 = new Manager("Jon"); m1.add(p1); m1.add(p2); m1.add(p3); Manager m2 = new Manager("Kone"); m2.add(p2); m2.add(p3); em.persist(m1); em.persist(m2); System.out.println("Success.."); em.getTransaction().commit(); em.close(); } }
public class MyScreen extends MainScreen { MyScreen() { Background screenColor = BackgroundFactory.createSolidBackground(Color.Black); Manager backg= getMainManager(); backg.setBackground(screenColor); EditField edit = new EditField("", "", 100, Field.FOCUSABLE){ protected void paint(Graphics g) { g.setColor(Color.WHITE); super.paint(g); } }; Background fieldColor = BackgroundFactory.createSolidBackground(Color.BLACK); edit.setBackground(fieldColor); backg.add(edit); } }
/** * Set the session identifier for this session. * * @param id The new session identifier */ @Override public void setId(String id) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); tellNew(); }
/** * Set the session identifier for this session. * * @param id The new session identifier */ public void setId(String id) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); tellNew(); }
/** * Set the session identifier for this session. * * @param id The new session identifier */ public void setId(String id) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); tellNew(); }
/** * {@inheritDoc} */ @Override public void setId(String id, boolean notify) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); if (notify) { tellNew(); } }
/** * Set the session identifier for this session. * * @param id The new session identifier */ @Override public void setId(String id) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); tellNew(); }
/** * {@inheritDoc} */ @Override public void setId(String id, boolean notify) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); if (notify) { tellNew(); } }
/** * {@inheritDoc} */ @Override public void setId(String id, boolean notify) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); if (notify) { tellNew(); } }
/** * Set the session identifier for this session. * * @param id The new session identifier */ @Override public void setId(String id) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); tellNew(); }
/** * {@inheritDoc} */ @Override public void setId(String id, boolean notify) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); if (notify) { tellNew(); } }
/** * {@inheritDoc} */ @Override public void setId(String id, boolean notify) { if ((this.id != null) && (manager != null)) manager.remove(this); this.id = id; if (manager != null) manager.add(this); if (notify) { tellNew(); } }
final Field button1 = new GradientButtonField(Color.DARKGRAY, Color.BLUE, "Click Me!", Color.WHITE); final Field button2 = new GradientButtonField(Color.DARKGRAY, Color.BLUE, "Click Me, Too!", Color.WHITE); Manager mgr = new Manager(Manager.NO_VERTICAL_SCROLL) { public int getPreferredHeight() { return Display.getHeight(); } public int getPreferredWidth() { return Display.getWidth(); } protected void sublayout(int maxWidth, int maxHeight) { setExtent(getPreferredWidth(), getPreferredHeight()); layoutChild(button1, 160, 80); setPositionChild(button1, 20, 50); layoutChild(button2, 120, 60); setPositionChild(button2, 20, 150); } }; button1.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { Dialog.alert("clicked!"); } }); mgr.add(button1); mgr.add(button2); add(mgr);
/** * Set a new id for this session.<br/> * Before setting the new id, it removes itself from the associated * manager. After the new id is set, this session adds itself to the * session manager. * * @param id * the new session id */ protected void setIdForRelocate( final String id ) { if ( this.id == null ) { throw new IllegalStateException( "There's no session id set." ); } if ( this.manager == null ) { throw new IllegalStateException( "There's no manager set." ); } /* * and mark it as a node-failure-session, so that remove(session) does * not try to remove it from memcached... (the session is removed and * added when the session id is changed) */ setNote( MemcachedSessionService.NODE_FAILURE, Boolean.TRUE ); manager.remove( this ); removeNote( MemcachedSessionService.NODE_FAILURE ); this.id = id; manager.add( this ); }
/** * Set the session identifier for this session. * * @param id The new session identifier */ public void setId(String id) { if ((this.id != null) && (manager != null)) manager.remove(this); String oldId = this.id; this.id = id; if (manager != null) manager.add(this); if (oldId == null) { tellNew(); } else { // Notify interested session event listeners fireSessionEvent(Session.SESSION_ID_CHANGED_EVENT, oldId); } }
public void setPrincipal(Principal principal) { super.setPrincipal(principal); // Put the session into the region to serialize the principal if (getManager() != null) { // TODO convert this to a delta getManager().add(this); DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Cached principal: " + principal); // mgr.logCurrentStack(); } } }