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


Java Dispatch类代码示例

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


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

示例1: word2PDF

import com.jacob.com.Dispatch; //导入依赖的package包/类
private void word2PDF(String inputFile, String pdfFile) {
  // 打开word应用程序
  ActiveXComponent app = new ActiveXComponent("Word.Application");
  // 设置word不可见
  app.setProperty("Visible", false);
  // 获得word中所有打开的文档,返回Documents对象
  Dispatch docs = app.getProperty("Documents").toDispatch();
  // 调用Documents对象中Open方法打开文档,并返回打开的文档对象Document
  Dispatch doc = Dispatch.call(docs, "Open", inputFile, false, true).toDispatch();
  // 调用Document对象的ExportAsFixedFormat方法,将文档保存为pdf格式
  Dispatch.call(doc, "ExportAsFixedFormat", pdfFile, WORD_VALUE);// word保存为pdf格式宏,值为17
  // 关闭文档
  Dispatch.call(doc, "Close", false);
  // 关闭word应用程序
  app.invoke("Quit", 0);
}
 
开发者ID:hivsuper,项目名称:document-converter,代码行数:17,代码来源:JacobPDFConverter.java

示例2: findTestSet

import com.jacob.com.Dispatch; //导入依赖的package包/类
public TestSet findTestSet(String testSetName, int searchTestSetID) throws ALMServiceException {
	Dispatch listOfTestSet = Dispatch
			.call(this.testSetFolder, "FindTestSets", new Object[] { testSetName, Boolean.valueOf(true), null })
			.toDispatch();

	Dispatch testSet = null;
	try {
		int count = Dispatch.call(listOfTestSet, "Count").getInt();

		for (int i = 1; i <= count; i++) {
			testSet = Dispatch.call(listOfTestSet, "Item", new Object[] { Integer.valueOf(i) }).toDispatch();
			int testSetID = Dispatch.call(testSet, "ID").getInt();
			if (searchTestSetID == testSetID) {
				return new TestSet(this.almObject, testSet);
			}
		}
		throw new ALMServiceException("The Given Test Set Name \"" + testSetName + "\" Not Found");
	} catch (NullPointerException e) {
		throw new ALMServiceException("The Given Test Set Name \"" + testSetName + "\" Not Found ");
	}
}
 
开发者ID:saikiran40cs,项目名称:KiranALMSel,代码行数:22,代码来源:TestSetFolder.java

示例3: disconnect

import com.jacob.com.Dispatch; //导入依赖的package包/类
public void disconnect() {
    loggedIn = false;
    if (bugFactory != null) {
        bugFactory.safeRelease();
        bugFactory = null;
    }
    if (requirementsFactory != null) {
        requirementsFactory.safeRelease();
        requirementsFactory = null;
    }
    if (command != null) {
        command.safeRelease();
        command = null;
    }
    Dispatch.call(this, "DisconnectProject");
    Dispatch.call(this, "ReleaseConnection");
}
 
开发者ID:jonico,项目名称:core,代码行数:18,代码来源:Connection.java

示例4: getFieldAsString

import com.jacob.com.Dispatch; //导入依赖的package包/类
public String getFieldAsString(String field) {
    Variant res = Dispatch.call(this, "Field", field);
    if (res.isNull()) {
        return null;
    } else if (res.getvt() == Variant.VariantInt) {
        int val = res.getInt();
        return Integer.toString(val);
    } else if (res.getvt() == Variant.VariantDate) {
        logger.warn("Field " + field
                + " should have contained a string but contained a date: "
                + res.getDate());
        return null;
    } else {
        return res.getString();
    }
}
 
开发者ID:jonico,项目名称:core,代码行数:17,代码来源:Requirement.java

示例5: getAttachmentsNames

import com.jacob.com.Dispatch; //导入依赖的package包/类
public List<String> getAttachmentsNames() {
    IFactoryList attachments = new BugFactory(
            getPropertyAsComponent("Attachments")).getFilter().getNewList();
    List<String> att = new ArrayList<String>();
    for (int n = 1; n <= attachments.getCount(); ++n) {
        Dispatch item = attachments.getItem(n);
        String fileName = Dispatch.get(item, "FileName").toString();

        String shortName = fileName;
        int slash = shortName.lastIndexOf(File.separatorChar);
        if (slash >= 0) {
            shortName = shortName.substring(slash + 1);
        }

        att.add(shortName);
    }

    return att;
}
 
开发者ID:jonico,项目名称:core,代码行数:20,代码来源:Bug.java

示例6: getNodeByPath

import com.jacob.com.Dispatch; //导入依赖的package包/类
public TestSetFolder getNodeByPath(String testSetFolderPath) throws ALMServiceException
{
  Dispatch testSetFolder;
  try {
    testSetFolder = Dispatch.call(this.testSetTreeManager, "NodeByPath", new Object[] { ROOT+"\\" + testSetFolderPath }).toDispatch();
  }
  catch (ComFailException e)
  {
    throw new ALMServiceException("The Given Test Set Folder Path \"" + testSetFolderPath + "\" Not Found");
  }
  
  return new TestSetFolder(this.almObject, testSetFolder);
}
 
开发者ID:saikiran40cs,项目名称:KiranALMSel,代码行数:14,代码来源:TestSetTreeManager.java

示例7: initConnectionEx

import com.jacob.com.Dispatch; //导入依赖的package包/类
public boolean initConnectionEx(String url)
  throws ALMServiceException
{
  try
  {
    Dispatch.call(getAlmObject(), "InitConnectionEx", new Object[] { url });
    return true;
  } catch (ComFailException e) {
    throw new ALMServiceException("Unable to Establish connection for the Given URL: " + url);
  }
}
 
开发者ID:saikiran40cs,项目名称:KiranALMSel,代码行数:12,代码来源:TDConnection.java

示例8: login

import com.jacob.com.Dispatch; //导入依赖的package包/类
public boolean login(String username, String password)
  throws ALMServiceException
{
  try
  {
    Dispatch.call(getAlmObject(), "login", new Object[] { username, password });
    return true;
  } catch (ComFailException e) {
    throw new ALMServiceException("Invalid Username or Password");
  }
}
 
开发者ID:saikiran40cs,项目名称:KiranALMSel,代码行数:12,代码来源:TDConnection.java

示例9: connect

import com.jacob.com.Dispatch; //导入依赖的package包/类
public boolean connect(String domain, String project)
  throws ALMServiceException
{
  try
  {
    Dispatch.call(getAlmObject(), "connect", new Object[] { domain, project });
    return true;
  } catch (ComFailException e) {
    throw new ALMServiceException("Invalid Project or Domain");
  }
}
 
开发者ID:saikiran40cs,项目名称:KiranALMSel,代码行数:12,代码来源:TDConnection.java

示例10: isConnected

import com.jacob.com.Dispatch; //导入依赖的package包/类
public boolean isConnected()
{
  boolean isLoggedIn = false;
  try {
    isLoggedIn = Dispatch.call(getAlmObject(), "Connected").getBoolean();
  }
  catch (IllegalStateException e) {
    return isLoggedIn;
  }
  return isLoggedIn;
}
 
开发者ID:saikiran40cs,项目名称:KiranALMSel,代码行数:12,代码来源:TDConnection.java

示例11: getNewList

import com.jacob.com.Dispatch; //导入依赖的package包/类
public ListWrapper<TSTest> getNewList() {
	Dispatch listOfTests = Dispatch.call(this.tsTestFactory, "NewList", new Object[] { "" }).toDispatch();

	int count = Dispatch.call(listOfTests, "Count").getInt();
	ListWrapper<TSTest> listWrapper = new ListWrapper<TSTest>();
	for (int i = 1; i <= count; i++) {
		Dispatch dispatchTSTest = Dispatch.call(listOfTests, "Item", new Object[] { Integer.valueOf(i) }).toDispatch();
		TSTest tsTest = new TSTest(dispatchTSTest);
		listWrapper.add(tsTest);
	}
	return listWrapper;
}
 
开发者ID:saikiran40cs,项目名称:KiranALMSel,代码行数:13,代码来源:TSTestFactory.java

示例12: populateVersions

import com.jacob.com.Dispatch; //导入依赖的package包/类
private void populateVersions() {
    Variant majorRef = new Variant("defaultMajor", true);
    Variant minorRef = new Variant("defaultMinor", true);
    try {
        Dispatch.callSub(this, "GetTDVersion", majorRef, minorRef);
        majorVersion = majorRef.getStringRef();
        minorVersion = minorRef.getStringRef();
    } finally {
        majorRef.safeRelease();
        minorRef.safeRelease();
    }
}
 
开发者ID:jonico,项目名称:core,代码行数:13,代码来源:Connection.java

示例13: getFieldAsDate

import com.jacob.com.Dispatch; //导入依赖的package包/类
public Date getFieldAsDate(String field, String timeZone) {
    Variant res = Dispatch.call(this, "Field", field);
    double ddate = 0.0;
    if (res.isNull()) {
        return null;
    } else {
        ddate = res.getDate();
    }
    Date d = DateUtilities.convertWindowsTimeToDate(ddate);
    d = DateUtil.convertDateToTimeZone(d, timeZone);
    return d;
}
 
开发者ID:jonico,项目名称:core,代码行数:13,代码来源:Requirement.java

示例14: lockObject

import com.jacob.com.Dispatch; //导入依赖的package包/类
public void lockObject() throws DefectAlreadyLockedException {
    if (isLocked()) {
        throw new DefectAlreadyLockedException(
                "Requirement locked by another user");
    } else {
        Dispatch.call(this, "LockObject");
        return;
    }
}
 
开发者ID:jonico,项目名称:core,代码行数:10,代码来源:Requirement.java

示例15: setListValuedField

import com.jacob.com.Dispatch; //导入依赖的package包/类
@Override
public void setListValuedField(String fieldName, String fieldValue) {
    ActiveXComponent list = createList();
    for (String val : QCRequirement.getFieldValues(fieldValue)) {
        Dispatch.call(list, "Add", val);
        //Dispatch.put(list, "Add", new Integer(1));
    }
    Dispatch.invoke(this, "Field", Dispatch.Put, new Object[] { fieldName,
            list }, new int[2]);
}
 
开发者ID:jonico,项目名称:core,代码行数:11,代码来源:Requirement.java


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