Exemplo n.º 1
0
  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("");
            }
          }
        };
  }
Exemplo n.º 2
0
  public JPanel makeFileTable() {
    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);

    return right;
  }
Exemplo n.º 3
0
  /** Constructor */
  public WPart11Dialog() {
    super(null);
    setVisible(false);

    m_pnlDisplay = new JPanel();
    m_pcsTypesMgr = new PropertyChangeSupport(this);
    JScrollPane spDisplay = new JScrollPane(m_pnlDisplay);
    m_pnlDisplay.setLayout(new WGridLayout(0, 2));
    addComp(spDisplay);
    initBlink();

    buttonPane.removeAll();
    // Add the buttons to the panel with space between buttons.
    m_btnChecksum = new JButton("Make new checksum");
    buttonPane.add(m_btnChecksum);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(validateButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(closeButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(abandonButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(helpButton);
    setHelpEnabled(false);

    closeButton.setActionCommand("close");
    closeButton.addActionListener(this);
    validateButton.setActionCommand("validate");
    validateButton.addActionListener(this);
    abandonButton.setActionCommand("cancel");
    abandonButton.addActionListener(this);
    helpButton.setActionCommand("help");
    helpButton.addActionListener(this);
    m_btnChecksum.setActionCommand("checksum");
    m_btnChecksum.addActionListener(this);

    setCloseEnabled(true);
    setAbandonEnabled(true);

    setTitle("Configuration");
    setLocation(300, 500);
    setResizable(true);
    setSize(450, 300);
  }
Exemplo n.º 4
0
  /**
   * Builds the components from the file and displays it.
   *
   * @param strFile the file to be read.
   */
  public void build(int nType, String strFile, String strhelpfile) {
    m_nType = nType;
    m_strPath = (strFile != null) ? FileUtil.openPath(strFile) : "";
    m_strHelpFile = strhelpfile;
    boolean bValidate = false;
    boolean bChecksum = false;

    if (nType == CONFIG) {
      setTitle("Configuration");
      buildConfig();
    } else {
      JComponent compDisplay = null;
      if (nType == DEFAULT) {
        m_pnlAccPolicy = new AccPolicyPanel(m_strPath);
        compDisplay = m_pnlAccPolicy;
        setTitle("Password Configuration");
      } else if (nType == CHECKSUM) {
        m_pnlChecksum = new ChecksumPanel(m_strPath);
        compDisplay = m_pnlChecksum;
        setTitle("Checksum Configuration");
        bValidate = true;
        bChecksum = true;
      } else {
        setTitle("Perform System Validation");
        compDisplay = new JTextArea();
        ((JTextArea) compDisplay).setEditable(false);
        bValidate = true;
        doBlink();
      }
      m_pnlDisplay.removeAll();
      m_pnlDisplay.setLayout(new BorderLayout());
      m_pnlDisplay.add(compDisplay, BorderLayout.CENTER);
      setVisible(true);
    }
    validateButton.setVisible(bValidate);
    // abandonButton.setVisible(!bValidate);
    setAbandonEnabled(bValidate);
    m_btnChecksum.setVisible(bChecksum);
  }
Exemplo n.º 5
0
  public void buildConfig() {
    BufferedReader in = WFileUtil.openReadFile(m_strPath);
    String strLine = null;

    if (in == null) {
      Messages.postError("Error opening file " + m_strPath);
      return;
    }

    try {
      m_pnlDisplay.removeAll();
      m_pnlDisplay.setLayout(new WGridLayout(0, 2));
      m_aListComp.clear();
      while ((strLine = in.readLine()) != null) {
        if (strLine.startsWith("#") || strLine.startsWith("%") || strLine.startsWith("@")) continue;
        StringTokenizer sTokLine = new StringTokenizer(strLine, File.pathSeparator);
        createJComps(sTokLine);
      }
      setVisible(true);
    } catch (Exception e) {
      // e.printStackTrace();
      Messages.writeStackTrace(e);
    }
  }
Exemplo n.º 6
0
  private void initUi() {
    String history;
    String undo;
    String close;
    String abandon;
    String help;
    String string;
    char helpMnemonic;
    char historyMnemonic;
    char undoMnemonic;
    char closeMnemonic;
    char abandonMnemonic;

    DisplayOptions.addChangeListener(this);

    // setAlwaysOnTop(true);

    // Get text for buttons from properties/resource file
    history = Util.getLabel("blHistory", "Edit...");
    undo = Util.getLabel("blUndo", "Undo");
    close = Util.getLabel("blClose", "Close");
    abandon = Util.getLabel("blAbandon", "Abandon");
    help = Util.getLabel("blHelp", "Help");

    // buttons
    undoButton = new JButton(undo);
    closeButton = new JButton(close);
    abandonButton = new JButton(abandon);
    helpButton = new JButton(help);

    // Create an ArrayList of menu items from properties file

    ArrayList<String> historyList = new ArrayList<String>();
    historyList.add(Util.getLabel("mlHistReturnInitState", "Return to initial state"));
    historyList.add(Util.getLabel("mlHistMakeSnapshot", "Make a snapshot"));
    historyList.add(Util.getLabel("mlHistReturnToSnapshot", "Return to snapshot"));
    historyList.add(Util.getLabel("mlHistReturnToDefault", "Return to system defaults"));

    // Pop Button for history menu
    historyButton = new MPopButton(historyList);
    historyButton.setText(history);

    // Only set mnemonics if found.

    if (Util.labelExists("blmHelp")) {
      string = Util.getLabel("blmHelp");
      helpMnemonic = string.charAt(0);
      helpButton.setMnemonic(helpMnemonic);
    }

    if (Util.labelExists("blmUndo")) {
      string = Util.getLabel("blmUndo");
      undoMnemonic = string.charAt(0);
      undoButton.setMnemonic(undoMnemonic);
    }

    if (Util.labelExists("blmAbandon")) {
      string = Util.getLabel("blmAbandon");
      abandonMnemonic = string.charAt(0);
      abandonButton.setMnemonic(abandonMnemonic);
    }

    if (Util.labelExists("blmClose")) {
      string = Util.getLabel("blmClose");
      closeMnemonic = string.charAt(0);
      closeButton.setMnemonic(closeMnemonic);
    }

    if (Util.labelExists("blmHistory")) {
      string = Util.getLabel("blmHistory");
      historyMnemonic = string.charAt(0);
      historyButton.setMnemonic(historyMnemonic);
    }

    helpButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            // Display Help if help file exists
            CSH_Util.displayCSHelp(dialogTitle);
          }
        });

    // Make a panel to hold the buttons
    buttonPane = new JPanel();

    // Put an empty border around the inside of the panel.
    buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 5));
    buttonPane.setLayout(new SimpleH2Layout(SimpleH2Layout.CENTER));

    // Add the buttons to the panel with space between buttons.
    buttonPane.add(historyButton);
    // buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(undoButton);
    // buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(closeButton);
    // buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(abandonButton);
    // buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(helpButton);

    // Put everything together, using the content pane's BorderLayout.
    Container contentPane = getContentPane();
    contentPane.add(buttonPane, BorderLayout.SOUTH);

    setHistoryEnabled(false);
    // setCloseEnabled(false);
    setAbandonEnabled(false);
    setUndoEnabled(false);

    if (!CSH_Util.haveTopic(dialogTitle)) setHelpEnabled(false);

    // buttonPane.setVisible(false);
    // Add key listener to the whole dialog
    addKeyListener(this);
    // Make the frame fit its contents.
    // pack(); // nothing to pack.
  }