List of usage examples for javax.swing JScrollPane applyComponentOrientation
public void applyComponentOrientation(ComponentOrientation o)
From source file:fr.pasteque.pos.sales.restaurant.JTicketsBagRestaurantMap.java
/** Creates new form JTicketsBagRestaurant */ public JTicketsBagRestaurantMap(AppView app, TicketsEditor panelticket) { super(app, panelticket); dlReceipts = new DataLogicReceipts(); dlSales = new DataLogicSales(); m_restaurantmap = new JTicketsBagRestaurant(app, this); m_PlaceCurrent = null;//from w w w . ja va 2 s .c o m m_PlaceClipboard = null; customer = null; this.floors = new ArrayList<Floor>(); this.places = new HashMap<String, List<Place>>(); try { ServerLoader loader = new ServerLoader(); ServerLoader.Response r = loader.read("PlacesAPI", "getAll"); if (r.getStatus().equals(ServerLoader.Response.STATUS_OK)) { JSONArray a = r.getArrayContent(); for (int i = 0; i < a.length(); i++) { JSONObject oFloor = a.getJSONObject(i); Floor f = new Floor(oFloor); this.floors.add(f); this.places.put(f.getID(), new ArrayList<Place>()); JSONArray aPlaces = oFloor.getJSONArray("places"); for (int j = 0; j < aPlaces.length(); j++) { Place p = new Place(aPlaces.getJSONObject(j)); this.places.get(f.getID()).add(p); } } } } catch (Exception e) { e.printStackTrace(); } initComponents(); // add the Floors containers if (this.floors.size() > 1) { // A tab container for 2 or more floors JTabbedPane jTabFloors = new JTabbedPane(); jTabFloors.applyComponentOrientation(getComponentOrientation()); jTabFloors.setBorder(new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5))); jTabFloors.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); jTabFloors.setFocusable(false); jTabFloors.setRequestFocusEnabled(false); m_jPanelMap.add(jTabFloors, BorderLayout.CENTER); for (Floor f : this.floors) { f.getContainer().applyComponentOrientation(getComponentOrientation()); JScrollPane jScrCont = new JScrollPane(); jScrCont.applyComponentOrientation(getComponentOrientation()); JPanel jPanCont = new JPanel(); jPanCont.applyComponentOrientation(getComponentOrientation()); jTabFloors.addTab(f.getName(), f.getIcon(), jScrCont); jScrCont.setViewportView(jPanCont); jPanCont.add(f.getContainer()); } } else if (this.floors.size() == 1) { // Just a frame for 1 floor Floor f = this.floors.get(0); f.getContainer().applyComponentOrientation(getComponentOrientation()); JPanel jPlaces = new JPanel(); jPlaces.applyComponentOrientation(getComponentOrientation()); jPlaces.setLayout(new BorderLayout()); jPlaces.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)), new javax.swing.border.TitledBorder(f.getName()))); JScrollPane jScrCont = new JScrollPane(); jScrCont.applyComponentOrientation(getComponentOrientation()); JPanel jPanCont = new JPanel(); jPanCont.applyComponentOrientation(getComponentOrientation()); // jPlaces.setLayout(new FlowLayout()); m_jPanelMap.add(jPlaces, BorderLayout.CENTER); jPlaces.add(jScrCont, BorderLayout.CENTER); jScrCont.setViewportView(jPanCont); jPanCont.add(f.getContainer()); } // Add all the Table buttons. for (Floor f : this.floors) { List<Place> places = this.places.get(f.getID()); for (Place pl : places) { f.getContainer().add(pl.getButton()); pl.setButtonBounds(); pl.getButton().addActionListener(new MyActionListener(pl)); } } // Add the reservations panel m_jreservations = new JTicketsBagRestaurantRes(app, this); add(m_jreservations, "res"); }
From source file:com.openbravo.pos.sales.restaurant.JRetailTicketsBagRestaurantMap.java
/** * Creates new form JTicketsBagRestaurant *///from w w w .jav a 2 s . co m public JRetailTicketsBagRestaurantMap(AppView app, RetailTicketsEditor panelticket, String businessType) { super(app, panelticket); this.m_App = app; dlReceipts = (DataLogicReceipts) app.getBean("com.openbravo.pos.sales.DataLogicReceipts"); dlSales = (DataLogicSales) m_App.getBean("com.openbravo.pos.forms.DataLogicSales"); dlSystem = (DataLogicSystem) m_App.getBean("com.openbravo.pos.forms.DataLogicSystem"); m_restaurantmap = new JRetailTicketsBagRestaurant(app, this); m_PlaceCurrent = null; m_PlaceClipboard = null; customer = null; //Select all the floor details from db for showing the floor name in screen try { SentenceList sent = new StaticSentence(app.getSession(), "SELECT ID, NAME, IMAGE FROM FLOORS ORDER BY NAME", null, new SerializerReadClass(Floor.class)); m_afloors = sent.list(); } catch (BasicException eD) { m_afloors = new ArrayList<Floor>(); } //Select all the tables details from db for showing the table names in screen try { SentenceList sent = new StaticSentence(app.getSession(), "SELECT ID, NAME, X, Y, FLOOR FROM PLACES WHERE NAME NOT LIKE 'takeaway' ORDER BY FLOOR", null, new SerializerReadClass(Place.class)); m_aplaces = sent.list(); } catch (BasicException eD) { m_aplaces = new ArrayList<Place>(); } //Initialise the components initComponents(); // add the Floors containers if (m_afloors.size() > 1) { // A tab container for 2 or more floors JTabbedPane jTabFloors = new JTabbedPane(); jTabFloors.applyComponentOrientation(getComponentOrientation()); jTabFloors.setBorder(new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5))); jTabFloors.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); jTabFloors.setFocusable(false); jTabFloors.setRequestFocusEnabled(false); m_jPanelMap.add(jTabFloors, BorderLayout.CENTER); for (Floor f : m_afloors) { f.getContainer().applyComponentOrientation(getComponentOrientation()); JScrollPane jScrCont = new JScrollPane(); jScrCont.applyComponentOrientation(getComponentOrientation()); JPanel jPanCont = new JPanel(); jPanCont.applyComponentOrientation(getComponentOrientation()); jTabFloors.addTab(f.getName(), f.getIcon(), jScrCont); jScrCont.setViewportView(jPanCont); jPanCont.add(f.getContainer()); } } else if (m_afloors.size() == 1) { // Just a frame for 1 floor Floor f = m_afloors.get(0); f.getContainer().applyComponentOrientation(getComponentOrientation()); JPanel jPlaces = new JPanel(); jPlaces.applyComponentOrientation(getComponentOrientation()); jPlaces.setLayout(new BorderLayout()); jPlaces.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.EmptyBorder(new Insets(5, 5, 5, 5)), new javax.swing.border.TitledBorder(f.getName()))); JScrollPane jScrCont = new JScrollPane(); jScrCont.applyComponentOrientation(getComponentOrientation()); JPanel jPanCont = new JPanel(); jPanCont.applyComponentOrientation(getComponentOrientation()); m_jPanelMap.add(jPlaces, BorderLayout.CENTER); jPlaces.add(jScrCont, BorderLayout.CENTER); jScrCont.setViewportView(jPanCont); jPanCont.add(f.getContainer()); } // Add all the Table buttons. Floor currfloor = null; for (Place pl : m_aplaces) { int iFloor = 0; if (currfloor == null || !currfloor.getID().equals(pl.getFloor())) { // Look for a new floor do { currfloor = m_afloors.get(iFloor++); } while (!currfloor.getID().equals(pl.getFloor())); } currfloor.getContainer().add(pl.getButton()); pl.setButtonBounds(); pl.getButton().addActionListener(new MyActionListener(pl)); } // Add the reservations panel m_jreservations = new JRetailTicketsBagRestaurantRes(app, this); add(m_jreservations, "res"); }