List of usage examples for javax.swing SwingConstants NORTH
int NORTH
To view the source code for javax.swing SwingConstants NORTH.
Click Source Link
From source file:op.care.prescription.DlgRegular.java
private void btnAddDosisActionPerformed(ActionEvent e) { final JidePopup popup = new JidePopup(); JPanel dlg = new PnlScheduleDose(new PrescriptionSchedule(prescription), new Closure() { @Override//from w w w .ja v a 2s. c o m public void execute(Object o) { if (o != null) { prescription.getPrescriptionSchedule().add(((PrescriptionSchedule) o)); reloadTable(); popup.hidePopup(); } } }); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.getContentPane().add(dlg); popup.setOwner(btnAddDosis); popup.removeExcludedComponent(btnAddDosis); popup.setDefaultFocusComponent(dlg); GUITools.showPopup(popup, SwingConstants.NORTH); }
From source file:op.care.reports.PnlReport.java
private JPanel createContentPanel4Day(LocalDate day) { // OPDE.getDisplayManager().setProgressBarMessage(new DisplayMessage("misc.msg.wait", progress, progressMax)); // progress++; final String key = DateFormat.getDateInstance().format(day.toDate()); synchronized (contentmap) { if (contentmap.containsKey(key)) { return contentmap.get(key); }//from www. j av a 2 s . c o m } final JPanel dayPanel = new JPanel(new VerticalLayout()); dayPanel.setOpaque(false); synchronized (valuecache) { if (!valuecache.containsKey(key)) { valuecache.put(key, NReportTools.getNReports4Day(resident, day)); } int i = 0; // for zebra pattern for (final NReport nreport : valuecache.get(key)) { if (tbShowReplaced.isSelected() || !nreport.isObsolete()) { String title = SYSTools.toHTMLForScreen(SYSConst.html_table(SYSConst .html_table_tr("<td width=\"800\" align=\"left\">" + "<b><p>" + (nreport.isObsolete() ? SYSConst.html_16x16_Eraser_internal : "") + (nreport.isReplacement() ? SYSConst.html_16x16_Edited_internal : "") + DateFormat.getTimeInstance(DateFormat.SHORT).format(nreport.getPit()) + " " + SYSTools.xx("misc.msg.Time.short") + ", " + nreport.getMinutes() + " " + SYSTools.xx("misc.msg.Minute(s)") + ", " + nreport.getUser().getFullname() + (nreport.getCommontags().isEmpty() ? "" : " " + CommontagsTools.getAsHTML(nreport.getCommontags(), SYSConst.html_16x16_tagPurple_internal)) + "</p></b></td>") + SYSConst.html_table_tr("<td width=\"800\" align=\"left\">" + SYSTools.replace(nreport.getText(), "\n", "<br/>", false) + "</td>"), "0")); final DefaultCPTitle pnlSingle = new DefaultCPTitle(SYSTools.toHTMLForScreen(title), null); pnlSingle.getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GUITools.showPopup(GUITools.getHTMLPopup(pnlSingle.getButton(), NReportTools.getInfoAsHTML(nreport)), SwingConstants.NORTH); } }); if (!nreport.getAttachedFilesConnections().isEmpty()) { /*** * _ _ _____ _ _ * | |__ | |_ _ __ | ___(_) | ___ ___ * | '_ \| __| '_ \| |_ | | |/ _ \/ __| * | |_) | |_| | | | _| | | | __/\__ \ * |_.__/ \__|_| |_|_| |_|_|\___||___/ * */ final JButton btnFiles = new JButton( Integer.toString(nreport.getAttachedFilesConnections().size()), SYSConst.icon22greenStar); btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip")); btnFiles.setForeground(Color.BLUE); btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER); btnFiles.setFont(SYSConst.ARIAL18BOLD); btnFiles.setPressedIcon(SYSConst.icon22Pressed); btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT); btnFiles.setAlignmentY(Component.TOP_ALIGNMENT); btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnFiles.setContentAreaFilled(false); btnFiles.setBorder(null); btnFiles.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Closure fileHandleClosure = OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID) ? null : new Closure() { @Override public void execute(Object o) { EntityManager em = OPDE.createEM(); final NReport myReport = em.find(NReport.class, nreport.getID()); em.close(); final String keyNewDay = DateFormat.getDateInstance() .format(myReport.getPit()); synchronized (contentmap) { contentmap.remove(keyNewDay); } synchronized (linemap) { linemap.remove(nreport); } synchronized (valuecache) { valuecache.get(keyNewDay).remove(nreport); valuecache.get(keyNewDay).add(myReport); Collections.sort(valuecache.get(keyNewDay)); } createCP4Day(new LocalDate(myReport.getPit())); buildPanel(); GUITools.flashBackground(linemap.get(myReport), Color.YELLOW, 2); } }; new DlgFiles(nreport, fileHandleClosure); } }); btnFiles.setEnabled(OPDE.isFTPworking()); pnlSingle.getRight().add(btnFiles); } if (!nreport.getAttachedQProcessConnections().isEmpty()) { /*** * _ _ ____ * | |__ | |_ _ __ | _ \ _ __ ___ ___ ___ ___ ___ * | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __| * | |_) | |_| | | | __/| | | (_) | (_| __/\__ \__ \ * |_.__/ \__|_| |_|_| |_| \___/ \___\___||___/___/ * */ final JButton btnProcess = new JButton( Integer.toString(nreport.getAttachedQProcessConnections().size()), SYSConst.icon22redStar); btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip")); btnProcess.setForeground(Color.YELLOW); btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER); btnProcess.setFont(SYSConst.ARIAL18BOLD); btnProcess.setPressedIcon(SYSConst.icon22Pressed); btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT); btnProcess.setAlignmentY(Component.TOP_ALIGNMENT); btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnProcess.setContentAreaFilled(false); btnProcess.setBorder(null); btnProcess.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgProcessAssign(nreport, new Closure() { @Override public void execute(Object o) { if (o == null) { return; } Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o; ArrayList<QProcess> assigned = result.getFirst(); ArrayList<QProcess> unassigned = result.getSecond(); EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); NReport myReport = em.merge(nreport); em.lock(myReport, LockModeType.OPTIMISTIC_FORCE_INCREMENT); ArrayList<SYSNR2PROCESS> attached = new ArrayList<SYSNR2PROCESS>( myReport.getAttachedQProcessConnections()); for (SYSNR2PROCESS linkObject : attached) { if (unassigned.contains(linkObject.getQProcess())) { linkObject.getQProcess().getAttachedNReportConnections() .remove(linkObject); linkObject.getNReport().getAttachedQProcessConnections() .remove(linkObject); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": " + nreport.getTitle() + " ID: " + nreport.getID(), PReportTools.PREPORT_TYPE_REMOVE_ELEMENT, linkObject.getQProcess())); em.remove(linkObject); } } attached.clear(); for (QProcess qProcess : assigned) { java.util.List<QProcessElement> listElements = qProcess .getElements(); if (!listElements.contains(myReport)) { QProcess myQProcess = em.merge(qProcess); SYSNR2PROCESS myLinkObject = em .merge(new SYSNR2PROCESS(myQProcess, myReport)); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": " + nreport.getTitle() + " ID: " + nreport.getID(), PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess)); qProcess.getAttachedNReportConnections().add(myLinkObject); myReport.getAttachedQProcessConnections().add(myLinkObject); } } em.getTransaction().commit(); final String keyNewDay = DateFormat.getDateInstance() .format(myReport.getPit()); synchronized (contentmap) { contentmap.remove(keyNewDay); } synchronized (linemap) { linemap.remove(nreport); } synchronized (valuecache) { valuecache.get(keyNewDay).remove(nreport); valuecache.get(keyNewDay).add(myReport); Collections.sort(valuecache.get(keyNewDay)); } createCP4Day(new LocalDate(myReport.getPit())); buildPanel(); GUITools.flashBackground(linemap.get(myReport), Color.YELLOW, 2); } catch (OptimisticLockException ole) { OPDE.warn(ole); if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } else { reloadDisplay(true); } } catch (RollbackException ole) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } }); } }); btnProcess.setEnabled( OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)); pnlSingle.getRight().add(btnProcess); } /*** * __ __ * | \/ | ___ _ __ _ _ * | |\/| |/ _ \ '_ \| | | | * | | | | __/ | | | |_| | * |_| |_|\___|_| |_|\__,_| * */ final JButton btnMenu = new JButton(SYSConst.icon22menu); btnMenu.setPressedIcon(SYSConst.icon22Pressed); btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT); btnMenu.setAlignmentY(Component.TOP_ALIGNMENT); btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMenu.setContentAreaFilled(false); btnMenu.setBorder(null); btnMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JidePopup popup = new JidePopup(); popup.setMovable(false); popup.getContentPane() .setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.setOwner(btnMenu); popup.removeExcludedComponent(btnMenu); JPanel pnl = getMenu(nreport); popup.getContentPane().add(pnl); popup.setDefaultFocusComponent(pnl); GUITools.showPopup(popup, SwingConstants.WEST); } }); btnMenu.setEnabled(!nreport.isObsolete()); pnlSingle.getRight().add(btnMenu); JPanel zebra = new JPanel(); zebra.setLayout(new BoxLayout(zebra, BoxLayout.LINE_AXIS)); zebra.setOpaque(true); if (i % 2 == 0) { zebra.setBackground(SYSConst.orange1[SYSConst.light2]); } else { zebra.setBackground(Color.WHITE); } zebra.add(pnlSingle.getMain()); i++; dayPanel.add(zebra); linemap.put(nreport, pnlSingle.getMain()); } } } synchronized (contentmap) { contentmap.put(key, dayPanel); } return dayPanel; }
From source file:op.care.values.PnlValues.java
private JPanel createContentPanel4Year(final ResValueTypes vtype, final int year) { final String keyYears = vtype.getID() + ".xtypes." + Integer.toString(year) + ".year"; java.util.List<ResValue> myValues; synchronized (mapType2Values) { if (!mapType2Values.containsKey(keyYears)) { mapType2Values.put(keyYears, ResValueTools.getResValues(resident, vtype, year)); }/*from w w w . j a v a 2 s . c o m*/ if (mapType2Values.get(keyYears).isEmpty()) { JLabel lbl = new JLabel(SYSTools.xx("misc.msg.novalue")); JPanel pnl = new JPanel(); pnl.add(lbl); return pnl; } myValues = mapType2Values.get(keyYears); } JPanel pnlYear = new JPanel(new VerticalLayout()); pnlYear.setOpaque(false); for (final ResValue resValue : myValues) { String title = "<html><table border=\"0\">" + "<tr>" + "<td width=\"200\" align=\"left\">" + DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT).format(resValue.getPit()) + " [" + resValue.getID() + "]</td>" + "<td width=\"340\" align=\"left\">" + ResValueTools.getValueAsHTML(resValue) + "</td>" + "<td width=\"200\" align=\"left\">" + resValue.getUser().getFullname() + "</td>" + "</tr>" + "</table>" + "</html>"; final DefaultCPTitle pnlTitle = new DefaultCPTitle(title, null); pnlTitle.getMain().setBackground(GUITools.blend(vtype.getColor(), Color.WHITE, 0.1f)); pnlTitle.getMain().setOpaque(true); if (resValue.isObsolete()) { pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22eraser)); } if (resValue.isReplacement()) { pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22edited)); } if (!resValue.getText().trim().isEmpty()) { pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22info)); } if (pnlTitle.getAdditionalIconPanel().getComponentCount() > 0) { pnlTitle.getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GUITools.showPopup( GUITools.getHTMLPopup(pnlTitle.getButton(), ResValueTools.getInfoAsHTML(resValue)), SwingConstants.NORTH); } }); } if (!resValue.getAttachedFilesConnections().isEmpty()) { /*** * _ _ _____ _ _ * | |__ | |_ _ __ | ___(_) | ___ ___ * | '_ \| __| '_ \| |_ | | |/ _ \/ __| * | |_) | |_| | | | _| | | | __/\__ \ * |_.__/ \__|_| |_|_| |_|_|\___||___/ * */ final JButton btnFiles = new JButton( Integer.toString(resValue.getAttachedFilesConnections().size()), SYSConst.icon22greenStar); btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip")); btnFiles.setForeground(Color.BLUE); btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER); btnFiles.setFont(SYSConst.ARIAL18BOLD); btnFiles.setPressedIcon(SYSConst.icon22Pressed); btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT); btnFiles.setAlignmentY(Component.TOP_ALIGNMENT); btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnFiles.setContentAreaFilled(false); btnFiles.setBorder(null); btnFiles.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgFiles(resValue, new Closure() { @Override public void execute(Object o) { EntityManager em = OPDE.createEM(); final ResValue myValue = em.find(ResValue.class, resValue.getID()); em.close(); synchronized (mapType2Values) { mapType2Values.get(keyYears).remove(resValue); mapType2Values.get(keyYears).add(myValue); Collections.sort(mapType2Values.get(keyYears)); } createCP4Year(vtype, year); buildPanel(); } }); } }); btnFiles.setEnabled(OPDE.isFTPworking()); pnlTitle.getRight().add(btnFiles); } if (!resValue.getAttachedProcessConnections().isEmpty()) { /*** * _ _ ____ * | |__ | |_ _ __ | _ \ _ __ ___ ___ ___ ___ ___ * | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __| * | |_) | |_| | | | __/| | | (_) | (_| __/\__ \__ \ * |_.__/ \__|_| |_|_| |_| \___/ \___\___||___/___/ * */ final JButton btnProcess = new JButton( Integer.toString(resValue.getAttachedProcessConnections().size()), SYSConst.icon22redStar); btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip")); btnProcess.setForeground(Color.YELLOW); btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER); btnProcess.setFont(SYSConst.ARIAL18BOLD); btnProcess.setPressedIcon(SYSConst.icon22Pressed); btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT); btnProcess.setAlignmentY(Component.TOP_ALIGNMENT); btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnProcess.setContentAreaFilled(false); btnProcess.setBorder(null); btnProcess.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgProcessAssign(resValue, new Closure() { @Override public void execute(Object o) { if (o == null) { return; } Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o; ArrayList<QProcess> assigned = result.getFirst(); ArrayList<QProcess> unassigned = result.getSecond(); EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); ResValue myValue = em.merge(resValue); em.lock(myValue, LockModeType.OPTIMISTIC_FORCE_INCREMENT); ArrayList<SYSVAL2PROCESS> attached = new ArrayList<SYSVAL2PROCESS>( resValue.getAttachedProcessConnections()); for (SYSVAL2PROCESS linkObject : attached) { if (unassigned.contains(linkObject.getQProcess())) { linkObject.getQProcess().getAttachedNReportConnections() .remove(linkObject); linkObject.getResValue().getAttachedProcessConnections() .remove(linkObject); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": " + myValue.getTitle() + " ID: " + myValue.getID(), PReportTools.PREPORT_TYPE_REMOVE_ELEMENT, linkObject.getQProcess())); em.remove(linkObject); } } attached.clear(); for (QProcess qProcess : assigned) { java.util.List<QProcessElement> listElements = qProcess.getElements(); if (!listElements.contains(myValue)) { QProcess myQProcess = em.merge(qProcess); SYSVAL2PROCESS myLinkObject = em .merge(new SYSVAL2PROCESS(myQProcess, myValue)); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": " + myValue.getTitle() + " ID: " + myValue.getID(), PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess)); qProcess.getAttachedResValueConnections().add(myLinkObject); myValue.getAttachedProcessConnections().add(myLinkObject); } } em.getTransaction().commit(); synchronized (mapType2Values) { mapType2Values.get(keyYears).remove(resValue); mapType2Values.get(keyYears).add(myValue); Collections.sort(mapType2Values.get(keyYears)); } createCP4Year(vtype, year); buildPanel(); } catch (OptimisticLockException ole) { OPDE.warn(ole); if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); } catch (RollbackException ole) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } }); } }); btnProcess.setEnabled(OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)); pnlTitle.getRight().add(btnProcess); } /*** * __ __ * | \/ | ___ _ __ _ _ * | |\/| |/ _ \ '_ \| | | | * | | | | __/ | | | |_| | * |_| |_|\___|_| |_|\__,_| * */ final JButton btnMenu = new JButton(SYSConst.icon22menu); btnMenu.setPressedIcon(SYSConst.icon22Pressed); btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT); btnMenu.setAlignmentY(Component.TOP_ALIGNMENT); btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMenu.setContentAreaFilled(false); btnMenu.setBorder(null); btnMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JidePopup popup = new JidePopup(); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.setOwner(btnMenu); popup.removeExcludedComponent(btnMenu); JPanel pnl = getMenu(resValue); popup.getContentPane().add(pnl); popup.setDefaultFocusComponent(pnl); GUITools.showPopup(popup, SwingConstants.WEST); } }); btnMenu.setEnabled(!resValue.isObsolete()); pnlTitle.getRight().add(btnMenu); pnlYear.add(pnlTitle.getMain()); synchronized (linemap) { linemap.put(resValue, pnlTitle.getMain()); } } return pnlYear; }
From source file:org.eclipse.wb.tests.designer.core.model.property.editor.StaticFieldPropertyEditorTest.java
/** * Test for {@link StaticFieldPropertyEditor#getValueSource(Object)}. *//*from w ww . j a v a 2 s .c om*/ public void test_getValueSource() throws Exception { StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor(); editor.configure(SwingConstants.class, new String[] { "LEFT", "*remove", "RIGHT" }); // assertEquals("javax.swing.SwingConstants.LEFT", editor.getValueSource(SwingConstants.LEFT)); assertNull(editor.getValueSource(null)); assertEquals("javax.swing.SwingConstants.RIGHT", editor.getValueSource(SwingConstants.RIGHT)); assertNull(editor.getValueSource(SwingConstants.NORTH)); }
From source file:org.executequery.base.DockedTabContainer.java
/** * Returns the tab pane at the specified position. * * @param position - the position of the pane *//*from w w w . j a v a2 s. c o m*/ protected TabPane getTabPaneForPosition(int position) { switch (position) { case SwingConstants.NORTH: case SwingConstants.NORTH_WEST: case SwingConstants.NORTH_EAST: return northTabPane; case SwingConstants.SOUTH: case SwingConstants.SOUTH_WEST: case SwingConstants.SOUTH_EAST: return southTabPane; case SwingConstants.CENTER: return scrollingTabPane; } return null; }
From source file:org.executequery.base.DockedTabContainer.java
/** * Adds the specified component as a docked tab component * in the specified position.// ww w .j a v a2 s . c o m * * @param the tab title * @param the tab icon * @param the component * @param the tab's tool tip * @param the position - one of SwingConstants.NORTH | SOUTH */ public void addDockedTab(String title, Icon icon, Component component, String tip, int position) { // make sure the split pane is visible splitPane.setVisible(true); DockedTabPane tabPane = null; // check if we have a north tab pane. // if not, add there regardless of specified position if (northTabPane == null && orientation != CENTER) { northTabPane = new DockedTabPane(this); splitPane.setLeftComponent(northTabPane); tabPane = northTabPane; // if we have minimised tabs but added a tab pane // restore it to its previous size //if (buttonPanel != null) { //desktopMediator.resetPaneToPreferredSizes(orientation, true); //} } else { switch (position) { case SwingConstants.NORTH: case SwingConstants.NORTH_WEST: case SwingConstants.NORTH_EAST: tabPane = northTabPane; break; case SwingConstants.SOUTH: case SwingConstants.SOUTH_WEST: case SwingConstants.SOUTH_EAST: if (southTabPane == null) { southTabPane = new DockedTabPane(this); southPaneCreated(); } tabPane = southTabPane; break; case SwingConstants.CENTER: if (scrollingTabPane == null) { scrollingTabPane = new ScrollingTabPane(this); splitPane.setLeftComponent(scrollingTabPane); splitPane.setGlassPaneVisible(SwingUtilities.BOTTOM, true); splitPane.setGlassPaneVisible(SwingUtilities.TOP, false); splitPane.setResizeWeight(1.0); if (southTabPane != null) { splitPane.setDividerSize(ApplicationConstants.SPLIT_PANE_DIVIDER_SIZE); } } scrollingTabPane.addTab(position, title, icon, component, tip); return; } } if (tabPane != null) { tabPane.addTab(position, title, icon, component, tip); } if (orientation != SwingConstants.CENTER) { desktopMediator.resetPaneToPreferredSizes(orientation, true); } }
From source file:org.executequery.base.DockedTabContainer.java
private TabComponent getTabComponent(String title) { String tabTitle = title.toUpperCase(); int[] positions = { SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.CENTER }; for (int tabPosition : positions) { List<TabComponent> tabs = getOpenTabs(tabPosition); if (tabs != null) { for (TabComponent tab : tabs) { if (StringUtils.startsWithIgnoreCase(tab.getTitle(), tabTitle)) { return tab; }//w ww . j a v a 2 s . co m } } } return null; }
From source file:org.executequery.base.DockedTabContainer.java
/** * Indicates whether the tab pane in the specified * position is visible./* ww w . j a v a2 s .c o m*/ * * @return <code>true | false</code> */ public boolean isTabPaneVisible(int position) { switch (position) { case SwingConstants.NORTH: case SwingConstants.NORTH_WEST: case SwingConstants.NORTH_EAST: return (northTabPane != null); case SwingConstants.SOUTH: case SwingConstants.SOUTH_WEST: case SwingConstants.SOUTH_EAST: return (southTabPane != null); } return (northTabPane != null || southTabPane != null); }
From source file:unikn.dbis.univis.visualization.graph.VGraph.java
/** * Creates a new VGraph with drop target action and a * tree layout cache./*ww w.ja v a 2 s. c o m*/ */ public VGraph() { setUI(new VGraphUI()); setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY, new VGraphDropTargetListener())); setModel(model); setGraphLayoutCache(cache); setEditable(false); setMoveable(false); setSelectionEnabled(true); layout.setOrientation(SwingConstants.NORTH); }
From source file:unikn.dbis.univis.visualization.graph.VGraph.java
/** * @param source Source where the edge is starting. * @param target Target where the edge is ending. *//* w w w. j a v a 2 s . c o m*/ public void createEdges(VGraphCell source, VGraphCell target) { DefaultEdge edge = new DefaultEdge(); if (layout.getOrientation() == SwingConstants.NORTH) { edge.setSource(source.getChildAt(1)); edge.setTarget(target.getChildAt(0)); } else if (layout.getOrientation() == SwingConstants.WEST) { edge.setSource(source.getChildAt(3)); edge.setTarget(target.getChildAt(2)); } else if (layout.getOrientation() == SwingConstants.SOUTH) { edge.setSource(source.getChildAt(0)); edge.setTarget(target.getChildAt(1)); } else if (layout.getOrientation() == SwingConstants.EAST) { edge.setSource(source.getChildAt(2)); edge.setTarget(target.getChildAt(3)); } GraphConstants.setLineEnd(edge.getAttributes(), GraphConstants.ARROW_CLASSIC); GraphConstants.setEndFill(edge.getAttributes(), true); cache.insert(edge); }