当前位置: 首页>>代码示例>>Java>>正文


Java XControlModel类代码示例

本文整理汇总了Java中com.sun.star.awt.XControlModel的典型用法代码示例。如果您正苦于以下问题:Java XControlModel类的具体用法?Java XControlModel怎么用?Java XControlModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XControlModel类属于com.sun.star.awt包,在下文中一共展示了XControlModel类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPosition

import com.sun.star.awt.XControlModel; //导入依赖的package包/类
public static void setPosition(XDialog dialog, int posX, int posY) {
	XControlModel xDialogModel = UnoRuntime.queryInterface(XControl.class, dialog).getModel();
	XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel);
	try {
		xPropSet.setPropertyValue("PositionX", posX);
		xPropSet.setPropertyValue("PositionY", posY);
	} catch (com.sun.star.lang.IllegalArgumentException | UnknownPropertyException | PropertyVetoException
			| WrappedTargetException e) {
		return;
	}
}
 
开发者ID:smehrbrodt,项目名称:libreoffice-starter-extension,代码行数:12,代码来源:DialogHelper.java

示例2: getPosition

import com.sun.star.awt.XControlModel; //导入依赖的package包/类
public static Point getPosition(XDialog dialog) {
	int posX = 0;
	int posY = 0;
	XControlModel xDialogModel = UnoRuntime.queryInterface(XControl.class, dialog).getModel();
	XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel);
	try {
		posX = (int) xPropSet.getPropertyValue("PositionX");
		posY = (int) xPropSet.getPropertyValue("PositionY");
	} catch (UnknownPropertyException | WrappedTargetException e) {
	}
	return new Point(posX, posY);
}
 
开发者ID:smehrbrodt,项目名称:libreoffice-starter-extension,代码行数:13,代码来源:DialogHelper.java

示例3: hasFormComponents

import com.sun.star.awt.XControlModel; //导入依赖的package包/类
/**
 * Returns if the component contains other form components.
 * 
 * @return if the component contains other form components
 * 
 * @throws NOAException if the check fails
 * 
 * @author Markus Krüger
 * @date 25.01.2007
 */
public boolean hasFormComponents() throws NOAException {
  try {
    XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,xDrawPage);
    if(xShapes != null) {
      int shapeCount = xShapes.getCount();
      for(int i=0;i<shapeCount;i++) {
        XShape xShape = (XShape)UnoRuntime.queryInterface(XShape.class,xShapes.getByIndex(i));
        if(xShape != null) {
          XControlShape controlShape = (XControlShape)UnoRuntime.queryInterface(XControlShape.class,xShape);
          if(controlShape != null) {
            XControlModel control = controlShape.getControl();
            if(control != null) {
              XFormComponent xFormComponent = (XFormComponent)UnoRuntime.queryInterface(XFormComponent.class,control);
              if(xFormComponent != null) {
                return true;
              }
            }            
          }
        }
      } 
    }
  }
  catch(Throwable throwable) {
    throw new NOAException(throwable);
  }
  return false;
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:38,代码来源:FormService.java

示例4: getFormComponents

import com.sun.star.awt.XControlModel; //导入依赖的package包/类
/**
 * Returns all form components contained in this component.
 * 
 * @return all form components contained in this component
 * 
 * @throws NOAException if the return fails
 * 
 * @author Markus Krüger
 * @date 25.01.2007
 */
public IFormComponent[] getFormComponents() throws NOAException {
  try {
    XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,xDrawPage);
    if(xShapes != null) {
      int shapeCount = xShapes.getCount();
      List formComponents = new ArrayList();
      for(int i=0;i<shapeCount;i++) {
        XShape xShape = (XShape)UnoRuntime.queryInterface(XShape.class,xShapes.getByIndex(i));
        if(xShape != null) {
          XControlShape controlShape = (XControlShape)UnoRuntime.queryInterface(XControlShape.class,xShape);
          if(controlShape != null) {
            XControlModel controlModel = controlShape.getControl();
            if(controlModel != null) {
              XFormComponent xFormComponent = (XFormComponent)UnoRuntime.queryInterface(XFormComponent.class,controlModel);
              if(xFormComponent != null) {
                formComponents.add(new FormComponent(document,controlShape,xFormComponent));
              }
            }            
          }
        }
      } 
      return (IFormComponent[]) formComponents.toArray(new IFormComponent[formComponents.size()]);
    }
    return new IFormComponent[0];
  }
  catch(Throwable throwable) {
    throw new NOAException(throwable);
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:40,代码来源:FormService.java

示例5: getFormComponentsNames

import com.sun.star.awt.XControlModel; //导入依赖的package包/类
/**
 * Returns all form components names contained in this component.
 * 
 * @return all form components names contained in this component
 * 
 * @throws NOAException if the return fails
 * 
 * @author Markus Krüger
 * @date 25.01.2007
 */
public String[] getFormComponentsNames() throws NOAException {
  try {
    XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,xDrawPage);
    if(xShapes != null) {
      int shapeCount = xShapes.getCount();
      List formComponentNames = new ArrayList();
      for(int i=0;i<shapeCount;i++) {
        XShape xShape = (XShape)UnoRuntime.queryInterface(XShape.class,xShapes.getByIndex(i));
        if(xShape != null) {
          XControlShape controlShape = (XControlShape)UnoRuntime.queryInterface(XControlShape.class,xShape);
          if(controlShape != null) {
            XControlModel control = controlShape.getControl();
            if(control != null) {
              XFormComponent xFormComponent = (XFormComponent)UnoRuntime.queryInterface(XFormComponent.class,control);
              if(xFormComponent != null) {
                XPropertySet propertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFormComponent);
                if(propertySet != null && propertySet.getPropertySetInfo().hasPropertyByName("Name"))
                  formComponentNames.add(propertySet.getPropertyValue("Name"));
              }
            }            
          }
        }
      } 
      return (String[]) formComponentNames.toArray(new String[formComponentNames.size()]);
    }
    return new String[0];
  }
  catch(Throwable throwable) {
    throw new NOAException(throwable);
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:42,代码来源:FormService.java

示例6: createCombobox

import com.sun.star.awt.XControlModel; //导入依赖的package包/类
public static XControl createCombobox(XMultiComponentFactory xMCF,
      XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer, String text, Rectangle size)
  {
    XControl ctrl =
        createControl(xMCF, context, toolkit, windowPeer,
          "com.sun.star.awt.UnoControlComboBox", null, null, size);
    XTextComponent tf = UnoRuntime.queryInterface(XTextComponent.class, ctrl);
    tf.setText(text);
    XComboBox cmb = UnoRuntime.queryInterface(XComboBox.class, ctrl);
    cmb.setDropDownLineCount((short) 10);
    
    try
    {
      XControlModel model = ctrl.getModel();
//        UnoRuntime.queryInterface(XControlModel.class,
//          xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlComboBoxModel", context));
      
      XPropertySet props =
          UnoRuntime.queryInterface(XPropertySet.class, model);

      props.setPropertyValue("Dropdown", Boolean.TRUE);
      //props.setPropertyValue("ReadOnly", Boolean.TRUE);
      props.setPropertyValue("Autocomplete", Boolean.FALSE);
      props.setPropertyValue("HideInactiveSelection", Boolean.TRUE);
      
      ctrl.setModel(model);
      ctrl.getPeer().invalidate(InvalidateStyle.UPDATE);
    }
    catch (Exception e)
    {
      Logger.error(e);
    }
    
    return ctrl;
  }
 
开发者ID:WollMux,项目名称:WollMux,代码行数:36,代码来源:GuiFactory.java

示例7: createControl

import com.sun.star.awt.XControlModel; //导入依赖的package包/类
/**
 * Eine allgemeine Hilfsfunktion, mit der UNO-Steuerelemente erzeugt werden.
 *  
 * @param xMCF
 * @param xContext
 * @param toolkit
 * @param windowPeer
 * @param type Klasse des Steuerelements, das erzeugt werden soll.
 * @param propNames
 * @param propValues
 * @param rectangle
 * @return
 */
public static XControl createControl(XMultiComponentFactory xMCF,
    XComponentContext xContext, XToolkit toolkit, XWindowPeer windowPeer,
    String type, String[] propNames, Object[] propValues, Rectangle rectangle)
{
  try
  {
    XControl control =
      UnoRuntime.queryInterface(XControl.class,
        xMCF.createInstanceWithContext(type, xContext));
    XControlModel controlModel =
      UnoRuntime.queryInterface(XControlModel.class,
        xMCF.createInstanceWithContext(type + "Model", xContext));
    control.setModel(controlModel);
    XMultiPropertySet properties =
      UnoRuntime.queryInterface(XMultiPropertySet.class, control.getModel());
    SortedMap<String, Object> props = new TreeMap<String, Object>();
    if (type.equals("com.sun.star.awt.UnoControlImageControl"))
    {
      props.put("Border", (short) 0);
    }
    else if (type.equals("com.sun.star.awt.UnoControlEdit"))
    {
      props.put("MultiLine", false);
      props.put("ReadOnly", false);
      props.put("VScroll", false);
    }
    if (propNames != null)
    {
      for (int i = 0; i < propNames.length; i++)
      {
        props.put(propNames[i], propValues[i]);
      }
    }
    if (props.size() > 0)
    {
      properties.setPropertyValues(
        props.keySet().toArray(new String[props.size()]),
        props.values().toArray(new Object[props.size()]));
    }
    control.createPeer(toolkit, windowPeer);
    XWindow controlWindow = UnoRuntime.queryInterface(XWindow.class, control);
    setWindowPosSize(controlWindow, rectangle);
    return control;
  }
  catch (com.sun.star.uno.Exception ex)
  {
    Logger.debug(ex);
    return null;
  }
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:64,代码来源:GuiFactory.java

示例8: createSenderbox

import com.sun.star.awt.XControlModel; //导入依赖的package包/类
/**
 * Erzeugt die Senderbox für die WollMux-Sidebar.
 * 
 * @param xMCF
 * @param context
 * @param toolkit
 * @param windowPeer
 * @param label
 * @param listener
 * @param size
 * @return
 * @throws com.sun.star.uno.Exception
 */
public static XControl createSenderbox(XMultiComponentFactory xMCF,
    XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer,
    String label, XActionListener listener, Rectangle size)
    throws com.sun.star.uno.Exception
{
  XControl buttonCtrl =
    createButton(xMCF, context, toolkit, windowPeer, label, listener, size);
  XControlModel model = buttonCtrl.getModel();
  XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, model);
  props.setPropertyValue("FocusOnClick", false);
  return buttonCtrl;
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:26,代码来源:GuiFactory.java


注:本文中的com.sun.star.awt.XControlModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。