Progress Bar

From Apache OpenOffice Wiki
Jump to: navigation, search

The progress bar control displays a growing or shrinking bar to give the user feedback during a persisting task. The minimum and the maximum progress value of the control is set by the ProgressValueMin and the ProgressValueMax properties of the control model that supports the service . The progress value is controlled by the ProgressValue property. The fill color can be changed by setting the property FillColor. The control implements the interface which allows you to control the progress bar. The progress bar interface helps to update and repaint the progress bar while a concurrent task is running, but this interface interrupts the main thread of the office. Issue is assigned to find an appropriate solution for this problem.

  public XPropertySet insertProgressBar(int _nPosX, int _nPosY, int _nWidth, int _nProgressMax){
  XPropertySet xPBModelPSet = null;
      // create a unique name by means of an own implementation...
      String sName = createUniqueName(m_xDlgModelNameContainer, "ProgressBar");
      // create a controlmodel at the multiservicefactory of the dialog model... 
      Object oPBModel = m_xMSFDialogModel.createInstance("");
      XMultiPropertySet xPBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oPBModel);
      // Set the properties at the model - keep in mind to pass the property names in alphabetical order!
      new String[] {"Height", "Name", "PositionX", "PositionY", "Width"},
      new Object[] { new Integer(8), sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nWidth)});
      // The controlmodel is not really available until inserted to the Dialog container
      m_xDlgModelNameContainer.insertByName(sName, oPBModel);
      xPBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oPBModel);
      // The following properties may also be set with XMultiPropertySet but we
      // use the XPropertySet interface merely for reasons of demonstration
      xPBModelPSet.setPropertyValue("ProgressValueMin", new Integer(0));
      xPBModelPSet.setPropertyValue("ProgressValueMax", new Integer(_nProgressMax));
  }catch ( ex){
      /* perform individual exception handling here.
       * Possible exception types are:
      return xPBModelPSet;
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages