Exemplo n.º 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);
    }
Exemplo n.º 2
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);
    }
Exemplo n.º 3
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)));
    }
Exemplo n.º 4
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)));
    }
Exemplo n.º 5
0
    public void propertyChange(PropertyChangeEvent e) {
      String strPropName = e.getPropertyName();
      if (strPropName.equals(WGlobal.USER_CHANGE)) {
        String strName = (String) e.getNewValue();
        String strAccount = null;
        VDetailArea objDetailArea = m_adminIF.getDetailArea1();
        if (objDetailArea != null) strAccount = objDetailArea.getItemValue("itype");
        if (strAccount == null) strAccount = "";
        strAccount = strAccount.trim();

        String strDir = getPathDir() + strName;
        if (this instanceof DisplayTemplate) {
          if (strAccount.equals(Global.IMGIF)) strDir = strDir + ".img";
          else if (strAccount.equals(Global.WALKUPIF)) strDir = strDir + ".walkup";
        }
        String strPath = FileUtil.openPath(strDir);
        boolean bDefaultFile = false;
        if (strPath == null) {
          strPath = FileUtil.openPath(getDefaultFile(strAccount));
          bDefaultFile = true;
        }
        clear(this);
        layoutUIComponents(strPath, bDefaultFile);
      } else if (strPropName.indexOf(WGlobal.IMGDIR) >= 0) {
        String strName = (String) e.getNewValue();
        StringTokenizer strTokenizer = new StringTokenizer(strPropName);
        String strInterface = null;
        boolean bDefaultFile = false;
        if (strTokenizer.hasMoreTokens()) strTokenizer.nextToken();
        if (strTokenizer.hasMoreTokens()) strInterface = strTokenizer.nextToken();
        if (strInterface == null) strInterface = "";
        strInterface = strInterface.trim();

        String strDir = getPathDir() + strName;
        if (this instanceof DisplayTemplate) {
          if (strInterface.equals(WGlobal.IMGDIR)) strDir = strDir + ".img";
          else if (strInterface.equals(WGlobal.WALKUPDIR)) strDir = strDir + ".walkup";
        }
        String strPath = FileUtil.openPath(strDir);
        if (strPath == null) {
          String strAccount = Global.WALKUPIF;
          if (strInterface.equals(WGlobal.IMGDIR)) strAccount = Global.IMGIF;
          else if (strInterface.equals(WGlobal.WALKUPDIR)) strAccount = Global.WALKUPIF;
          strPath = FileUtil.openPath(getDefaultFile(strAccount));
          bDefaultFile = true;
        }
        clear(this);
        layoutUIComponents(strPath, bDefaultFile);
      } else if (strPropName.indexOf(WGlobal.SAVEUSER_NOERROR) >= 0) {
        Object objValue = e.getNewValue();
        String strName = "";
        if (objValue instanceof String) strName = (String) objValue;
        else if (objValue instanceof WItem) strName = ((WItem) objValue).getText();

        VDetailArea objDetail = m_adminIF.getDetailArea1();
        String strAccount = null;
        if (objDetail != null) strAccount = objDetail.getItemValue("itype");
        if (strAccount == null) strAccount = "";
        strAccount = strAccount.trim();

        String strDir = getPathDir() + strName;
        if (this instanceof DisplayTemplate) {
          if (strAccount.equals(Global.IMGIF)) strDir = strDir + ".img";
          else if (strAccount.equals(Global.WALKUPIF)) strDir = strDir + ".walkup";
        }
        TextFieldValues objTxf = getTxfValues();
        writeFile(strName, strDir, objTxf.getTxfLabel(), objTxf.getTxfValue());
      } else if (strPropName.indexOf(WGlobal.DELETE_USER) >= 0) {
        clear(this);
        String strPath = FileUtil.openPath(getDefaultFile(""));
        layoutUIComponents(strPath, true);
      }
    }