コード例 #1
0
ファイル: ButtonList.java プロジェクト: personal-wu/core
 private void refreshImages() {
   if (showButtons) {
     refreshCounterText();
   }
   if (refreshOverNull) {
     for (int i = 0; i < m_aButtons.length; i++) {
       setVisible(m_aButtons[i], false);
     }
   }
   for (int i = 0; i < m_aButtons.length; i++) {
     Object oObj = getObjectFor(i);
     if (oObj == null) continue;
     Object[] oResources = renderer.getImageUrls(oObj);
     if (oResources == null) continue;
     if (oResources.length == 1) {
       Helper.setUnoPropertyValue(
           m_aButtons[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, oResources[0]);
     } else if (oResources.length == 2) {
       oUnoDialog
           .getPeerConfiguration()
           .setImageUrl(m_aButtons[i].getModel(), oResources[0], oResources[1]);
     }
     boolean bTabStop = Boolean.TRUE; // focusable ? Boolean.TRUE : Boolean.FALSE;
     Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "Tabstop", bTabStop);
     if (refreshOverNull) {
       setVisible(m_aButtons[i], true);
     }
   }
 }
コード例 #2
0
ファイル: ButtonList.java プロジェクト: personal-wu/core
  public void create(UnoDialog2 dialog) {
    oUnoDialog = dialog;

    int imageTextHeight = imageTextLines * LINE_HEIGHT;

    int nXPos = pos.Width + 1;
    int nYPos = pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height;
    int nWidth = cols * (m_aButtonSize.Width + gap.Width) + gap.Width - 2;

    lblImageText =
        dialog.insertLabel(
            m_aControlName + "_imageText",
            new String[] {
              PropertyNames.PROPERTY_HEIGHT,
              PropertyNames.PROPERTY_HELPURL,
              PropertyNames.PROPERTY_LABEL,
              PropertyNames.PROPERTY_POSITION_X,
              PropertyNames.PROPERTY_POSITION_Y,
              PropertyNames.PROPERTY_STEP,
              PropertyNames.PROPERTY_TABINDEX,
              "Tabstop",
              PropertyNames.PROPERTY_WIDTH
            },
            new Object[] {
              Integer.valueOf(imageTextHeight),
              PropertyNames.EMPTY_STRING,
              "(1)",
              Integer.valueOf(nXPos),
              Integer.valueOf(nYPos),
              step,
              Short.valueOf((short) 0),
              Boolean.FALSE,
              Integer.valueOf(nWidth)
            });

    if (showButtons) {
      final String[] pNames1 =
          new String[] {
            PropertyNames.PROPERTY_HEIGHT,
            PropertyNames.PROPERTY_HELPURL,
            PropertyNames.PROPERTY_POSITION_X,
            PropertyNames.PROPERTY_POSITION_Y,
            PropertyNames.PROPERTY_STEP,
            PropertyNames.PROPERTY_TABINDEX,
            "Tabstop",
            PropertyNames.PROPERTY_WIDTH
          };

      final Integer btnSize = Integer.valueOf(14);

      // TODO: if list of strings not the same length of list object, office will die.
      btnBack =
          dialog.insertButton(
              m_aControlName + "_btnBack",
              new XActionListenerAdapter() {
                @Override
                public void actionPerformed(ActionEvent event) {
                  prevPage();
                }
              },
              pNames1,
              new Object[] {
                btnSize,
                HelpIds.getHelpIdString(helpURL++),
                Integer.valueOf(pos.Width),
                Integer.valueOf(
                    pos.Height
                        + (m_aButtonSize.Height + gap.Height) * rows
                        + gap.Height
                        + imageTextHeight
                        + 1),
                step,
                Short.valueOf((short) (tabIndex + 1)),
                Boolean.TRUE,
                btnSize
              });

      btnNext =
          dialog.insertButton(
              m_aControlName + "_btnNext",
              new XActionListenerAdapter() {
                @Override
                public void actionPerformed(ActionEvent event) {
                  nextPage();
                }
              },
              pNames1,
              new Object[] {
                btnSize,
                HelpIds.getHelpIdString(helpURL++),
                Integer.valueOf(
                    pos.Width
                        + (m_aButtonSize.Width + gap.Width) * cols
                        + gap.Width
                        - btnSize.intValue()
                        + 1),
                Integer.valueOf(
                    pos.Height
                        + (m_aButtonSize.Height + gap.Height) * rows
                        + gap.Height
                        + imageTextHeight
                        + 1),
                step,
                Short.valueOf((short) (tabIndex + 2)),
                Boolean.TRUE,
                btnSize
              });

      lblCounter =
          dialog.insertLabel(
              m_aControlName + "_lblCounter",
              pNames1,
              new Object[] {
                Integer.valueOf(LINE_HEIGHT),
                PropertyNames.EMPTY_STRING,
                Integer.valueOf(pos.Width + btnSize.intValue() + 1),
                Integer.valueOf(
                    pos.Height
                        + (m_aButtonSize.Height + gap.Height) * rows
                        + gap.Height
                        + imageTextHeight
                        + ((btnSize.intValue() - LINE_HEIGHT) / 2)),
                step,
                Short.valueOf((short) 0),
                Boolean.FALSE,
                Integer.valueOf(
                    cols * (m_aButtonSize.Width + gap.Width)
                        + gap.Width
                        - 2 * btnSize.intValue()
                        - 1)
              });

      Helper.setUnoPropertyValue(
          getModel(lblCounter), PropertyNames.PROPERTY_ALIGN, Short.valueOf((short) 1));
      Helper.setUnoPropertyValue(getModel(btnBack), PropertyNames.PROPERTY_LABEL, "<");
      Helper.setUnoPropertyValue(getModel(btnNext), PropertyNames.PROPERTY_LABEL, ">");
    }

    m_tabIndex = Short.valueOf((short) tabIndex);

    m_aButtons = new XControl[rows * cols];

    m_aButtonHeight = Integer.valueOf(m_aButtonSize.Height);
    m_aButtonWidth = Integer.valueOf(m_aButtonSize.Width);

    for (int r = 0; r < rows; r++) {
      for (int c = 0; c < cols; c++) {
        XButton aButton = createButton(dialog, r, c);
        XControl aControl = UnoRuntime.queryInterface(XControl.class, aButton);
        m_aButtons[r * cols + c] = aControl;
      }
    }
    refreshImages();
  }
コード例 #3
0
ファイル: ButtonList.java プロジェクト: personal-wu/core
 private void enable(Object control, Boolean enable) {
   Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_ENABLED, enable);
 }
コード例 #4
0
ファイル: ButtonList.java プロジェクト: personal-wu/core
 /** set the text under the button list */
 private void refreshImageText() {
   Object item =
       m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null;
   final String sText = PropertyNames.SPACE + renderer.render(item);
   Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, sText);
 }
コード例 #5
0
ファイル: ButtonList.java プロジェクト: personal-wu/core
 private void refreshCounterText() {
   Helper.setUnoPropertyValue(
       getModel(lblCounter),
       PropertyNames.PROPERTY_LABEL,
       counterRenderer.render(new Counter(pageStart + 1, pageEnd(), listModel.getSize())));
 }