本文整理汇总了PHP中java函数的典型用法代码示例。如果您正苦于以下问题:PHP java函数的具体用法?PHP java怎么用?PHP java使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了java函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param $paragraph
* @param $mainStyleSheet
*/
function __construct($paragraph, $mainStyleSheet)
{
if (java_instanceof($paragraph, java('org.apache.poi.xwpf.usermodel.XWPFParagraph'))) {
$this->paragraph = $paragraph;
}
$this->mainStyleSheet = $mainStyleSheet;
}
示例2: autoFitTableToWindow
public static function autoFitTableToWindow($dataDir)
{
//ExStart
//ExFor:Table.AutoFit
//ExFor:AutoFitBehavior
//ExId:FitTableToPageWidth
//ExSummary:Autofits a table to fit the page width.
// Open the document
$doc = new java("com.aspose.words.Document", $dataDir . "TestFile.doc");
$nodeType = java("com.aspose.words.NodeType");
$table = $doc->getChild($nodeType->TABLE, 0, true);
// Autofit the first table to the page width.
$autoFitBehavior = new Java("com.aspose.words.AutoFitBehavior");
$table->autoFit($autoFitBehavior->AUTO_FIT_TO_WINDOW);
// Save the document to disk.
$doc->save($dataDir . "TestFile.AutoFitToWindow Out.doc");
//ExEnd
$preferredWidthType = new Java("com.aspose.words.PreferredWidthType");
if (java_values($doc->getFirstSection()->getBody()->getTables()->get(0)->getPreferredWidth()->getType()) == java_values($preferredWidthType->PERCENT)) {
echo "PreferredWidth type is not percent <br />";
}
if (java_values($doc->getFirstSection()->getBody()->getTables()->get(0)->getPreferredWidth()->getValue()) == 100) {
echo "PreferredWidth value is different than 100 <br />";
}
}
示例3: main
public static function main()
{
echo "<pre>";
self::printTime("initializing...");
self::clearDir(self::$NEO4J_DB, false);
self::$neo = new java("org.neo4j.kernel.EmbeddedGraphDatabase", self::$NEO4J_DB);
self::$neo->shutdown();
self::printTime("clean db created");
self::$inserter = new java("org.neo4j.kernel.impl.batchinsert.BatchInserterImpl", self::$NEO4J_DB);
self::createChildren(self::$inserter->getReferenceNode(), 10, 1);
self::$inserter->shutdown();
self::printTime("nodes created");
self::$neo = new java("org.neo4j.kernel.EmbeddedGraphDatabase", self::$NEO4J_DB);
for ($i = 0; $i < 10; $i++) {
echo "\ntraversing through all nodes and counting depthSum...";
$tx = self::$neo->beginTx();
$traverser = self::$neo->getReferenceNode()->traverse(java('org.neo4j.graphdb.Traverser$Order')->BREADTH_FIRST, java('org.neo4j.graphdb.StopEvaluator')->END_OF_GRAPH, java('org.neo4j.graphdb.ReturnableEvaluator')->ALL_BUT_START_NODE, java('org.neo4j.graphdb.DynamicRelationshipType')->withName('PARENT'), java('org.neo4j.graphdb.Direction')->OUTGOING);
$depthSum = 0;
$nodes = $traverser->iterator();
while (java_values($nodes->hasNext())) {
$node = $nodes->next();
$depthSum += intval(java_values($node->getProperty("level")));
}
$tx->finish();
$tx->success();
echo "\ndepthSum = {$depthSum}";
self::printTime("done traversing");
}
self::$neo->shutdown();
echo "\nneo has been shut down";
echo "</pre>";
}
示例4: __construct
/**
* @param $run
* @param $mainStyleSheet
*/
function __construct($run, $mainStyleSheet)
{
if (java_instanceof($run, java('org.apache.poi.xwpf.usermodel.XWPFRun'))) {
$this->run = $run;
}
$this->mainStyleSheet = $mainStyleSheet;
}
示例5: MBeanServer
public function MBeanServer($id = null)
{
if (isset($id)) {
$this->delegate = java("com.caucho.quercus.lib.resin.MBeanServer", $id);
} else {
$this->delegate = java("com.caucho.quercus.lib.resin.MBeanServer");
}
}
示例6: __construct
/**
* @param $picture
* @param $mainStyleSheet
* @param $path
*/
function __construct($picture, $mainStyleSheet, $path)
{
if (java_instanceof($picture, java('org.apache.poi.xwpf.usermodel.XWPFPicture'))) {
$this->picture = $picture;
}
$this->mainStyleSheet = $mainStyleSheet;
$this->_tmp_path = $path;
}
示例7: __construct
/**
* @param $element
*/
function __construct($element)
{
if (java_instanceof($element, java('org.apache.poi.xwpf.usermodel.XWPFSDT'))) {
$toc = java_cast($element, 'org.apache.poi.xwpf.usermodel.XWPFSDT');
$this->toc = $toc;
$this->idList = array();
$this->tableContents = array();
}
}
示例8: __construct
function __construct($style)
{
if (java_instanceof($style, java('org.apache.poi.xwpf.usermodel.XWPFStyle'))) {
$this->style = $style;
} else {
echo "This is not Style Class";
die;
}
}
示例9: __construct
function __construct($cell, $mainStyleSheet)
{
if (java_instanceof($cell, java('org.apache.poi.xwpf.usermodel.XWPFTableCell'))) {
$this->cell = $cell;
} else {
throw new Exception("[XWPFTableCell::new XWPFTableCell] Cell cannot be null");
}
$this->mainStyleSheet = $mainStyleSheet;
$this->xmlCell = $this->getXMLCellObject();
}
示例10: create_index_dir
/** create a temporary directory for the lucene index files. Make sure
* to create the tmpdir from Java so that the directory has
* javabridge_tmp_t Security Enhanced Linux permission. Note that PHP
* does not have access to tempfiles with java_bridge_tmp_t: PHP
* inherits the rights from the HTTPD, usually httpd_tmp_t.
*/
function create_index_dir()
{
global $tmp_file, $tmp_dir;
$javaTmpdir = java("java.lang.System")->getProperty("java.io.tmpdir");
$tmpdir = java_values($javaTmpdir);
$tmp_file = tempnam($tmpdir, "idx");
$tmp_dir = new java("java.io.File", "{$tmp_file}.d");
$tmp_dir->mkdir();
return java_values($tmp_dir->toString());
}
示例11: init
function init()
{
$SWT = new JavaClass("org.eclipse.swt.SWT");
$shell = $this->shell = new java("org.eclipse.swt.widgets.Shell");
$shell->setSize(320, 200);
$shell->setLayout(new java("org.eclipse.swt.layout.FillLayout"));
$button = new Java("org.eclipse.swt.widgets.Button", $this->shell, $SWT->PUSH);
$button->setText("Click here.");
$button->addSelectionListener(java_closure($this, null, java("org.eclipse.swt.events.SelectionListener")));
$this->shell->open();
}
示例12: java_PageContext
function java_PageContext($java_session)
{
if (java_is_null($java_session)) {
throw new Exception("session is null");
}
$ctx = java_context();
$this->servlet = $ctx->getAttribute("php.java.servlet.Servlet");
$this->response = $ctx->getAttribute("php.java.servlet.HttpServletResponse");
$this->request = $ctx->getAttribute("php.java.servlet.HttpServletRequest");
$factory = java("javax.servlet.jsp.JspFactory")->getDefaultFactory();
$this->pc = $factory->getPageContext($this->servlet, $this->request, $this->response, null, true, 8192, false);
$this->out = $this->pc->out;
}
示例13: run
function run()
{
$name = java_values(java_context()->getAttribute("name", 100));
// engine scope
$out = new Java("java.io.FileOutputStream", "{$name}.out", true);
$Thread = java("java.lang.Thread");
$nr = java_values(java_context()->getAttribute("nr", 100));
echo "started thread: {$nr}\n";
for ($i = 0; $i < 10; $i++) {
$out->write(ord("{$nr}"));
$Thread->yield();
}
$out->close();
}
示例14: createComponents
function createComponents()
{
$button = new java("javax.swing.JButton", "I'm a Swing button!");
// set the label before we close over $this
$this->label = new java("javax.swing.JLabel");
$button->addActionListener(java_closure($this, null, java("java.awt.event.ActionListener")));
$this->label->setLabelFor($button);
$pane = new java("javax.swing.JPanel", new java("java.awt.GridLayout", 0, 1));
$pane->add($button);
$pane->add($this->label);
$BorderFactory = new JavaClass("javax.swing.BorderFactory");
$pane->setBorder($BorderFactory->createEmptyBorder(30, 30, 10, 30));
return $pane;
}
示例15: renderReport
public function renderReport($reportName, $options = [], $outputType = self::OUTPUT_TYPE_HTML)
{
$reportPath = ArrayHelper::getValue($options, 'reportPath', $this->reportPath);
if ($reportPath === null) {
throw new InvalidConfigException('The "reportPath" property must be set.');
}
$reportPath = Yii::getAlias($reportPath);
$context = java_context()->getServletContext();
$birtReportEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($context);
java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook());
$report = $birtReportEngine->openReportDesign("{$reportPath}/{$reportName}");
// $parameterArray = $report->getDesignHandle()->getParameters();
// $ds = $report->getDesignHandle()->findDataSource("Data Source");
// $ds->setProperty('odaURL', 'jdbc:postgresql://localhost:5432/mdmbiz3');
$task = $birtReportEngine->createRunAndRenderTask($report);
if (!empty($options['params'])) {
foreach ($options['params'] as $key => $value) {
$nval = new Java("java.lang.String", $value);
$task->setParameterValue($key, $nval);
}
}
if ($outputType == self::OUTPUT_TYPE_PDF) {
$outputOptions = ['pdfRenderOption.pageOverflow' => 'pdfRenderOption.fitToPage'];
} else {
$outputOptions = [];
}
if (!empty($options['options'])) {
$outputOptions = array_merge($outputOptions, $options['options']);
}
$optionClass = isset($this->optionClasses[$outputType]) ? $this->optionClasses[$outputType] : $this->optionClasses['default'];
$taskOptions = new Java($optionClass);
$outputStream = new Java("java.io.ByteArrayOutputStream");
$taskOptions->setOutputStream($outputStream);
foreach ($outputOptions as $key => $value) {
$taskOptions->setOption($key, $value);
}
$taskOptions->setOutputFormat($outputType);
if ($outputType == self::OUTPUT_TYPE_HTML) {
$ih = new Java("org.eclipse.birt.report.engine.api.HTMLServerImageHandler");
$taskOptions->setImageHandler($ih);
$taskOptions->setEnableAgentStyleEngine(true);
$taskOptions->setBaseImageURL($this->imagePath);
$taskOptions->setImageDirectory($this->imagePath);
}
$task->setRenderOption($taskOptions);
$task->run();
$task->close();
return java_values($outputStream->toByteArray());
}