예제 #1
1
    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);
    }
예제 #2
0
  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;
  }
예제 #3
0
 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");
 }
예제 #4
0
  protected void setBgColor(Color bgColor) {
    setBackgroundColor(bgColor);

    panelForBtns.setBackground(Util.getBgColor());
    addButton.setBackground(Util.getBgColor());
    removeButton.setBackground(Util.getBgColor());
  }
예제 #5
0
  private void openNmrFile() {
    if (fileName.equals("text")) {
      try {
        Runtime.getRuntime().exec("notepad " + fullPath);
      } catch (Exception e) {
      }
    } else if (fileName.equals("fid")) {
      directory = UtilB.windowsPathToUnix(directory);
      if (directory.charAt(directory.length() - 1) == '/') {
        directory = directory.substring(0, directory.length() - 1);
      }
      Util.sendToVnmr("rt (\'" + directory + "\')");
      Util.sendToVnmr("write(\'line3\',\'fid retrieved\')");
    } else if (fileName.equals("procpar")) {
      directory = UtilB.windowsPathToUnix(directory);
      if (directory.charAt(directory.length() - 1) == '/') {
        directory = directory.substring(0, directory.length() - 1);
      }
      Util.sendToVnmr("rtp (\'" + directory + "\')");
      Util.sendToVnmr("write(\'line3\',\'parameters retrieved\')");
    } else {
      Util.sendToVnmr("write(\'error\',\'unknown file -- open ignored\')");
    }

    return;
  }
예제 #6
0
 /**
  * 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;
 }
예제 #7
0
  /**
   * 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()
예제 #8
0
    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)));
    }
예제 #9
0
    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)));
    }
예제 #10
0
  /** 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()
예제 #11
0
    /** 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;
    }
예제 #12
0
 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;
 }
예제 #13
0
  public VText(SessionShare sshare, ButtonIF vif, String typ) {
    this.vnmrIf = vif;
    setOpaque(false);
    setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    twin = new VTextWin(this, sshare, vif, typ);
    setViewportView(twin);
    JViewport vp = getViewport();
    vp.setBackground(Util.getBgColor());

    orgBg = getBackground();

    ml =
        new MouseAdapter() {
          public void mouseClicked(MouseEvent evt) {
            int clicks = evt.getClickCount();
            int modifier = evt.getModifiers();
            if ((modifier & (1 << 4)) != 0) {
              if (clicks >= 2) {
                ParamEditUtil.setEditObj((VObjIF) evt.getSource());
              }
            }
          }
        };
    new DropTarget(this, this);
    DisplayOptions.addChangeListener(this);
  }
예제 #14
0
 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;
 }
예제 #15
0
 public void updateStatsAuto() {
   // Have chempack update the automation run display
   Util.sendToVnmr(m_updateCmd);
   // Run this in the Event Thread because it updates the GUI
   //        SwingUtilities.invokeLater(new Runnable() {
   //            public void run() { updateStatsAutoUI(); } }
   //        );
 }
예제 #16
0
    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)));
    }
예제 #17
0
 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);
 }
예제 #18
0
 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));
     }
   }
 }
예제 #19
0
  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();
              }
            });
  }
예제 #20
0
  public static String getSbin() {
    String strSbin = "/usr/varian/sbin/";
    if (Util.iswindows()) {
      strSbin = "/vnmr/bin/";
    } else {
      UNFile file = new UNFile(strSbin);
      if (!file.exists()) strSbin = FileUtil.sysdir() + "/bin/";
    }

    return strSbin;
  }
예제 #21
0
  /**
   * ************************************************
   *
   * <pre>
   * Summary: Constructor, Add buttons to dialog box
   *
   * </pre>
   *
   * *************************************************
   */
  public TagAddRemoveDialog() {
    super(Util.getLabel("_Locator_Add_Remove"));

    // Make a panel for the buttons
    panelForBtns = new JPanel();
    // It looks better with a border
    panelForBtns.setBorder(BorderFactory.createEmptyBorder(20, 35, 20, 35));

    // Create the two items.
    addButton = new JButton("Add to Group");
    removeButton = new JButton("Remove From Group");

    // Add items to panel
    panelForBtns.add(addButton);
    panelForBtns.add(removeButton);

    // Add the panel top of the dialog.
    getContentPane().add(panelForBtns, BorderLayout.NORTH);

    // Set the buttons and the text item up with Listeners
    cancelButton.setActionCommand("cancel");
    cancelButton.addActionListener(this);
    helpButton.setActionCommand("help");
    helpButton.addActionListener(this);
    addButton.setActionCommand("add");
    addButton.addActionListener(this);
    addButton.setMnemonic('a');
    removeButton.setActionCommand("remove");
    removeButton.addActionListener(this);
    removeButton.setMnemonic('r');

    // OK disabled.
    okButton.setEnabled(false);

    setBgColor(Util.getBgColor());
    DisplayOptions.addChangeListener(this);

    // Make the frame fit its contents.
    pack();
  }
예제 #22
0
  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);
  }
예제 #23
0
 private void setBorder(boolean isEnabled) {
   JTextField txfTmp = new JTextField();
   if (isEnabled) setBorder(txfTmp.getBorder());
   else {
     String strStyle = getAttribute(DISABLE);
     if (strStyle != null && strStyle.equals(m_arrStrDisAbl[1])) {
       setBorder(null);
       setBackground(Util.getBgColor());
     } else {
       setBorder(txfTmp.getBorder());
       setBackground(Global.NPCOLOR);
     }
   }
 }
예제 #24
0
  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
예제 #25
0
  public static String getSudo() {
    // Default to /usr/bin
    String strSudo = "/usr/bin/sudo ";

    if (Util.iswindows()) strSudo = "";

    UNFile file = new UNFile("/usr/bin/sudo");
    if (!file.exists()) {
      // If no /usr/bin/sudo, then try /usr/local/bin
      file = new UNFile("/usr/local/bin/sudo");
      if (file.exists()) strSudo = "/usr/local/bin/sudo ";
    }
    // Messages.postDebug("SUDO path=" + strSudo);
    return strSudo;
  }
예제 #26
0
  // 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);
  }
예제 #27
0
  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);
    }
  }
예제 #28
0
    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);
    }
예제 #29
0
 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;
 }
예제 #30
0
  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);
      }
    }
  }