예제 #1
0
 private JTextField createColorField(boolean hex) {
   final NumberDocument doc = new NumberDocument(hex);
   int lafFix = UIUtil.isUnderWindowsLookAndFeel() || UIUtil.isUnderDarcula() ? 1 : 0;
   UIManager.LookAndFeelInfo info = LafManager.getInstance().getCurrentLookAndFeel();
   if (info != null
       && (info.getName().startsWith("IDEA") || info.getName().equals("Windows Classic")))
     lafFix = 1;
   final JTextField field;
   if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
     field = new JTextField("");
     field.setDocument(doc);
     field.setPreferredSize(new Dimension(hex ? 60 : 40, 26));
   } else {
     field = new JTextField(doc, "", (hex ? 5 : 2) + lafFix);
     field.setSize(50, -1);
   }
   doc.setSource(field);
   field.getDocument().addDocumentListener(this);
   field.addFocusListener(
       new FocusAdapter() {
         @Override
         public void focusGained(final FocusEvent e) {
           field.selectAll();
         }
       });
   return field;
 }
 public TextFields() {
   t1.setDocument(ucd);
   ucd.addDocumentListener(new T1());
   b1.addActionListener(new B1());
   b2.addActionListener(new B2());
   t1.addActionListener(new T1A());
   setLayout(new FlowLayout());
   add(b1);
   add(b2);
   add(t1);
   add(t2);
   add(t3);
 }
  public PerceptronMain() {

    setPreferredSize(new java.awt.Dimension(250, 200));
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation(screenSize.width / 2, screenSize.height / 2);
    // Establecemos el tipo de layout
    setLayout(new BorderLayout());

    // Etiqueta de informacion
    labelInfo = new JLabel("Elija una de las dos opciones a ejecutar");
    erreTrabajo.setDocument(new controlarLontigud(2, true));

    // Crea el panel de botones
    buttonPanel = createButtonPanel();

    /* Creamos un layout propio para los controles anteriores */
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    // Establecemos la rejilla
    textControlsPane.setLayout(gridbag);

    // Por comodidad, creamos una funcion que aniada los controles a la rejilla
    // y al panel que la contiene...
    c.gridwidth = GridBagConstraints.REMAINDER; // last
    c.anchor = GridBagConstraints.EAST;
    c.weightx = 10.0;

    // Agregamos la etiqueta labelInfo al panel.
    textControlsPane.add(labelInfo, c);

    JLabel[] labels = {erreTrabajoLbl};
    JTextField[] textFields = {erreTrabajo};
    // Colocamos en el panel las etiquetas y los textfields.
    addLabelTextRows(labels, textFields, gridbag, textControlsPane);

    // Agregamos al panel los botones.
    textControlsPane.add(buttonPanel, c);

    // Situados los demas elementos, colocamos la etiqueta informativa

    textControlsPane.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("RNAG - Perceptrón | Adaline"),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // A�adimos el panel en la zona "LINE_START" al principio...
    add(textControlsPane, BorderLayout.LINE_START);
  } // fin_MiLogin()
    public MyValidatableComponent() {
      myNameLabel.setLabelFor(myNameText);
      myNameText.setDocument(myNameDocument);

      getEditor()
          .addSettingsEditorListener(
              new SettingsEditorListener() {
                public void stateChanged(SettingsEditor settingsEditor) {
                  updateWarning();
                }
              });

      myWarningLabel.setIcon(IconLoader.getIcon("/runConfigurations/configurationWarning.png"));

      myComponentPlace.setLayout(new GridBagLayout());
      myComponentPlace.add(
          getEditorComponent(),
          new GridBagConstraints(
              0,
              0,
              1,
              1,
              1.0,
              1.0,
              GridBagConstraints.NORTHWEST,
              GridBagConstraints.BOTH,
              new Insets(0, 0, 0, 0),
              0,
              0));
      myComponentPlace.doLayout();
      myFixButton.setIcon(IconLoader.getIcon("/actions/quickfixBulb.png"));
      updateWarning();
      myFixButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(final ActionEvent e) {
              if (myQuickFix == null) {
                return;
              }
              myQuickFix.run();
              myValidationResultValid = false;
              updateWarning();
            }
          });
    }
  public ConfigurationPanel(final Project project) {

    serverUrl.setName("serverUrl");
    buildDelay.setName("buildDelay");
    jobRefreshPeriod.setName("jobRefreshPeriod");
    rssRefreshPeriod.setName("rssRefreshPeriod");
    username.setName("_username_");

    passwordField.setName("passwordFile");
    crumbDataField.setName("crumbDataFile");

    testConnexionButton.setName("testConnexionButton");
    connectionStatusLabel.setName("connectionStatusLabel");

    successOrStableCheckBox.setName("successOrStableCheckBox");
    unstableOrFailCheckBox.setName("unstableOrFailCheckBox");
    abortedCheckBox.setName("abortedCheckBox");

    rssStatusFilterPanel.setBorder(IdeBorderFactory.createTitledBorder("Event Log Settings", true));

    debugPanel.setVisible(false);

    initDebugTextPane();

    buildDelay.setDocument(new NumberDocument());
    jobRefreshPeriod.setDocument(new NumberDocument());
    rssRefreshPeriod.setDocument(new NumberDocument());

    uploadPatchSettingsPanel.setBorder(
        IdeBorderFactory.createTitledBorder("Upload a Patch Settings", true));

    passwordField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void insertUpdate(DocumentEvent e) {
                myPasswordModified = true;
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                myPasswordModified = true;
              }

              @Override
              public void changedUpdate(DocumentEvent e) {
                myPasswordModified = true;
              }
            });

    testConnexionButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            try {
              debugPanel.setVisible(false);

              new NotNullValidator().validate(serverUrl);
              new UrlValidator().validate(serverUrl);

              JenkinsSettings jenkinsSettings = JenkinsSettings.getSafeInstance(project);

              String password =
                  isPasswordModified() ? getPassword() : jenkinsSettings.getPassword();

              RequestManager.getInstance(project)
                  .authenticate(
                      serverUrl.getText(), username.getText(), password, crumbDataField.getText());
              setConnectionFeedbackLabel(CONNECTION_TEST_SUCCESSFUL_COLOR, "Successful");
              setPassword(password);
            } catch (Exception ex) {
              setConnectionFeedbackLabel(CONNECTION_TEST_FAILED_COLOR, "[Fail] " + ex.getMessage());
              if (ex instanceof AuthenticationException) {
                AuthenticationException authenticationException = (AuthenticationException) ex;
                String responseBody = authenticationException.getResponseBody();
                if (StringUtils.isNotBlank(responseBody)) {
                  debugPanel.setVisible(true);
                  debugTextPane.setText(responseBody);
                }
              }
            }
          }
        });

    formValidator =
        FormValidator.init(this)
            .addValidator(
                username,
                new UIValidator<JTextField>() {
                  public void validate(JTextField component) throws ConfigurationException {
                    if (StringUtils.isNotBlank(component.getText())) {
                      String password = getPassword();
                      if (StringUtils.isBlank(password)) {
                        throw new ConfigurationException(
                            String.format("'%s' must be set", passwordField.getName()));
                      }
                    }
                  }
                });
  }
예제 #6
0
  /** the JbInit method */
  public void jbInit() throws Exception {
    // Layout definition for this panel
    dataPanel.setLayout(panelLayout);
    dataPanel.setMinimumSize(new Dimension(100, 100));
    this.setLayout(borderLayout);
    this.setSize(new Dimension(862, 514));
    this.setPreferredSize(new Dimension(479, 306));
    this.setMinimumSize(new Dimension(479, 306));
    this.setMaximumSize(new Dimension(479, 306));
    mIdtraslo.setDocument((Document) panelBinding.bindUIControl("Idtraslo", mIdtraslo));
    mIdtraslo.setEditable(false);
    mDescrip.setFocusable(false);
    mDescrip.setEditable(false);
    mEstadotraslotxt.setFocusable(false);
    mEstadopasillotxt.setFocusable(false);
    mEstadoprocesotraslotxt.setFocusable(false);
    mDescripvisualEntrada.setFocusable(false);
    mDescripvisualSalida.setFocusable(false);
    mPasilloactual.setFocusable(false);
    mPasillodestino.setFocusable(true);
    mPosplc.setFocusable(false);
    jCheckBoxTrasbordoEntrada.setText("Trasbord Entradas");
    jCheckBoxTrasbordoEntrada.setToolTipText(
        "Realitzar trasbord per ubicar containers en entrada de passadis");
    dataPanel.add(
        labelIdtraslo,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mIdtraslo,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelIdtraslo.setLabelFor(mIdtraslo);
    mIdtraslo.setColumns(5);
    labelIdtraslo.setText(panelBinding.findCtrlValueBinding("Idtraslo").getLabel());
    mIdtraslo.setToolTipText(panelBinding.findCtrlValueBinding("Idtraslo").getTooltip());
    mDescrip.setDocument((Document) panelBinding.bindUIControl("Descrip", mDescrip));
    dataPanel.add(
        labelDescrip,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescrip,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescrip.setLabelFor(mDescrip);
    mDescrip.setColumns(15);
    labelDescrip.setText(panelBinding.findCtrlValueBinding("Descrip").getLabel());
    mDescrip.setToolTipText(panelBinding.findCtrlValueBinding("Descrip").getTooltip());
    mEstadotraslotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadotraslotxt", mEstadotraslotxt));
    dataPanel.add(
        labelEstadotraslotxt,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadotraslotxt,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadotraslotxt.setLabelFor(mEstadotraslotxt);
    mEstadotraslotxt.setColumns(20);
    labelEstadotraslotxt.setText(panelBinding.findCtrlValueBinding("Estadotraslotxt").getLabel());
    mEstadotraslotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadotraslotxt").getTooltip());
    mEstadopasillotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadopasillotxt", mEstadopasillotxt));
    dataPanel.add(
        labelEstadopasillotxt,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadopasillotxt,
        new GridBagConstraints(
            1,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadopasillotxt.setLabelFor(mEstadopasillotxt);
    mEstadopasillotxt.setColumns(20);
    labelEstadopasillotxt.setText(panelBinding.findCtrlValueBinding("Estadopasillotxt").getLabel());
    mEstadopasillotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadopasillotxt").getTooltip());
    mEstadoprocesotraslotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadoprocesotraslotxt", mEstadoprocesotraslotxt));
    dataPanel.add(
        labelEstadoprocesotraslotxt,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadoprocesotraslotxt,
        new GridBagConstraints(
            1,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadoprocesotraslotxt.setLabelFor(mEstadoprocesotraslotxt);
    mEstadoprocesotraslotxt.setColumns(20);
    labelEstadoprocesotraslotxt.setText(
        panelBinding.findCtrlValueBinding("Estadoprocesotraslotxt").getLabel());
    mEstadoprocesotraslotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadoprocesotraslotxt").getTooltip());
    mDescripvisualEntrada.setDocument(
        (Document) panelBinding.bindUIControl("DescripvisualEntrada", mDescripvisualEntrada));
    dataPanel.add(
        labelDescripvisualEntrada,
        new GridBagConstraints(
            0,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescripvisualEntrada,
        new GridBagConstraints(
            1,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescripvisualEntrada.setLabelFor(mDescripvisualEntrada);
    mDescripvisualEntrada.setColumns(20);
    labelDescripvisualEntrada.setText(
        panelBinding.findCtrlValueBinding("DescripvisualEntrada").getLabel());
    mDescripvisualEntrada.setToolTipText(
        panelBinding.findCtrlValueBinding("DescripvisualEntrada").getTooltip());
    mDescripvisualSalida.setDocument(
        (Document) panelBinding.bindUIControl("DescripvisualSalida", mDescripvisualSalida));
    dataPanel.add(
        labelDescripvisualSalida,
        new GridBagConstraints(
            0,
            6,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescripvisualSalida,
        new GridBagConstraints(
            1,
            6,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescripvisualSalida.setLabelFor(mDescripvisualSalida);
    mDescripvisualSalida.setColumns(20);
    labelDescripvisualSalida.setText(
        panelBinding.findCtrlValueBinding("DescripvisualSalida").getLabel());
    mDescripvisualSalida.setToolTipText(
        panelBinding.findCtrlValueBinding("DescripvisualSalida").getTooltip());
    mPasilloactual.setDocument(
        (Document) panelBinding.bindUIControl("Pasilloactual", mPasilloactual));
    dataPanel.add(
        labelPasilloactual,
        new GridBagConstraints(
            0,
            7,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPasilloactual,
        new GridBagConstraints(
            1,
            7,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelPasilloactual.setLabelFor(mPasilloactual);
    mPasilloactual.setColumns(3);
    labelPasilloactual.setText(panelBinding.findCtrlValueBinding("Pasilloactual").getLabel());
    mPasilloactual.setToolTipText(panelBinding.findCtrlValueBinding("Pasilloactual").getTooltip());
    mPasillodestino.setDocument(
        (Document) panelBinding.bindUIControl("Pasillodestino", mPasillodestino));
    dataPanel.add(
        labelPasillodestino,
        new GridBagConstraints(
            0,
            8,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPasillodestino,
        new GridBagConstraints(
            1,
            8,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelPasillodestino.setLabelFor(mPasillodestino);
    mPasillodestino.setColumns(3);
    labelPasillodestino.setText(panelBinding.findCtrlValueBinding("Pasillodestino").getLabel());
    mPasillodestino.setToolTipText(
        panelBinding.findCtrlValueBinding("Pasillodestino").getTooltip());
    mPosplc.setDocument((Document) panelBinding.bindUIControl("Posplc", mPosplc));
    dataPanel.add(
        labelPosplc,
        new GridBagConstraints(
            0,
            9,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPosplc,
        new GridBagConstraints(
            1,
            9,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    // dataPanel.add(buttonArrancar, new GridBagConstraints(0, 10, 3, 2, 0.0, 0.0,
    // GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 22, 63), -98, -13));
    dataPanel.add(
        buttonArrancar,
        new GridBagConstraints(
            0,
            10,
            3,
            2,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 5, 5),
            0,
            0));
    // dataPanel.add(jCheckBoxTrasbordoEntrada, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0,
    // GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    labelPosplc.setLabelFor(mPosplc);
    mPosplc.setColumns(5);
    labelPosplc.setText(panelBinding.findCtrlValueBinding("Posplc").getLabel());

    // Layout the datapanel and the navigation bar
    mPosplc.setToolTipText(panelBinding.findCtrlValueBinding("Posplc").getTooltip());
    add(dataPanel, BorderLayout.CENTER);

    navBar.setModel(
        JUNavigationBar.createViewBinding(
            panelBinding, navBar, "SgavtrasloEntSalView1", null, "SgavtrasloEntSal1Iter"));
    statusBar.setModel(JUStatusBar.createPanelBinding(panelBinding, statusBar));
    add(navBar, BorderLayout.NORTH);
    add(statusBar, BorderLayout.SOUTH);

    // Quitar botones de add / remove
    navBar.remove(navBar.getButton(JUNavigationBar.BUTTON_DELETE));
    navBar.remove(navBar.getButton(JUNavigationBar.BUTTON_INSERT));
    jCheckBoxTrasbordoEntrada.setModel(
        (ButtonModel) panelBinding.bindUIControl("Trasbordoentrada", jCheckBoxTrasbordoEntrada));
    if (getIdTraslo() == 0) jCheckBoxTrasbordoEntrada.setEnabled(false);
  }