示例#1
0
 public void setValue(String value) {
   if (useWholeNumbers) {
     model.setValue(Integer.valueOf(value));
   } else {
     model.setValue(Double.valueOf(value));
   }
 }
示例#2
0
 @Override
 public void stateChanged(ChangeEvent e) {
   // a quick way of setting end of day, just set hours to 24
   if (hourModel.getNumber().longValue() == 24) {
     hourModel.setValue(23);
     minuteModel.setValue(59);
     secondModel.setValue(59);
   }
 }
示例#3
0
  /**
   * Sets the time based upon the number of miliseconds given
   *
   * @param msPastMidnight
   */
  public TimeChooser(long msPastMidnight) {
    this();
    // Turn to seconds
    msPastMidnight = msPastMidnight / 1000;

    // set hours
    hourModel.setValue((int) (msPastMidnight / 3600));
    minuteModel.setValue((int) (msPastMidnight % 3600 / 60));
    secondModel.setValue((int) (msPastMidnight % 60));
  }
示例#4
0
  private void updateSpinnerState() {
    int value = slider.getValue();

    if (useWholeNumbers) {
      model.setValue(new Integer(value));
    } else {
      double doubleValue = value * stepSize;
      model.setValue(new Double(doubleValue));
    }

    if (changeListener != null) {
      changeListener.stateChanged(new ChangeEvent(this));
    }
  }
 private void actualizarCantidadPisos() {
   if (mdlTorre.getSelectedItem() != null) {
     Torre t = (Torre) mdlTorre.getSelectedItem();
     int max = t.getCantidadPisos();
     mdlPiso.setValue((Integer) 1);
     mdlPiso.setMaximum(max);
   }
 }
示例#6
0
  /** Update interface to reflect values of the current AstAxisLabel. */
  protected void updateFromAstAxisLabels() {
    //  Nothing in this method should change astAxisLabels, but
    //  we'll switch off the ChangeListener anyway.
    astAxisLabels.removeChangeListener(this);

    xShowLabel.setSelected(astAxisLabels.getXShown());
    if (!inhibitXDocumentListener) {
      xTextField.setText(astAxisLabels.getXLabel());
    }

    yShowLabel.setSelected(astAxisLabels.getYShown());
    if (!inhibitYDocumentListener) {
      yTextField.setText(astAxisLabels.getYLabel());
    }

    xTextField.setTextFont(astAxisLabels.getFont());
    yTextField.setTextFont(astAxisLabels.getFont());
    fontControls.setFont(astAxisLabels.getFont());
    xTextField.setTextColour(astAxisLabels.getColour());
    yTextField.setTextColour(astAxisLabels.getColour());
    colourIcon.setMainColour(astAxisLabels.getColour());
    colourButton.repaint();

    xSpinnerModel.setValue(new Double(astAxisLabels.getXGap()));
    ySpinnerModel.setValue(new Double(astAxisLabels.getYGap()));

    if (astAxisLabels.getXEdge() == AstAxisLabels.BOTTOM) {
      xEdge.setSelectedItem("BOTTOM");
    } else {
      xEdge.setSelectedItem("TOP");
    }
    if (astAxisLabels.getYEdge() == AstAxisLabels.LEFT) {
      yEdge.setSelectedItem("LEFT");
    } else {
      yEdge.setSelectedItem("RIGHT");
    }

    xUnits.setSelected(astAxisLabels.getShowXUnits());
    yUnits.setSelected(astAxisLabels.getShowYUnits());

    astAxisLabels.setXState(true);
    astAxisLabels.setYState(true);

    astAxisLabels.addChangeListener(this);
  }
  public void updateRegulatorsOptions() {

    Integer value = (Integer) numRegulators_.getModel().getValue();
    if ((Integer) numRegulators_.getModel().getValue()
        > (Integer) subnetSize_.getModel().getValue())
      value = (Integer) subnetSize_.getModel().getValue();

    SpinnerNumberModel model = (SpinnerNumberModel) numRegulators_.getModel();
    model.setMinimum(1);
    model.setMaximum((Integer) subnetSize_.getModel().getValue());
    model.setStepSize(1);
    model.setValue(value);
  }
示例#8
0
  public void update() {
    // find & set index of selected trigger
    Play instruction = (Play) inst;
    int handleVal = Integer.parseInt(instruction.handleVal());
    handleModel.setValue(Integer.valueOf(handleVal));

    // loop flag
    loop.setSelectedItem(instruction.brkVal());

    // wavbreak flags
    int flags = instruction.getWaveBrkFlags();
    wavbrk1.setSelected((flags & 0x01) != 0);
    wavbrk2.setSelected((flags & 0x02) != 0);
  }
  private void initComponents() {

    sparklinePanel = new JPanel();

    FormLayout layout = new FormLayout("d", "d");
    sparklinePanel.setLayout(layout);

    model = new SpinnerNumberModel();

    model.setValue(DateUtils.getCurrentYear());
    model.setStepSize(1);

    yearSpinner = new JSpinner(model);

    JSpinner.NumberEditor editor = new JSpinner.NumberEditor(yearSpinner, "####");
    yearSpinner.setEditor(editor);
    yearSpinner.setEnabled(false);
  }
  /** Update date spinner to synchronize with the other spinners */
  private void updateDate() {
    // Get current month and year in int
    int month = ((SpinnerListModel) jspMonth.getModel()).getList().indexOf(jspMonth.getValue());
    int year = ((Integer) spinnerYear.getValue()).intValue();

    // Set a new maximum number of days for the new month and year
    SpinnerNumberModel numberModel = (SpinnerNumberModel) jspDay.getModel();
    numberModel.setMaximum(new Integer(maxDaysInMonth(year, month)));

    // Set a new current day if it exceeds the maximum
    if (((Integer) (numberModel.getValue())).intValue() > maxDaysInMonth(year, month))
      numberModel.setValue(new Integer(maxDaysInMonth(year, month)));

    // Get the current day
    int day = ((Integer) jspDay.getValue()).intValue();

    // Set a new date in the date spinner
    jspDate.setValue(new GregorianCalendar(year, month, day).getTime());
  }
示例#11
0
  /**
   * Descripción de Método
   *
   * @param page
   */
  private void setPage(int page) {
    m_setting = true;
    m_pageNo = page;

    if (m_pageNo < 1) {
      m_pageNo = 1;
    }

    if (page > m_pageMax) {
      m_pageNo = m_pageMax;
    }

    bPrevious.setEnabled(m_pageNo != 1);
    bNext.setEnabled(m_pageNo != m_pageMax);

    //

    Rectangle pageRectangle = m_viewPanel.getRectangleOfPage(m_pageNo);

    pageRectangle.x -= View.MARGIN;
    pageRectangle.y -= View.MARGIN;
    centerScrollPane.getViewport().setViewPosition(pageRectangle.getLocation());

    // System.out.println("scrollTo " + pageRectangle);

    // Set Page

    spinnerModel.setValue(new Integer(m_pageNo));

    StringBuffer sb =
        new StringBuffer(Msg.getMsg(m_ctx, "Page"))
            .append(" ")
            .append(m_pageNo)
            .append(m_viewPanel.getPageInfo(m_pageNo))
            .append(" ")
            .append(Msg.getMsg(m_ctx, "of"))
            .append(" ")
            .append(m_pageMax)
            .append(m_viewPanel.getPageInfoMax());

    statusBar.setStatusDB(sb.toString());
    m_setting = false;
  } // setPage
示例#12
0
 public void setTime(DateTime d) {
   hourModel.setValue(d.getHour());
   minuteModel.setValue(d.getMinute());
   secondModel.setValue(d.getSecond());
 }
  /** Constructor */
  @SuppressWarnings("serial")
  public SubnetExtraction(Frame aFrame, GenericElement item) {

    super(aFrame);
    item_ = item;

    // Set model of "subnet size" spinner
    SpinnerNumberModel model = new SpinnerNumberModel();
    model.setMinimum(1);
    model.setStepSize(1);
    int maxSize =
        (item instanceof StructureElement)
            ? ((StructureElement) item).getNetwork().getSize()
            : ((DynamicalModelElement) item).getGeneNetwork().getSize();
    model.setMaximum(maxSize);
    int effectiveSize = (10 <= maxSize) ? 10 : maxSize;
    model.setValue(effectiveSize);
    subnetSize_.setModel(model);

    // Set model of "number of subnets" spinner
    model = new SpinnerNumberModel();
    model.setMinimum(1);
    model.setMaximum(20);
    model.setStepSize(1);
    model.setValue(10);
    numberSubnets_.setModel(model);

    // Set model of "random among top" spinner
    model = new SpinnerNumberModel();
    model.setMinimum(1);
    model.setMaximum(100);
    model.setStepSize(1);
    model.setValue(20);
    randomAmongTopSpinner_.setModel(model);

    // Set model of "From strongly connected components"
    model = new SpinnerNumberModel();
    model.setMinimum(1);
    model.setMaximum(maxSize);
    model.setStepSize(1);
    model.setValue(10);
    numStronglyConnected_.setModel(model);

    // Set model of "From strongly connected components"
    model = new SpinnerNumberModel();
    model.setMinimum(1);
    model.setMaximum((Integer) subnetSize_.getModel().getValue());
    model.setStepSize(1);
    model.setValue(10);
    numRegulators_.setModel(model);

    // add tooltips for all elements of the window
    addTooltips();

    String title1, title2;
    title1 = title2 = "";
    if (item_ instanceof StructureElement) {
      ImodNetwork network = ((StructureElement) item_).getNetwork();
      title1 = item_.getLabel();
      title2 = network.getSize() + " nodes, " + network.getNumEdges() + " edges";
    } else if (item_ instanceof DynamicalModelElement) {
      GeneNetwork geneNetwork = ((DynamicalModelElement) item_).getGeneNetwork();
      title1 = item_.getLabel();
      title2 = geneNetwork.getSize() + " genes, " + geneNetwork.getNumEdges() + " interactions";
    }
    setGeneralInformation(title1 + " (" + title2 + ")");

    /** ACTIONS */
    subnetRootNameDocument_ = subnetRootName_.getDocument();
    subnetRootNameDocument_.addDocumentListener(
        new DocumentListener() {
          public void changedUpdate(DocumentEvent arg0) {
            runButton_.setEnabled(!subnetRootName_.getText().equals(""));
          }

          public void insertUpdate(DocumentEvent arg0) {
            runButton_.setEnabled(!subnetRootName_.getText().equals(""));
          }

          public void removeUpdate(DocumentEvent arg0) {
            runButton_.setEnabled(!subnetRootName_.getText().equals(""));
          }
        });

    extractAllRegulators_.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            disableExtractionOptions();
          }
        });

    randomVertex_.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            updateSeedControls();
          }
        });

    selectionFromList_.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            updateSeedControls();
          }
        });

    greedy_.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            updateNeighborSelectionControls();
          }
        });

    randomAmongTop_.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            updateNeighborSelectionControls();
          }
        });

    stronglyConnected_.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            updateSeedControls();
          }
        });

    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            GnwSettings.getInstance().stopSubnetExtraction(true);
            escapeAction();
          }
        });

    runButton_.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            run();
          }
        });

    subnetSize_.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent arg0) {
            updateRegulatorsOptions();
          }
        });

    numRegulators_.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent arg0) {
            updateRegulatorsOptions();
          }
        });

    useNumRegulators_.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent arg0) {
            numRegulators_.setEnabled(useNumRegulators_.isSelected());
          }
        });

    //		useNumRegulators_.addChangeListener(new ChangeListener() {
    //			public void stateChanged(ChangeEvent arg0) {
    //				numRegulators_.setEnabled(useNumRegulators_.isSelected());
    //			}
    //		});

    subnetIdProposal();
    setListVerticesID();
    updateSeedControls();
    updateNeighborSelectionControls();

    useNumRegulators_.setSelected(false);
    numRegulators_.setEnabled(false);
  }
示例#14
0
 @Override
 public void setMissingComponent(Component c) {
   dayModel.setValue(((Day) c).getValue());
 }
示例#15
0
 public void refreshInterface() {
   assignValueToParameters();
   rounded.setSelected(roundedCorners);
   thickModel.setValue(new Integer(thickness));
 }