main
commit
4fd4bae3a3
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/hutool-all-5.8.33.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/ojdbc8.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="@192.168.3.125" uuid="e6327c42-5924-48f4-93fe-37aa6df592e0">
|
||||||
|
<driver-ref>oracle</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<auto-commit>false</auto-commit>
|
||||||
|
<jdbc-driver>oracle.jdbc.OracleDriver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:oracle:thin:@192.168.3.125:1521:TC12</jdbc-url>
|
||||||
|
<jdbc-additional-properties>
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||||
|
</jdbc-additional-properties>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" defaultCharsetForPropertiesFiles="GBK">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/com/connor/bhdz/pdm/drawingToCapp/SendDrawingToCappAction.java" charset="GBK" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GitToolBoxBlameSettings">
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ASMSmaliIdeaPluginConfiguration">
|
||||||
|
<asm skipDebug="true" skipFrames="true" skipCode="false" expandFrames="false" />
|
||||||
|
<groovy codeStyle="LEGACY" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/classes" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/com.connor.bhdz.stoCapp.iml" filepath="$PROJECT_DIR$/.idea/com.connor.bhdz.stoCapp.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.connor.bhdz.stoCapp</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
@ -0,0 +1,7 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,22 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: StoCapp
|
||||||
|
Bundle-SymbolicName: com.connor.bhdz.stoCapp;singleton:=true
|
||||||
|
Bundle-Version: 1.0.0
|
||||||
|
Bundle-Vendor: CONNOR
|
||||||
|
Require-Bundle: org.eclipse.ui,
|
||||||
|
com.teamcenter.rac.aifrcp;bundle-version="12000.1.0",
|
||||||
|
com.teamcenter.rac.common;bundle-version="12000.1.0",
|
||||||
|
com.teamcenter.rac.kernel;bundle-version="12000.1.0",
|
||||||
|
com.teamcenter.rac.tcapps;bundle-version="12000.1.0",
|
||||||
|
com.teamcenter.rac.util;bundle-version="12000.1.0",
|
||||||
|
org.eclipse.core.runtime;bundle-version="3.12.0",
|
||||||
|
TcSoaWorkflowRac;bundle-version="12000.1.0"
|
||||||
|
Automatic-Module-Name: com.connor.bhdz.stoCapp
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
|
Bundle-ClassPath: .,
|
||||||
|
lib/ojdbc8.jar,
|
||||||
|
lib/hutool-all-5.8.33.jar
|
||||||
|
Export-Package: cn.hutool.core.collection,
|
||||||
|
com.connor.bhdz.pdm.drawingToCapp,
|
||||||
|
com.connor.bhdz.pdm.partToCapp
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,8 @@
|
|||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = plugin.xml,\
|
||||||
|
META-INF/,\
|
||||||
|
.,\
|
||||||
|
icons/,\
|
||||||
|
lib/ojdbc8.jar,\
|
||||||
|
lib/hutool-all-5.8.33.jar
|
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 526 B |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?eclipse version="3.4"?>
|
||||||
|
<plugin>
|
||||||
|
|
||||||
|
<extension point="org.eclipse.ui.commands">
|
||||||
|
<command name="图纸手动下发至CAPP" id="sendDrawingToCapp"></command>
|
||||||
|
<command name="物料手动下发至CAPP" id="sendPartToCapp"></command>
|
||||||
|
|
||||||
|
</extension>
|
||||||
|
<extension point="org.eclipse.ui.handlers">
|
||||||
|
<handler class="com.connor.bhdz.pdm.drawingToCapp.SendDrawingToCappHandler" commandId="sendDrawingToCapp"></handler>
|
||||||
|
<handler class="com.connor.bhdz.pdm.partToCapp.SendPartToCappHandler" commandId="sendPartToCapp"></handler>
|
||||||
|
</extension>
|
||||||
|
<extension point="org.eclipse.ui.menus">
|
||||||
|
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
||||||
|
<menu id="com.connor.bhdz.derive.menus.sendToCappMenu" label="CAPP集成" mnemonic="M">
|
||||||
|
<command commandId="sendDrawingToCapp" id="sendDrawingToCapp" mnemonic="S"/>
|
||||||
|
<command commandId="sendPartToCapp" id="sendPartToCapp" mnemonic="S"/>
|
||||||
|
</menu>
|
||||||
|
</menuContribution>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
</plugin>
|
@ -0,0 +1,171 @@
|
|||||||
|
/**
|
||||||
|
* @file ProgressBar.java
|
||||||
|
*
|
||||||
|
* @brief Create progress bar
|
||||||
|
*
|
||||||
|
* @author Yanghui
|
||||||
|
*
|
||||||
|
* @history
|
||||||
|
* ================================================================
|
||||||
|
* Date Name Description of Change
|
||||||
|
* 25-July-2008 Yanghui this class is used to create
|
||||||
|
* progress bar.
|
||||||
|
*/
|
||||||
|
package com.connor.bhdz.pdm.drawingToCapp;
|
||||||
|
import java.awt.Container;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JProgressBar;
|
||||||
|
import javax.swing.Timer;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.util.PropertyLayout;
|
||||||
|
import com.teamcenter.rac.util.Registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class ProgressBar
|
||||||
|
* @brief Create progress bar
|
||||||
|
* @author Yanghui
|
||||||
|
*/
|
||||||
|
public class ProgressBar extends AbstractAIFDialog implements ActionListener {
|
||||||
|
/**
|
||||||
|
* @var ProgressBar.progressbar
|
||||||
|
* @brief JProgressBar
|
||||||
|
*/
|
||||||
|
private JProgressBar progressbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ProgressBar.label
|
||||||
|
* @brief label used to tips
|
||||||
|
*/
|
||||||
|
private JLabel label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ProgressBar.timer
|
||||||
|
* @brief timer used to timing operation
|
||||||
|
*/
|
||||||
|
private Timer timer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ProgressBar.bool
|
||||||
|
* @brief bool used to flag thread return
|
||||||
|
*/
|
||||||
|
private boolean bool = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Progressbar.registry
|
||||||
|
* @brief Registry
|
||||||
|
*/
|
||||||
|
private Registry registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn public ProgressBar()
|
||||||
|
* @brief constructor
|
||||||
|
* @param[in] null
|
||||||
|
*/
|
||||||
|
private String showLable = null ;
|
||||||
|
public ProgressBar(String showlable) {
|
||||||
|
super(true);
|
||||||
|
showLable = showlable;
|
||||||
|
this.setAlwaysOnTop(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn public void setBool(boolean bool)
|
||||||
|
* @brief set bool value
|
||||||
|
* @param[in] bool
|
||||||
|
* @param[out] null
|
||||||
|
*/
|
||||||
|
public void setBool(boolean bool) {
|
||||||
|
this.bool = bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn private void initUI()
|
||||||
|
* @brief createDialog method
|
||||||
|
* @param[in] null
|
||||||
|
* @param[out] null
|
||||||
|
*/
|
||||||
|
public void initUI() {
|
||||||
|
Container container = getContentPane();
|
||||||
|
JPanel mainPanel = new JPanel(new PropertyLayout());
|
||||||
|
this.label = new JLabel(showLable, JLabel.CENTER);
|
||||||
|
this.progressbar = new JProgressBar();
|
||||||
|
this.progressbar.setOrientation(JProgressBar.HORIZONTAL);
|
||||||
|
this.progressbar.setMinimum(0);
|
||||||
|
this.progressbar.setMaximum(100);
|
||||||
|
this.progressbar.setValue(0);
|
||||||
|
this.progressbar.setPreferredSize(new Dimension(200, 15));
|
||||||
|
this.progressbar.setBorderPainted(true);
|
||||||
|
this.timer = new Timer(50, (ActionListener) this);
|
||||||
|
this.timer.setRepeats(false);
|
||||||
|
mainPanel.add("1.1.center", new JLabel(" "));
|
||||||
|
mainPanel.add("2.1.center", label);
|
||||||
|
mainPanel.add("3.1.center", progressbar);
|
||||||
|
mainPanel.add("4.1.center", new JLabel(" "));
|
||||||
|
container.add(mainPanel);
|
||||||
|
pack();
|
||||||
|
setLocation(500, 200);
|
||||||
|
TaskThread thread = new TaskThread(this);
|
||||||
|
thread.start();
|
||||||
|
addWindowListener(new WindowAdapter() {
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
bool = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class TaskThread
|
||||||
|
* @brief Create progressbar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class TaskThread extends Thread {
|
||||||
|
private ProgressBar bar;
|
||||||
|
|
||||||
|
public TaskThread(ProgressBar bar) {
|
||||||
|
this.bar = bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
if (bool == false) {
|
||||||
|
// Set Status is running.
|
||||||
|
// session.setStatus(registry.getString("export Running"));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < i + 1; i++) {
|
||||||
|
timer.start();
|
||||||
|
int value = progressbar.getValue();
|
||||||
|
if (value < 100) {
|
||||||
|
value = value + 5;
|
||||||
|
progressbar.setValue(value);
|
||||||
|
} else {
|
||||||
|
timer.stop();
|
||||||
|
progressbar.setValue(0);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
sleep(100);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (bool == true) {
|
||||||
|
bar.setVisible(false);
|
||||||
|
bar.dispose();
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @file ProgressBarThread.java
|
||||||
|
*
|
||||||
|
* @brief control progressBar.
|
||||||
|
*
|
||||||
|
* @author Yanghui
|
||||||
|
*
|
||||||
|
* @history
|
||||||
|
* ================================================================
|
||||||
|
* Date Name Description of Change
|
||||||
|
* 08-Auguest-2008 Yanghui this class is used to control
|
||||||
|
* progress bar.
|
||||||
|
*/
|
||||||
|
package com.connor.bhdz.pdm.drawingToCapp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class ProgressBarThread
|
||||||
|
* @brief Create progress bar thread
|
||||||
|
* @author Yanghui
|
||||||
|
*/
|
||||||
|
public class ProgressBarThread extends Thread {
|
||||||
|
|
||||||
|
private ProgressBar bar;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public ProgressBarThread(String title,String showLable) {
|
||||||
|
this.title = title;
|
||||||
|
bar = new ProgressBar(showLable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
bar.setTitle(title);
|
||||||
|
bar.initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBool(boolean bool) {
|
||||||
|
bar.setBool(true);
|
||||||
|
bar.setAlwaysOnTop(false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
package com.connor.bhdz.pdm.drawingToCapp;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Cursor;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JProgressBar;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ProgressReporterDialog extends AbstractAIFDialog
|
||||||
|
{
|
||||||
|
|
||||||
|
private JLabel messageLabel;
|
||||||
|
|
||||||
|
private JProgressBar progressBar;
|
||||||
|
|
||||||
|
private boolean requestCanceling;
|
||||||
|
|
||||||
|
private int percent;
|
||||||
|
|
||||||
|
public ProgressReporterDialog()
|
||||||
|
{
|
||||||
|
super(false);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
setAlwaysOnTop(true);
|
||||||
|
|
||||||
|
initializeComponents();
|
||||||
|
setTextPropertyForComponents();
|
||||||
|
registerComponentsListeners();
|
||||||
|
addComponents();
|
||||||
|
|
||||||
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeComponents()
|
||||||
|
{
|
||||||
|
messageLabel = new JLabel(" ", JLabel.LEFT);
|
||||||
|
progressBar = new JProgressBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTextPropertyForComponents()
|
||||||
|
{
|
||||||
|
setTitle("½ø¶È");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerComponentsListeners()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addComponents()
|
||||||
|
{
|
||||||
|
add(messageLabel, BorderLayout.NORTH);
|
||||||
|
add(progressBar, BorderLayout.SOUTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void centerToClientScreen()
|
||||||
|
{
|
||||||
|
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
|
|
||||||
|
int x = screen.width - getWidth();
|
||||||
|
int y = screen.height - getHeight();
|
||||||
|
|
||||||
|
setLocation(x / 2, y / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reportProgressMessage(String message)
|
||||||
|
{
|
||||||
|
messageLabel.setText(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgressPercent(int percent)
|
||||||
|
{
|
||||||
|
this.percent = percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void requestCanceling()
|
||||||
|
{
|
||||||
|
requestCanceling = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
pack();
|
||||||
|
setSize(400, getHeight());
|
||||||
|
centerToClientScreen();
|
||||||
|
setVisible(true);
|
||||||
|
|
||||||
|
while (!requestCanceling)
|
||||||
|
{
|
||||||
|
if(percent > progressBar.getMaximum())
|
||||||
|
{
|
||||||
|
percent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
progressBar.setValue(percent);
|
||||||
|
|
||||||
|
percent += 5;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread.sleep(100);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProgess()
|
||||||
|
{
|
||||||
|
return progressBar.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRequestCanceling()
|
||||||
|
{
|
||||||
|
return requestCanceling;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,171 @@
|
|||||||
|
/**
|
||||||
|
* @file ProgressBar.java
|
||||||
|
*
|
||||||
|
* @brief Create progress bar
|
||||||
|
*
|
||||||
|
* @author Yanghui
|
||||||
|
*
|
||||||
|
* @history
|
||||||
|
* ================================================================
|
||||||
|
* Date Name Description of Change
|
||||||
|
* 25-July-2008 Yanghui this class is used to create
|
||||||
|
* progress bar.
|
||||||
|
*/
|
||||||
|
package com.connor.bhdz.pdm.partToCapp;
|
||||||
|
import java.awt.Container;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JProgressBar;
|
||||||
|
import javax.swing.Timer;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
import com.teamcenter.rac.util.PropertyLayout;
|
||||||
|
import com.teamcenter.rac.util.Registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class ProgressBar
|
||||||
|
* @brief Create progress bar
|
||||||
|
* @author Yanghui
|
||||||
|
*/
|
||||||
|
public class ProgressBar extends AbstractAIFDialog implements ActionListener {
|
||||||
|
/**
|
||||||
|
* @var ProgressBar.progressbar
|
||||||
|
* @brief JProgressBar
|
||||||
|
*/
|
||||||
|
private JProgressBar progressbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ProgressBar.label
|
||||||
|
* @brief label used to tips
|
||||||
|
*/
|
||||||
|
private JLabel label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ProgressBar.timer
|
||||||
|
* @brief timer used to timing operation
|
||||||
|
*/
|
||||||
|
private Timer timer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ProgressBar.bool
|
||||||
|
* @brief bool used to flag thread return
|
||||||
|
*/
|
||||||
|
private boolean bool = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Progressbar.registry
|
||||||
|
* @brief Registry
|
||||||
|
*/
|
||||||
|
private Registry registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn public ProgressBar()
|
||||||
|
* @brief constructor
|
||||||
|
* @param[in] null
|
||||||
|
*/
|
||||||
|
private String showLable = null ;
|
||||||
|
public ProgressBar(String showlable) {
|
||||||
|
super(true);
|
||||||
|
showLable = showlable;
|
||||||
|
this.setAlwaysOnTop(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn public void setBool(boolean bool)
|
||||||
|
* @brief set bool value
|
||||||
|
* @param[in] bool
|
||||||
|
* @param[out] null
|
||||||
|
*/
|
||||||
|
public void setBool(boolean bool) {
|
||||||
|
this.bool = bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn private void initUI()
|
||||||
|
* @brief createDialog method
|
||||||
|
* @param[in] null
|
||||||
|
* @param[out] null
|
||||||
|
*/
|
||||||
|
public void initUI() {
|
||||||
|
Container container = getContentPane();
|
||||||
|
JPanel mainPanel = new JPanel(new PropertyLayout());
|
||||||
|
this.label = new JLabel(showLable, JLabel.CENTER);
|
||||||
|
this.progressbar = new JProgressBar();
|
||||||
|
this.progressbar.setOrientation(JProgressBar.HORIZONTAL);
|
||||||
|
this.progressbar.setMinimum(0);
|
||||||
|
this.progressbar.setMaximum(100);
|
||||||
|
this.progressbar.setValue(0);
|
||||||
|
this.progressbar.setPreferredSize(new Dimension(200, 15));
|
||||||
|
this.progressbar.setBorderPainted(true);
|
||||||
|
this.timer = new Timer(50, (ActionListener) this);
|
||||||
|
this.timer.setRepeats(false);
|
||||||
|
mainPanel.add("1.1.center", new JLabel(" "));
|
||||||
|
mainPanel.add("2.1.center", label);
|
||||||
|
mainPanel.add("3.1.center", progressbar);
|
||||||
|
mainPanel.add("4.1.center", new JLabel(" "));
|
||||||
|
container.add(mainPanel);
|
||||||
|
pack();
|
||||||
|
setLocation(500, 200);
|
||||||
|
TaskThread thread = new TaskThread(this);
|
||||||
|
thread.start();
|
||||||
|
addWindowListener(new WindowAdapter() {
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
bool = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class TaskThread
|
||||||
|
* @brief Create progressbar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class TaskThread extends Thread {
|
||||||
|
private ProgressBar bar;
|
||||||
|
|
||||||
|
public TaskThread(ProgressBar bar) {
|
||||||
|
this.bar = bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
if (bool == false) {
|
||||||
|
// Set Status is running.
|
||||||
|
// session.setStatus(registry.getString("export Running"));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < i + 1; i++) {
|
||||||
|
timer.start();
|
||||||
|
int value = progressbar.getValue();
|
||||||
|
if (value < 100) {
|
||||||
|
value = value + 5;
|
||||||
|
progressbar.setValue(value);
|
||||||
|
} else {
|
||||||
|
timer.stop();
|
||||||
|
progressbar.setValue(0);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
sleep(100);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (bool == true) {
|
||||||
|
bar.setVisible(false);
|
||||||
|
bar.dispose();
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @file ProgressBarThread.java
|
||||||
|
*
|
||||||
|
* @brief control progressBar.
|
||||||
|
*
|
||||||
|
* @author Yanghui
|
||||||
|
*
|
||||||
|
* @history
|
||||||
|
* ================================================================
|
||||||
|
* Date Name Description of Change
|
||||||
|
* 08-Auguest-2008 Yanghui this class is used to control
|
||||||
|
* progress bar.
|
||||||
|
*/
|
||||||
|
package com.connor.bhdz.pdm.partToCapp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class ProgressBarThread
|
||||||
|
* @brief Create progress bar thread
|
||||||
|
* @author Yanghui
|
||||||
|
*/
|
||||||
|
public class ProgressBarThread extends Thread {
|
||||||
|
|
||||||
|
private ProgressBar bar;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public ProgressBarThread(String title,String showLable) {
|
||||||
|
this.title = title;
|
||||||
|
bar = new ProgressBar(showLable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
bar.setTitle(title);
|
||||||
|
bar.initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBool(boolean bool) {
|
||||||
|
bar.setBool(true);
|
||||||
|
bar.setAlwaysOnTop(false);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue