protected void displayNewTxf(String strLabel, String strValue) { strLabel = (strLabel == null) ? "" : strLabel.trim(); strValue = (strValue == null) ? "" : strValue.trim(); JCheckBox chkBox1 = new JCheckBox(Util.getImageIcon("boxGray.gif")); DataField txf1 = new DataField(strLabel); DataField txf2 = new DataField(strValue); JPanel pnlTxf = new JPanel(m_gbl); m_nRow = m_nRow + 1; txf1.setName("label"); txf2.setName("value"); /* 1st line of text field*/ m_gbc.weightx = 0; showComp(m_gbl, m_gbc, 0, m_nRow, 1, chkBox1); m_gbc.weightx = 1; showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf1); // showSpaces( gbl, gbc, 2, 6 ); showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf2); m_gbc.weightx = 0; txf1.addFocusListener(this); txf2.addFocusListener(this); m_objTxfValue.addToLabel(txf1); m_objTxfValue.addToValue(txf2); }
public void switchLayout(int newId, boolean bLayout) { if (layoutId == newId) return; if (newId >= nviews) updateVpInfo(newId + 1); if (bSwitching) { return; } bSwitching = true; int oldId = layoutId; vpId = newId; layoutId = newId; recordCurrentLayout(); VpLayoutInfo vInfo = Util.getViewArea().getLayoutInfo(oldId); if (vInfo != null) { // save current layout info vInfo.tp_selectedTab = tp_selectedTab; vInfo.setVerticalTabName(selectedTabName); // copyCurrentLayout(vInfo); } vInfo = Util.getViewArea().getLayoutInfo(newId); putHsLayout(oldId); if (bLayout) getHsLayout(vpId); for (int i = 0; i < toolList.size(); i++) ((VToolPanel) toolList.get(i)).switchLayout(newId, bLayout); if (bLayout) setCurrentLayout(); /* if(comparePanelLayout(oldId, newId)) { setCurrentLayout(); } if ((vInfo != null) && vInfo.bAvailable && compareCurrentLayout(vInfo)) { setCurrentLayout(vInfo); } for(int i=0; i< toolList.size(); i++) ((VToolPanel) toolList.get(i)).switchLayout(newId); */ // setViewPort(newId); if (bLayout) setCurrentLayout(vInfo); updateValue(); if (bLayout) { if (pinPanel.isOpen()) { if (!pinPanel.isVisible()) pinPanel.setVisible(true); } else pinPanel.setVisible(false); } validate(); repaint(); bSwitching = false; }
static { noProbeImage = Util.getImageIcon("probeNone.gif"); wrongProbeImage = Util.getImageIcon("probeWrong.gif"); untunedProbeImage = Util.getImageIcon("probeUntuned.gif"); readyProbeImage = Util.getImageIcon("probeReady.gif"); errorProbeImage = Util.getImageIcon("probeError.gif"); }
/** * Gets the imageicon. If the user has a predefined icon, get that, otherwise get the varian icon. * * @return the imageicon */ protected ImageIcon getImageIcon() { ImageIcon icon = null; String strPath = WOperators.getDefIcon(); if (strPath != null) { icon = Util.getImageIcon(strPath); } if (icon == null) icon = Util.getImageIcon(WOperators.ICON); return icon; }
/** * constructor * * @param sshare session share */ public SpotterButton(SessionShare sshare) { JMenuItem item; this.sshare = sshare; // setBackground(Global.BGCOLOR); setContentAreaFilled(false); // setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); setMargin(new Insets(0, 0, 0, 0)); setBorder(new VButtonBorder()); setUnderline(false); setIcon(Util.getImageIcon("search_20.png")); setToolTipText(Util.getLabel("_Locator_Statements")); addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent evt) { // Save startup time by not filling this menu until // it is first clicked. fillPopupMenu(); } }); addPopListener( new PopListener() { public void popHappened(String popStr) { SessionShare sshare = ResultTable.getSshare(); if (popStr.startsWith("save:")) { String saveName = popStr.substring(5); StatementHistory history = sshare.statementHistory(); history.readNamedStatement(saveName); } else if (popStr.startsWith("command:")) { String commandName = popStr.substring(8); int index = commandName.indexOf('/'); String objType = commandName.substring(0, index); LocatorHistory lh = sshare.getLocatorHistory(); // Set History Active Object type to this type. lh.setActiveObjType(objType); // Now get history for this type. StatementHistory history = sshare.statementHistory(); history.appendLastOfType(commandName); } else if (popStr.startsWith("title:")) { String objType = popStr.substring(6); LocatorHistory lh = sshare.getLocatorHistory(); // Update locator to the most recent statement for this type lh.setHistoryToThisType(objType); } } }); DisplayOptions.addChangeListener(this); } // SpotterButton()
protected void layoutUIComponents(String strPath, boolean bDefaultFile) { JLabel label = null; // i18n // label = new JLabel( "File names can be constructed from a template. The LABEL field is " ); label = new JLabel( Util.getAdmLabel( "_admin_File_names_can_be_constructed_from_a_template._The_LABEL_field_is_")); label.setForeground(Color.black); // m_gbc.weightx = 0.5; showInstruction(m_gbl, m_gbc, 0, 0, 7, label); // i18n // label = new JLabel( "presented as the choice to the user in the \"Data save\" pop-up." ); label = new JLabel( Util.getAdmLabel( "_admin_presented_as_the_choice_to_the_user_in_the_Data_save_pop-up.")); showInstruction(m_gbl, m_gbc, 0, 1, 7, label); showInstruction(m_gbl, m_gbc, 0, 2, 1, new JLabel("")); label = new JLabel(Util.getAdmLabel("_adm_LABEL")); label.setForeground(Color.black); m_gbc.gridx = 1; m_gbc.gridy = 2; m_gbc.ipadx = 10; m_gbl.setConstraints(label, m_gbc); m_pnlDisplay.add(label); label = new JLabel(" "); m_gbc.gridx = 2; m_gbc.gridy = 2; m_gbc.ipadx = 0; // reset to default m_gbc.gridwidth = 5; m_gbl.setConstraints(label, m_gbc); // add( label ); showInstruction(m_gbl, m_gbc, 2, 2, 1, new JLabel(Util.getAdmLabel("_admin_TEMPLATE"))); m_nRow = 3; m_bDefaultFile = bDefaultFile; m_objTxfValue.clearArrays(); displayNewTxf(strPath); m_pnlDisplay.setBorder( new CompoundBorder( BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
public DisplayUserDirectory() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; hmlabel.setForeground(Color.black); add(hmlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(hmdir, gbc); add(Box.createVerticalStrut(15), gbc); gbc.gridwidth = 1; vjlabel.setForeground(Color.black); add(vjlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(vjdir, gbc); add(Box.createVerticalStrut(0), gbc); gbc.gridwidth = 1; vjlabel2.setForeground(Color.black); add(vjlabel2, gbc); setBorder( new CompoundBorder( // i18n // BorderFactory.createTitledBorder(" User_Directories "), BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
/** When a new set of saved statements come in, refresh the menu of saved statements. */ private void refreshSaveMenu() { ArrayList list; // first, delete what's already there for (; ; ) { Component comp = popup.getComponent(1); if (!(comp instanceof JMenuItem)) break; JMenuItem item = (JMenuItem) comp; if (item.getActionCommand().startsWith("save:")) popup.remove(1); else break; } StatementHistory history; history = sshare.statementHistory(); // now insert the new list of saved statements list = history.getNamedStatementList(); Color bgColor = Util.getBgColor(); for (int i = 0; i < list.size(); i++) { ArrayList nameNlabel = (ArrayList) list.get(i); JMenuItem item = new JMenuItem(" " + (String) nameNlabel.get(1)); item.setActionCommand("save:" + (String) nameNlabel.get(0)); popup.add(item, 1); // item.setBackground(bgColor); item.addActionListener(popActionListener); } } // refreshSaveMenu()
public boolean popupTool(String name) { JComponent obj = searchTool(name); if (obj == null) return false; if (obj instanceof VToolPanel) { if (!((VToolPanel) obj).popupTool(name)) return false; } else { if (obj instanceof PushpinIF) { PushpinIF pobj = (PushpinIF) obj; if (!pobj.isOpen()) pobj.pinPopup(true); } } bChangeTool = true; setCurrentLayout(); if (!pinPanel.isOpen()) { pinPanel.setVisible(false); bChangeTool = false; return false; } displayTool((Component) obj); VnmrjIF vif = Util.getVjIF(); if (vif != null) vif.raiseToolPanel(true); bChangeTool = false; validate(); repaint(); return true; }
/** Returns the tool bar for the panel. */ protected JComponent getToolBar() { JToolBar tbarDir = new JToolBar(); JButton btnNew = new JButton(); // m_btnSave = new JButton("Save File"); // i118n // btnNew.setText("New Label"); btnNew.setText(Util.getAdmLabel("_adm_New_Label")); btnNew.setActionCommand("new"); // m_btnSave.setActionCommand("save"); ActionListener alTool = new ActionListener() { public void actionPerformed(ActionEvent e) { doAction(e); } }; btnNew.addActionListener(alTool); // m_btnSave.addActionListener(alTool); tbarDir.setFloatable(false); tbarDir.add(btnNew); /*tbarDir.add(new JLabel(" ")); tbarDir.add(m_btnSave);*/ return tbarDir; }
public boolean popdnTool(String name) { JComponent obj = searchTool(name); if (obj == null) return false; if (obj instanceof VToolPanel) { if (!((VToolPanel) obj).popdnTool(name)) return false; } else { if (obj instanceof PushpinIF) { PushpinIF pobj = (PushpinIF) obj; pobj.pinPopup(false); } boolean bContain = containTool(obj); if (!bContain) return false; } bChangeTool = true; setCurrentLayout(); if (previous_selectedTab >= 1 && tabbedPane != null) { if (tabbedPane.getTabCount() > previous_selectedTab) tabbedPane.setSelectedIndex(previous_selectedTab); } VnmrjIF vif = Util.getVjIF(); if (vif != null) vif.raiseToolPanel(false); if (!pinPanel.isOpen()) pinPanel.setVisible(false); bChangeTool = false; updateSelectedObj(); repaint(); return true; }
protected void layoutUIComponents(String strPath, boolean bDefaultFile) { // gbc.weightx = 0.5; showInstructions(m_gbl, m_gbc, 0, 0, 7, infoLabel1); showInstructions(m_gbl, m_gbc, 0, 1, 7, infoLabel2); showInstructions(m_gbl, m_gbc, 0, 2, 7, infoLabel3); /*showInstructions( gbl, gbc, 0, 3, 7, infoLabel4 ); showInstructions( gbl, gbc, 0, 4, 7, infoLabel5 );*/ showInstructions(m_gbl, m_gbc, 0, 5, 1, new JLabel("")); // i18n // label = new JLabel( "LABEL" ); label = new JLabel(Util.getAdmLabel("_adm_LABEL")); label.setForeground(Color.black); m_gbc.gridx = 1; m_gbc.gridy = 5; // gbc.ipadx = 10; m_gbl.setConstraints(label, m_gbc); m_pnlDisplay.add(label); label = new JLabel(" "); m_gbc.gridx = 2; m_gbc.gridy = 5; m_gbc.ipadx = 0; m_gbc.gridwidth = 5; m_gbc.weightx = 0; m_gbl.setConstraints(label, m_gbc); // add( label ); // i18n // showInstructions( m_gbl, m_gbc, 2, 5, 1, new JLabel( "DIRECTORY" )); showInstructions(m_gbl, m_gbc, 2, 5, 1, new JLabel(Util.getAdmLabel("_adm_DIRECTORY"))); m_nRow = 5; m_bDefaultFile = bDefaultFile; m_objTxfValue.clearArrays(); displayNewTxf(strPath); m_pnlDisplay.setBorder( new CompoundBorder( // i18n // BorderFactory.createTitledBorder( " Parent Directories "), BorderFactory.createTitledBorder(Util.getAdmLabel("_adm_Parent_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
public void setVisible(boolean bShow, String title) { if (bShow) { String strDir = ""; String strFreq = ""; String strTraynum = ""; m_strHelpFile = getHelpFile(title); String strSampleName = getSampleName(title); String frameBounds = getFrameBounds(title); StringTokenizer tok = new QuotedStringTokenizer(title); if (tok.hasMoreTokens()) strDir = tok.nextToken(); if (tok.hasMoreTokens()) strFreq = tok.nextToken(); if (tok.hasMoreTokens()) strTraynum = tok.nextToken(); else { try { Integer.parseInt(strDir); // if strdir is number, then strdir is empty, and the // strfreq is the number strTraynum = strFreq; strFreq = strDir; strDir = ""; } catch (Exception e) { } } try { setTitle(gettitle(strFreq)); m_lblSampleName.setText("3"); boolean bVast = isVast(strTraynum); CardLayout layout = (CardLayout) m_pnlSampleName.getLayout(); if (!bVast) { if (strSampleName == null) { strSampleName = getSampleName(strDir, strTraynum); } m_lblSampleName.setText(strSampleName); layout.show(m_pnlSampleName, OTHER); } else { m_strDir = strDir; setTrays(); layout.show(m_pnlSampleName, VAST); m_trayTimer.start(); } boolean bSample = bVast || !strSampleName.trim().equals(""); m_pnlSampleName.setVisible(bSample); m_lblLogin.setForeground(getBackground()); m_lblLogin.setVisible(false); m_passwordField.setText(""); m_passwordField.setCaretPosition(0); } catch (Exception e) { Messages.writeStackTrace(e); } setBounds(frameBounds); ExpPanel exp = Util.getActiveView(); if (exp != null) exp.waitLogin(true); } writePersistence(); setVisible(bShow); }
private void tabChanged() { if (bChangeTool) return; int index = -1; previous_selectedTab = 0; if (tabbedPane.getTabCount() > 1) { index = tabbedPane.getSelectedIndex(); Component comp = tabbedPane.getSelectedComponent(); if (comp != null && (comp instanceof PushpinIF)) { PushpinIF pobj = (PushpinIF) comp; if (!pobj.isPopup()) previous_selectedTab = index; } } updateSelectedObj(); if (index >= 0) { if (Util.getRQPanel() != null) { Util.getRQPanel().updatePopup(tabbedPane.getTitleAt(index)); } } }
public LoginBox() { super("VnmrJ Login"); dolayout("", "", ""); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); // setVast(); DisplayOptions.addChangeListener(this); try { InetAddress inetAddress = InetAddress.getLocalHost(); m_strHostname = inetAddress.getHostName(); } catch (Exception e) { m_strHostname = "localhost"; } VNMRFrame vnmrFrame = VNMRFrame.getVNMRFrame(); Dimension size = vnmrFrame.getSize(); position = vnmrFrame.getLocationOnScreen(); AppIF appIF = Util.getAppIF(); int h = appIF.statusBar.getSize().height; width = size.width; height = size.height - h; // Allow resizing and use the previous size and position // To stop resizing, use setResizable(false); readPersistence(); // setSize(width, height); // setLocation(position); // setResizable(false); setBackgroundColor(Util.getBgColor()); m_trayTimer = new javax.swing.Timer( 6000, new ActionListener() { public void actionPerformed(ActionEvent e) { setTrays(); } }); }
public VTabbedToolPanel(SessionShare sshare, AppIF appIF) { // super( new BorderLayout() ); this.sshare = sshare; this.appIF = appIF; this.tabbedToolPanel = new JPanel(); this.pinPanel = this; this.selectedTabName = null; setPinObj(this.tabbedToolPanel); this.tabbedToolPanel.setLayout(new BorderLayout()); this.tabbedPane = new JTabbedPane(); panelName = "Tab Panel"; setTitle(panelName); setName(panelName); tabbedPane.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { tabChanged(); /** * ** the following was moved to tabChanged() if(tabbedPane.getTabCount() > 1 && * Util.getRQPanel() != null) { int ind = tabbedPane.getSelectedIndex(); if(ind >= 0 && * ind < tabbedPane.getTabCount()) * Util.getRQPanel().updatePopup(tabbedPane.getTitleAt(ind)); } ********* */ } }); // Add Mouse Listener for CSH MouseAdapter ml = new CSHMouseAdapter(); tabbedPane.addMouseListener(ml); Object obj = sshare.userInfo().get("canvasnum"); if (obj != null) { Dimension dim = (Dimension) obj; nviews = (dim.height) * (dim.width); } else nviews = 1; for (int i = 0; i < nviews; i++) tp_paneInfo[i] = new Hashtable(); /* obj = sshare.userInfo().get("activeWin"); if(obj != null) { vpId = ((Integer)obj).intValue(); } else vpId = 0; */ // System.out.println("VToolPanel nviews vpId "+nviews+" "+vpId); fillHashtable(); Util.setVTabbedToolPanel(this); ParamInfo.addEditListener(this); }
public XMLToolPanel(SessionShare ss, String pname, String fname) { this.vnmrIf = (ButtonIF) Util.getViewArea().getDefaultExp(); this.sshare = ss; this.pname = pname; this.fname = fname; pane = new ParamPanel(); pane.setPanelFile(fname); pane.setPanelName(pname); pane.setType(ParamInfo.TOOLPANEL); pane.setLayoutName("toolPanels"); pane.setAttributes(null); paramsLayout = new VRubberPanLayout(); if (!Util.isImagingUser()) paramsLayout.setSquish(1.0); DisplayOptions.addChangeListener(this); ExpPanel.addStatusListener(this); // ExpPanel.addExpListener(this); setLayout(new xpPanelLayout()); } // constructor
protected void setTrayPresent(String strPath) { String strzone = "zones"; BufferedReader reader = WFileUtil.openReadFile(strPath); if (reader == null) return; String strLine; try { // if the zones are set to 0, then there is no tray present // set rackInfo(1,zones) 3 => tray 1 present // set rackInfo(2,zones) 0 => tray 2 not present while ((strLine = reader.readLine()) != null) { int index = strLine.indexOf(strzone); if (index < 0) continue; String strTray = strLine.substring(index - 2, index - 1); int nTray = 0; try { nTray = Integer.parseInt(strTray); } catch (Exception e) { } if (nTray <= 0) continue; int nZone = 0; try { strTray = strLine.substring(index + strzone.length() + 2, strLine.length()); nZone = Integer.parseInt(strTray); } catch (Exception e) { } Color colorbg = Color.white; String strTooltip = TRAY; if (nZone <= 0) { colorbg = Color.black; strTooltip = NOTRAY; } VBox pnlVast = m_pnlVast[nTray - 1]; pnlVast.setbackground(colorbg); pnlVast.setToolTipText(Util.getTooltipString(strTooltip)); } reader.close(); } catch (Exception e) { // e.printStackTrace(); Messages.writeStackTrace(e); } }
// Get the size of the full vnmrj frame and set the Login Panel // to that size and position. public void setDefaultSizePosition() { VNMRFrame vnmrFrame = VNMRFrame.getVNMRFrame(); Dimension size = vnmrFrame.getSize(); // Save point for later use also position = vnmrFrame.getLocationOnScreen(); AppIF appIF = Util.getAppIF(); int h = appIF.statusBar.getSize().height; // Save width and height for later use also width = size.width; height = size.height - h; // Go ahead and set the size and position setSize(width, height); setLocation(position); }
protected void displayNewTxf(String strLabel, String strValue) { strLabel = (strLabel != null) ? strLabel.trim() : ""; strValue = (strValue != null) ? strValue.trim() : ""; JCheckBox chk1 = new JCheckBox(Util.getImageIcon("boxGray.gif")); final DataField txf1 = new DataField(strLabel); final DataField txf2 = new DataField(strValue); m_nRow = m_nRow + 1; txf1.setName("label"); txf2.setName("value"); // new field if (strLabel.equals("") && strValue.equals("")) { txf2.setText(INFOSTR); txf2.addMouseListener(m_mlTxf); if (timer != null) timer.cancel(); timer = new java.util.Timer(); timer.schedule( new TimerTask() { public void run() { WUtil.blink(txf2, WUtil.FOREGROUND); } }, delay, delay); } /* 1st line of text field*/ m_gbc.weightx = 0; showComp(m_gbl, m_gbc, 0, m_nRow, 1, chk1); m_gbc.weightx = 1; showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf1); // showSpaces( gbl, gbc, 2, 6 ); showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf2); m_gbc.weightx = 0; txf1.addFocusListener(this); txf2.addFocusListener(this); // Add the textfields to the respective arrays, so that they // can be retreived later for writing to the file. m_objTxfValue.addToLabel(txf1); m_objTxfValue.addToValue(txf2); }
public JComponent searchTool(String name, int id) { VToolPanel vp = null; int num = keys.size(); if (num <= 0 || name == null) return null; name = Util.getLabelString(name); for (int i = 0; i < num; i++) { String key = (String) keys.get(i); JComponent obj = (JComponent) panes.get(key); if (obj instanceof VToolPanel) vp = (VToolPanel) obj; else if (name.equals(key) && obj != null) { String Value = (String) tp_paneInfo[id].get(key); if (Value.equals("yes")) { return obj; } } } return (JComponent) vp; }
public void setViewPort(int id) { if (pane == null) return; // ButtonIF vif = Util.getViewArea().getActiveVp(); ButtonIF vif = Util.getViewArea().getExp(id); if (vif == null) return; int nums = pane.getComponentCount(); for (int i = 0; i < nums; i++) { Component comp = pane.getComponent(i); if (comp instanceof VObjIF) { VObjIF obj = (VObjIF) comp; obj.setVnmrIF(vif); } } }
protected static char[] getPassword(char[] password) { int size = password.length; int data = 0; boolean bwindows = Util.iswindows(); for (int i = 0; i < size; i++) { if (!bwindows) { if (password[i] == '`' || password[i] == '"' || password[i] == '\\') data = data + 1; } else { if (password[i] == '"') data = data + 1; else if (password[i] == ' ') data = data + 2; } } char[] password2 = new char[size + data]; int size2 = password2.length; int j = 0; for (int i = 0; i < size2; i++) { if (j >= size) break; boolean bSpace = false; if (!bwindows) { if (password[j] == '`' || password[j] == '"' || password[j] == '\\') { password2[i] = '\\'; i = i + 1; } } else { if (password[j] == '"') { password2[i] = '\\'; i = i + 1; } else if (password[j] == ' ') { password2[i] = '"'; i = i + 1; password2[i] = password[j]; i = i + 1; password2[i] = '"'; // i=i+1; bSpace = true; } } if (!bSpace) password2[i] = password[j]; j = j + 1; } return password2; }
public UserDirectoryDialog(int nBuild) { super("View Directories"); initBlink(); try { // UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel" ); } catch (Exception exc) { System.out.println("Error loading L&F: " + exc); } AppIF appIf = Util.getAppIF(); if (appIf instanceof VAdminIF) m_adminIF = (VAdminIF) appIf; if (nBuild == BUILD_ALL) { JPanel left = new JPanel(); left.setOpaque(true); left.setLayout(new BorderLayout()); left.add(new ConstraintsPanel(), BorderLayout.CENTER); JPanel right = new JPanel(); right.setLayout(new BorderLayout()); right.setOpaque(true); // right.setBackground( Color.white ); JTreeTableAdmin treeTable = new JTreeTableAdmin(new FileSystemModelAdmin()); right.add(new JScrollPane(treeTable), BorderLayout.CENTER); JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right); pane.setContinuousLayout(true); pane.setOneTouchExpandable(true); getContentPane().add(pane, BorderLayout.CENTER); } m_mlTxf = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (timer != null) timer.cancel(); if (e.getSource() instanceof JTextField) { JTextField txf2 = (JTextField) e.getSource(); String strTxt = txf2.getText(); if (strTxt != null && strTxt.equals(INFOSTR)) txf2.setText(""); } } }; }
protected void setTrayActive(String strDir) { String strTray; String strStudy; String strActive = "Active"; String cmd = "SELECT vrack_,studystatus from study WHERE (autodir=\'" + strDir + "\') AND (hostname=\'" + getHost() + "\')"; m_dbResult = null; try { m_dbResult = getdbmanager().executeQuery(cmd); } catch (Exception e) { return; } if (m_dbResult == null) return; int nTray = 0; try { while (m_dbResult.next()) { strTray = m_dbResult.getString(1); strStudy = m_dbResult.getString(2); if (strStudy != null && strStudy.equalsIgnoreCase(strActive)) { try { nTray = Integer.parseInt(strTray); } catch (Exception e) { } if (nTray > 0) { m_pnlVast[nTray - 1].setbackground(Color.blue); m_pnlVast[nTray - 1].setToolTipText(Util.getTooltipString(TRAYACTIVE)); break; } } } } catch (Exception e) { // e.printStackTrace(); Messages.writeStackTrace(e); } }
public void fillPopupMenu() { JMenuItem item; TextImageIcon textIcon; StatementHistory history; int rowCount = 0; int numRows = 0; Insets margin = new Insets(0, 0, 0, 0); // Get the font defined in the displayOptions panel for menus Font ft = DisplayOptions.getFont("Menu1"); // We need a fairly small font, so make it 2 smaller. int size = ft.getSize(); // If larger than 12, subtract 2 if (size > 12) size -= 2; Font font = DisplayOptions.getFont(ft.getName(), ft.getStyle(), size); // This flag is used so that we only fill the menu when needed if (menuAlreadyFilled) return; menuAlreadyFilled = true; history = sshare.statementHistory(); ArrayList list = history.getNamedStatementList(); Color bgColor = Util.getBgColor(); // Only show the Saved Statements section if there are some. if (list != null && list.size() != 0) { item = popup.add("Saved Statements"); rowCount++; // item.setForeground(Color.blue); // item.setBackground(bgColor); item.setFont(font); item.setMargin(margin); popup.add(item); for (int i = 0; i < list.size(); i++) { ArrayList nameNlabel = (ArrayList) list.get(i); // first item in nameNlabel is name and second is label item = popup.add(" " + (String) nameNlabel.get(1)); rowCount++; item.setActionCommand("save:" + (String) nameNlabel.get(0)); // item.setBackground(bgColor); item.addActionListener(popActionListener); item.setFont(font); item.setMargin(margin); } } // the rest of menu (return object types, statement types, etc.) ShufflerService shufflerService = sshare.shufflerService(); ArrayList objTypes = shufflerService.getAllMenuObjectTypes(); for (int i = 0; i < objTypes.size(); i++) { String objType = (String) objTypes.get(i); // Do not display menu for DB_AVAIL_SUB_TYPES if (objType.equals(Shuf.DB_AVAIL_SUB_TYPES)) continue; // addSeparator looks bad using GridLayout because it creates rows // and columns which are all equal in size. It cannot have a row // with a separator which is a different height than the other // rectangles it creates. So just use dashes. item = popup.add(separator); item.setFont(font); item.setMargin(margin); rowCount++; item = popup.add(shufflerService.getCategoryLabel(objType)); rowCount++; // item.setForeground(Color.blue); item.setActionCommand("title:" + objType); // item.setBackground(bgColor); item.addActionListener(popActionListener); item.setFont(font); item.setMargin(margin); ArrayList menuStrings = shufflerService.getmenuStringsThisObj(objType); // If current rowCount plus the next section size is too big, // specify the numRows to the current value of rowCount -1. // That is, put this next section in a new column. // 47 is emperical number of rows to fit 90% full screen. if (numRows == 0 && rowCount - 1 + menuStrings.size() > 44) { numRows = rowCount - 2; } for (int j = 0; j < menuStrings.size(); j++) { String menuString = (String) menuStrings.get(j); item = popup.add(" " + menuString); rowCount++; item.setActionCommand("command:" + objType + "/" + menuString); // item.setBackground(bgColor); item.addActionListener(popActionListener); item.setFont(font); item.setMargin(margin); } // The spotter menu changes dynamically when // the list of saved statements changes. history.addStatementListener( new StatementAdapter() { public void saveListChanged() { refreshSaveMenu(); } }); } if (numRows == 0) numRows = rowCount; GridLayoutCol lm = new GridLayoutCol(numRows, 0); popup.setLayout(lm); }
private String getLocatorName() { String name = "Holding"; if (Util.isImagingUser()) name = "Study"; if (Util.isWalkupUser()) name = "Protocols"; return Util.getLabelString(name); }
public void showPinObj(PushpinIF pobj, boolean on) { Component comp = (Component) pobj; if (comp == null) return; Container p = comp.getParent(); if (!on) { pobj.setPopup(false, true); if (p != null && p != tabbedPane) { p.remove(comp); p.validate(); p.repaint(); } if (popupComp == comp) popupComp = null; return; } if (popupComp != null) { if (popupComp != comp) { ((PushpinIF) popupComp).setPopup(false, true); p = popupComp.getParent(); if (p != null && p != tabbedPane) { p.remove(popupComp); } } popupComp = null; } /* if (!isShowing()) { return; } */ if (comp.isShowing()) { return; } Container p2 = null; p = pinPanel.getParent(); while (p != null) { if (p instanceof JLayeredPane) p2 = p; p = p.getParent(); } if (p2 == null) return; if (!isShowing()) { VnmrjIF vif = Util.getVjIF(); vif.raiseToolPanel(on); setVisible(true); } popupComp = comp; p = p2; pobj.setPopup(true, true); /* Point pt0 = p.getLocationOnScreen(); Point pt1 = getLocationOnScreen(); */ Point pt1 = getLocation(); Dimension dim = getSize(); int y0 = (int) ((float) dim.height * pobj.getRefY()); int h = (int) ((float) dim.height * pobj.getRefH()); int x = pt1.x + 2; int y = pt1.y + y0; p.add(comp, JLayeredPane.MODAL_LAYER); comp.setBounds(x, y, dim.width, dim.height - y0); ((JComponent) p).validate(); /* p.repaint(); */ }
public void mouseClicked(MouseEvent evt) { int btn = evt.getButton(); if (btn == MouseEvent.BUTTON3) { JPopupMenu helpMenu = new JPopupMenu(); String helpLabel = Util.getLabel("CSHMenu"); JMenuItem helpMenuItem = new JMenuItem(helpLabel); helpMenuItem.setActionCommand("help"); helpMenu.add(helpMenuItem); ActionListener alMenuItem = new ActionListener() { public void actionPerformed(ActionEvent e) { String topic = ""; try { JComponent c1 = (JComponent) tabbedPane.getSelectedComponent(); // This component should contain the following embedded items. // We want m_helplink out of the top VGroup. // PushpinObj // XMLToolPanel // JScrollpane // JViewport // JPanel // VGroup // Work down to the VGroup, checking for class type along // the way. if (c1 instanceof PushpinObj) { Component c2[] = c1.getComponents(); int cnt; for (cnt = 0; cnt < c2.length; cnt++) { // The PushpinObj can have multiple items, find the one we want if (c2[cnt] instanceof XMLToolPanel) break; } if (cnt < c2.length && c2[cnt] instanceof XMLToolPanel) { Component c3[] = ((JComponent) c2[cnt]).getComponents(); if (c3[0] instanceof JScrollPane) { Component c4[] = ((JComponent) c3[0]).getComponents(); if (c4[0] instanceof JViewport) { Component c5[] = ((JComponent) c4[0]).getComponents(); if (c5[0] instanceof JPanel) { Component c6[] = ((JComponent) c5[0]).getComponents(); if (c6[0] instanceof VGroup) { // Get the helplink info from the VGroup topic = ((VGroup) c6[0]).getAttribute(VObjDef.HELPLINK); } } } } } } // If no helplink found, try the Tab's name if (topic == null || topic.length() == 0) { topic = c1.getName(); if (topic.equals("Locator")) topic = getLocatorName(); topic = topic.replace(" ", "_"); } } catch (Exception ex) { } // Get the ID and display the help content CSH_Util.displayCSHelp(topic); } }; helpMenuItem.addActionListener(alMenuItem); Point pt = evt.getPoint(); helpMenu.show(VTabbedToolPanel.this, (int) pt.getX(), (int) pt.getY()); } }
public void startElement(String uri, String localName, String qName, Attributes attr) { // System.out.println("Start of Element '"+qName+"'"); // int numOfAttr = attr.getLength(); // System.out.println(" Number of Attributes is "+numOfAttr); // for (int i=0; i<numOfAttr; i++) { // System.out.println(" with attr["+i+"]='"+attr.getValue(i)+"'"); // } if (!qName.equals("tool")) return; boolean bScroll = true; PushpinIF pObj = null; lastName = attr.getValue("name"); String helplink = attr.getValue("helplink"); Constructor c = (Constructor) getTool(lastName); Object[] vargs; String toolFile; if (lastName.equals("XMLToolPanel")) { lastName = attr.getValue("label"); lastName = Util.getLabelString(lastName); String scroll = attr.getValue("scrollbar"); if (scroll != null) { if (scroll.equalsIgnoreCase("no")) bScroll = false; } vargs = new Object[3]; vargs[0] = sshare; vargs[1] = lastName; toolFile = attr.getValue("file"); vargs[2] = toolFile; String f = "LAYOUT" + File.separator + "toolPanels" + File.separator + toolFile; toolFile = FileUtil.openPath(f); if (toolFile == null) return; } else { vargs = new Object[1]; vargs[0] = sshare; } if (c != null) { try { lastComp = (JComponent) c.newInstance(vargs); if (lastComp instanceof VToolPanel) { toolList.add(lastComp); pObj = (PushpinIF) lastComp; } objList.add(lastComp); } catch (Exception e) { lastComp = new JLabel(lastName); } } else { lastComp = new JLabel(lastName); } String vps = attr.getValue("viewport"); if (lastComp != null && (lastComp instanceof XMLToolPanel)) ((XMLToolPanel) lastComp).setScrollAble(bScroll); if (pObj == null) { PushpinObj nObj = new PushpinObj(lastComp, pinPanel); pObj = nObj; pObj.setTitle(lastName); pObj.showPushPin(true); pObj.showTitle(true); pObj.setTabOnTop(true); } pObj.setName(lastName); addTabComp(pObj); pObj.setContainer(pinPanel); pObj.setSuperContainer(pinPanel); panes.put(lastName, pObj); // panes.put(lastName, lastComp); keys.add(lastName); vpInfo.add(vps); }