main
commit
809dfe753d
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/core-renderer.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/iTextAsian.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/iTextAsianCmaps.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/itextpdf-5.0.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/ojdbc7.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 @@
|
||||
/bin/
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>cn.net.connor.designtopart</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,4 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/cn/net/connor/plm/util/ExcelWriteTable1.java=UTF-8
|
||||
encoding//src/cn/net/connor/plm/util/ExcelWriteTable2.java=UTF-8
|
||||
encoding//src/cn/net/connor/plm/util/ExcelWriteTable3.java=UTF-8
|
@ -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,75 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Designtopart
|
||||
Bundle-SymbolicName: cn.net.connor.designtopart;singleton:=true
|
||||
Bundle-Version: 1.0.0
|
||||
Bundle-Activator: cn.net.connor.designtopart.Activator
|
||||
Eclipse-RegisterBuddy: k.util
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.teamcenter.rac.aifrcp;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.common;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.external;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.kernel;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.tcapps;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.ui;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.ui.commands;bundle-version="12000.3.0",
|
||||
com.teamcenter.rac.util;bundle-version="12000.3.0",
|
||||
k.util;bundle-version="1.0.0",
|
||||
TcSoaCoreLoose;bundle-version="12000.3.0",
|
||||
TcSoaCoreRac;bundle-version="12000.3.0",
|
||||
TcSoaCoreTypes;bundle-version="12000.3.0",
|
||||
org.apache.poi.315;bundle-version="3.15.0",
|
||||
TcSoaWorkflowLoose;bundle-version="12000.3.0",
|
||||
TcSoaWorkflowRac;bundle-version="12000.3.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Automatic-Module-Name: cn.net.connor.designtopart
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: cn.net.connor.designtopart,
|
||||
cn.net.connor.designtopart.commands,
|
||||
cn.net.connor.designtopart.designtopart,
|
||||
com.connor.dfl.plm.util,
|
||||
oracle.core.lmx,
|
||||
oracle.core.lvf,
|
||||
oracle.jdbc,
|
||||
oracle.jdbc.aq,
|
||||
oracle.jdbc.babelfish,
|
||||
oracle.jdbc.connector,
|
||||
oracle.jdbc.dcn,
|
||||
oracle.jdbc.diagnostics,
|
||||
oracle.jdbc.driver,
|
||||
oracle.jdbc.internal,
|
||||
oracle.jdbc.oci,
|
||||
oracle.jdbc.oracore,
|
||||
oracle.jdbc.pool,
|
||||
oracle.jdbc.pooling,
|
||||
oracle.jdbc.proxy,
|
||||
oracle.jdbc.proxy.annotation,
|
||||
oracle.jdbc.replay,
|
||||
oracle.jdbc.replay.driver,
|
||||
oracle.jdbc.replay.internal,
|
||||
oracle.jdbc.rowset,
|
||||
oracle.jdbc.util,
|
||||
oracle.jdbc.xa,
|
||||
oracle.jdbc.xa.client,
|
||||
oracle.jpub.runtime,
|
||||
oracle.net.ano,
|
||||
oracle.net.aso,
|
||||
oracle.net.jdbc.TNSAddress,
|
||||
oracle.net.jdbc.nl,
|
||||
oracle.net.jdbc.nl.mesg,
|
||||
oracle.net.jndi,
|
||||
oracle.net.ns,
|
||||
oracle.net.nt,
|
||||
oracle.net.resolver,
|
||||
oracle.security.o3logon,
|
||||
oracle.security.o5logon,
|
||||
oracle.sql,
|
||||
oracle.sql.converter
|
||||
Bundle-ClassPath: .,
|
||||
lib/ojdbc7.jar,
|
||||
lib/core-renderer.jar,
|
||||
lib/iTextAsian.jar,
|
||||
lib/iTextAsianCmaps.jar,
|
||||
lib/itextpdf-5.0.6.jar
|
||||
Import-Package: com.teamcenter.rac.ui.common
|
@ -0,0 +1,11 @@
|
||||
output.. = bin/
|
||||
bin.includes = plugin.xml,\
|
||||
META-INF/,\
|
||||
icons/,\
|
||||
.,\
|
||||
lib/ojdbc7.jar,\
|
||||
lib/core-renderer.jar,\
|
||||
lib/iTextAsian.jar,\
|
||||
lib/iTextAsianCmaps.jar,\
|
||||
lib/itextpdf-5.0.6.jar
|
||||
source.. = src/
|
Binary file not shown.
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 526 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
<command name="图纸创建物料" id="cn.net.connor.designtopart.commands.DesignToPartCommand"/>
|
||||
<command name="数据发放" id="cn.net.connor.designtopart.commands.DataAllocationCommand"/>
|
||||
<!--新增杭州世宝按钮-->
|
||||
<command name="派生更改请求ECR" id="com.connor.plm.sb02.DerivedChangeRequestCommand"/>
|
||||
<command name="派生更改通知ECN" id="com.connor.plm.sb02.DerivedChangeNoticeCommand"/>
|
||||
<command name="派生更改通知ECO" id="com.connor.plm.sb02.DerivedChangeOptionCommand"/>
|
||||
<command name="批量修订" id="cn.net.connor.plm.batchRevisionCommand"/>
|
||||
</extension>
|
||||
|
||||
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler commandId="cn.net.connor.designtopart.commands.DesignToPartCommand" class="k.KHandler"/>
|
||||
<handler class="cn.net.connor.plm.handlers.DataAllocationHandler" commandId="cn.net.connor.designtopart.commands.DataAllocationCommand"/>
|
||||
|
||||
<handler commandId="com.connor.plm.sb02.DerivedChangeRequestCommand" class="com.connor.plm.KHandler"/>
|
||||
<handler commandId="com.connor.plm.sb02.DerivedChangeNoticeCommand" class="com.connor.plm.KHandler"/>
|
||||
<handler commandId="com.connor.plm.sb02.DerivedChangeOptionCommand" class="com.connor.plm.KHandler"/>
|
||||
<handler commandId="cn.net.connor.plm.batchRevisionCommand" class="cn.net.connor.plm.batchRevision.BatchRevisionHandler"/>
|
||||
</extension>
|
||||
|
||||
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution locationURI="menu:custWJ?after=projectCust">
|
||||
<command commandId="cn.net.connor.designtopart.commands.DesignToPartCommand" id="cn.net.connor.designtopart.menu.designtopart"/>
|
||||
</menuContribution>
|
||||
|
||||
<menuContribution locationURI="popup:org.eclipse.ui.popup.any?before=additions">
|
||||
<command commandId="cn.net.connor.designtopart.commands.DataAllocationCommand" mnemonic="S" icon="icons/refresh_16.png" id="com.LINIX.sap.commands.batchDownload">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<or>
|
||||
<reference definitionId="com.teamcenter.rac.ui.inMainPerspective"/>
|
||||
<reference definitionId="com.teamcenter.rac.cme.mpp.inMainView"/>
|
||||
</or>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||
<!-- A8_ProductRevision==> 指定版本类型-->
|
||||
<test property="com.teamcenter.rac.kernel.TCComponent.type" value="DocumentRevision" />
|
||||
</adapt>
|
||||
</iterate>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or"><equals value="com.nancal.XXXHandler" /> </iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
|
||||
|
||||
<!--杭州世宝新增:派生按钮-->
|
||||
<command id="com.connor.plm.sb02.menus.DerivedChangeRequestCommand" commandId="com.connor.plm.sb02.DerivedChangeRequestCommand">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||
<or>
|
||||
<test property="com.teamcenter.rac.kernel.TCComponent.typeClass"
|
||||
value="ItemRevision">
|
||||
</test>
|
||||
</or>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command id="com.connor.plm.sb02.menus.DerivedChangeNoticeCommand" commandId="com.connor.plm.sb02.DerivedChangeNoticeCommand">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||
<or>
|
||||
<test property="com.teamcenter.rac.kernel.TCComponent.typeClass"
|
||||
value="ItemRevision">
|
||||
</test>
|
||||
</or>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command id="com.connor.plm.sb02.menus.DerivedChangeOptionCommand" commandId="com.connor.plm.sb02.DerivedChangeOptionCommand">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||
<or>
|
||||
<test property="com.teamcenter.rac.kernel.TCComponent.typeClass"
|
||||
value="ItemRevision">
|
||||
</test>
|
||||
</or>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
|
||||
<!--右键菜单:批量修订-->
|
||||
<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
|
||||
<command id="cn.net.connor.plm.menus.batchRevision" commandId="cn.net.connor.plm.batchRevisionCommand">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.ui.inMainPerspective">
|
||||
</reference>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||
<or>
|
||||
<!-- <test property="com.teamcenter.rac.kernel.TCComponent.type" value="ChangeNoticeRevision" />-->
|
||||
<test
|
||||
property="com.teamcenter.rac.kernel.TCComponent.property"
|
||||
args="object_string" value="问题项">
|
||||
</test>
|
||||
<test
|
||||
property="com.teamcenter.rac.kernel.TCComponent.property"
|
||||
args="object_string" value="受影响项">
|
||||
</test>
|
||||
</or>
|
||||
</adapt>
|
||||
</iterate>
|
||||
<with
|
||||
variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate
|
||||
operator="or">
|
||||
<equals
|
||||
value="cn.com.origin.autocode.handlers.AutoCodeNewItemHandler">
|
||||
</equals>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
|
||||
|
||||
</plugin>
|
@ -0,0 +1,44 @@
|
||||
package cn.net.connor.designtopart;
|
||||
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class Activator extends AbstractUIPlugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "cn.net.connor.designtopart"; //$NON-NLS-1$
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public Activator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.net.connor.designtopart;
|
||||
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
|
||||
public class DesigntopartLocale {
|
||||
|
||||
public static final Registry reg = Registry.getRegistry(DesigntopartLocale.class);
|
||||
|
||||
public static String getString(String title) {
|
||||
if (isEmpty(title)) {
|
||||
return "";
|
||||
} else {
|
||||
String res = reg.getString(title);
|
||||
return isEmpty(res) ? title : res;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEmpty(String title) {
|
||||
return title == null || "".equals(title.trim());
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.designtopart.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.designtopart.designtopart.DesignToPartDialog;
|
||||
import cn.net.connor.designtopart.designtopart.DesignToPartDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class DesignToPartCommand extends KCommand {
|
||||
|
||||
public DesignToPartCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new DesignToPartDialog(new DesignToPartDialogController(app)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.net.connor.designtopart.designtopart;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import cn.net.connor.designtopart.DesigntopartLocale;
|
||||
import javafx.embed.swing.JFXPanel;
|
||||
import k.KDialog;
|
||||
import k.KDialogController;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class DesignToPartDialog extends KDialog {
|
||||
|
||||
protected DesignToPartDialogController controller;
|
||||
|
||||
public DesignToPartDialog(KDialogController controller) {
|
||||
super(controller);
|
||||
this.controller = (DesignToPartDialogController) controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI() {
|
||||
this.setTitle(DesigntopartLocale.getString("designtopart"));
|
||||
this.setPreferredSize(new Dimension(800, 600));
|
||||
this.setMinimumSize(new Dimension(800, 600));
|
||||
JFXPanel panel = new JFXPanel();
|
||||
panel.setScene(new DesignToPartPanel(this).getScene());
|
||||
this.add(BorderLayout.CENTER, panel);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package cn.net.connor.designtopart.designtopart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
|
||||
import cn.net.connor.designtopart.DesigntopartLocale;
|
||||
import k.KDialogController;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class DesignToPartDialogController extends KDialogController {
|
||||
|
||||
public static final String PREF_TRANSFER = DesigntopartLocale.getString("DESIGNTOPART.PREF");
|
||||
protected List<TableBuilder> tableBuilders = new ArrayList<TableBuilder>();
|
||||
|
||||
public DesignToPartDialogController(AbstractAIFApplication app) {
|
||||
super(app);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
InterfaceAIFComponent[] targets = app.getTargetComponents();
|
||||
Map<String, List<TCComponentItemRevision>> selectedRevMap = new HashMap<>(64);
|
||||
int targetCnt = KUtil.getLen(targets);
|
||||
for (int i = 0; i < targetCnt; i++) {
|
||||
InterfaceAIFComponent target = targets[i];
|
||||
if (!(target instanceof TCComponentItemRevision)) {
|
||||
continue;
|
||||
}
|
||||
TCComponentItemRevision rev = (TCComponentItemRevision) target;
|
||||
String type = rev.getType();
|
||||
List<TCComponentItemRevision> list;
|
||||
if (selectedRevMap.containsKey(type)) {
|
||||
list = selectedRevMap.get(type);
|
||||
} else {
|
||||
list = new ArrayList<TCComponentItemRevision>();
|
||||
selectedRevMap.put(type, list);
|
||||
}
|
||||
if (!list.contains(rev)) {
|
||||
list.add(rev);
|
||||
}
|
||||
}
|
||||
selectedRevMap.forEach((k, v) -> System.out.println("ÀàÐÍ = " + k + ", " + v));
|
||||
if (selectedRevMap.size() == 0) {
|
||||
throw new TCException(DesigntopartLocale.getString("selectrev.INFO"));
|
||||
}
|
||||
// Connor_Design_To_Part
|
||||
String[] prefVals = KUtil.getPrefVals(session, PREF_TRANSFER);
|
||||
int len = KUtil.getLen(prefVals);
|
||||
int counter = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
String prefVal = prefVals[i];
|
||||
TableBuilder builder = new TableBuilder(session, prefVal, selectedRevMap);
|
||||
tableBuilders.add(builder);
|
||||
counter += (builder.fromRevList == null ? 0 : builder.fromRevList.size());
|
||||
}
|
||||
if (tableBuilders.size() == 0) {
|
||||
throw new TCException(String.format(DesigntopartLocale.getString("pref.ERROR1"), PREF_TRANSFER));
|
||||
}
|
||||
if (counter == 0) {
|
||||
throw new TCException(DesigntopartLocale.getString("notransferdata.INFO"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0"
|
||||
xmlns="http://javafx.com/javafx/8"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.net.connor.designtopart.designtopart.DesignToPartPanelController">
|
||||
<children>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||
<center>
|
||||
<ScrollPane fx:id="scrollPane" fitToHeight="true" fitToWidth="true" prefViewportHeight="400.0" prefViewportWidth="600.0" styleClass="edge-to-edge" BorderPane.alignment="CENTER">
|
||||
<content>
|
||||
<VBox fx:id="vBox" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="150.0" spacing="12.0">
|
||||
<padding>
|
||||
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<GridPane alignment="CENTER" hgap="50.0" BorderPane.alignment="CENTER">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
||||
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Button mnemonicParsing="false" onAction="#createBtnClick" text=" 创建 " />
|
||||
<Button mnemonicParsing="false" onAction="#closeBtnClick" text=" 取消 " GridPane.columnIndex="1" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
<AnchorPane fx:id="cover" prefHeight="600.0" prefWidth="800.0" visible="false">
|
||||
<children>
|
||||
<ProgressIndicator prefHeight="30.0" prefWidth="30.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</StackPane>
|
@ -0,0 +1,14 @@
|
||||
package cn.net.connor.designtopart.designtopart;
|
||||
|
||||
import java.awt.Window;
|
||||
|
||||
import k.ui.KFXPanel;
|
||||
|
||||
public class DesignToPartPanel extends KFXPanel{
|
||||
|
||||
public DesignToPartPanel(Window dialog) {
|
||||
super(dialog, DesignToPartPanel.class, "style.css");
|
||||
initData();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,186 @@
|
||||
package cn.net.connor.designtopart.designtopart;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.designtopart.DesigntopartLocale;
|
||||
import cn.net.connor.designtopart.designtopart.TableBuilder.RowData;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TitledPane;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import k.KOperation;
|
||||
import k.KOperation2;
|
||||
import k.ui.KFXPanel;
|
||||
import k.ui.KFXPanelController;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class DesignToPartPanelController extends KFXPanelController {
|
||||
@FXML
|
||||
private AnchorPane cover;
|
||||
@FXML
|
||||
private VBox vBox;
|
||||
@FXML
|
||||
private ScrollPane scrollPane;
|
||||
|
||||
private DesignToPartDialog dialog;
|
||||
private List<TableBuilder> tableBuilders;
|
||||
protected boolean flag = false;
|
||||
protected double scrollVal;
|
||||
|
||||
@Override
|
||||
public void initData(KFXPanel panel) throws Exception {
|
||||
this.dialog = (DesignToPartDialog) ((DesignToPartPanel) panel).getParentDialog();
|
||||
this.tableBuilders = dialog.controller.tableBuilders;
|
||||
setProgressVisible(true);
|
||||
|
||||
new KOperation(AIFUtility.getCurrentApplication(), DesigntopartLocale.getString("readdata.STATUS")) {
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
int tableBuilderCnt = tableBuilders.size();
|
||||
for (int i = 0; i < tableBuilderCnt; i++) {
|
||||
TableBuilder tableBuilder = tableBuilders.get(i);
|
||||
TableView<RowData> table = tableBuilder.build();
|
||||
if (table == null) {
|
||||
continue;
|
||||
}
|
||||
table.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
|
||||
@Override
|
||||
public void handle(MouseEvent mouseEvent) {
|
||||
flag = true;
|
||||
scrollVal = scrollPane.getVvalue();
|
||||
scrollPane.setVvalue(scrollVal);
|
||||
System.out.println("---MOUSE_CLICKED---");
|
||||
}
|
||||
});
|
||||
|
||||
Platform.runLater(() -> {
|
||||
TitledPane pane = new TitledPane(tableBuilder.title, table);
|
||||
int height = (100 + 35 * tableBuilder.fromRevList.size()) > 205
|
||||
? (100 + 35 * tableBuilder.fromRevList.size())
|
||||
: 205;
|
||||
pane.setMinHeight(170);
|
||||
pane.setMaxHeight(height);
|
||||
pane.expandedProperty().addListener((observable, wasExpanded, isExpanded) -> {
|
||||
pane.setMaxHeight(isExpanded ? height : 0);
|
||||
pane.setMinHeight(isExpanded ? 230 : Region.USE_PREF_SIZE);
|
||||
});
|
||||
pane.setAnimated(false);
|
||||
VBox.setVgrow(pane, Priority.ALWAYS);
|
||||
vBox.getChildren().add(pane);
|
||||
});
|
||||
}
|
||||
setProgressVisible(false);
|
||||
}
|
||||
}.executeModeless();
|
||||
|
||||
scrollPane.vvalueProperty()
|
||||
.addListener((ObservableValue<? extends Number> ov, Number old_val, Number new_val) -> {
|
||||
if (flag) {
|
||||
scrollPane.setVvalue(scrollVal);
|
||||
flag = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void closeBtnClick() {
|
||||
dialog.disposeDialog();
|
||||
}
|
||||
|
||||
public void createBtnClick() {
|
||||
setProgressVisible(true);
|
||||
new KOperation2(AIFUtility.getCurrentApplication(), DesigntopartLocale.getString("create.STATUS")) {
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
try {
|
||||
checkCanCreate();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(dialog, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
doCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(dialog, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCache() throws Exception {
|
||||
setProgressVisible(false);
|
||||
}
|
||||
|
||||
}.executeModeless();
|
||||
|
||||
}
|
||||
|
||||
public void checkCanCreate() throws Exception {
|
||||
for (int i = 0; i < tableBuilders.size(); i++) {
|
||||
tableBuilders.get(i).checkCanCreate();
|
||||
}
|
||||
}
|
||||
|
||||
public void doCreate() throws Exception {
|
||||
StringBuilder err = new StringBuilder();
|
||||
for (int i = 0; i < tableBuilders.size(); i++) {
|
||||
TableBuilder tableBuilder = tableBuilders.get(i);
|
||||
String status = tableBuilder.title + ": " + DesigntopartLocale.getString("create.STATUS");
|
||||
try {
|
||||
tableBuilder.doCreate(status);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
err.append("[" + tableBuilder.title + "]" + e.getMessage() + "\r\n");
|
||||
}
|
||||
}
|
||||
if (err.length() > 0) {
|
||||
String errTitle = DesigntopartLocale.getString("createerror.TITLE");
|
||||
String exportFileName = errTitle + KUtil.getDateStr(new Date(), "_yyyyMMdd_HHmmss") + ".txt";
|
||||
KUtil.showScrollDialogWithExport(dialog, err.toString(), errTitle, exportFileName);
|
||||
} else {
|
||||
KUtil.info(dialog, DesigntopartLocale.getString("create.SUCCESS"));
|
||||
}
|
||||
}
|
||||
|
||||
public void setProgressVisible(boolean visible) {
|
||||
if (cover != null) {
|
||||
if (Platform.isFxApplicationThread()) {
|
||||
cover.setVisible(visible);
|
||||
} else {
|
||||
Platform.runLater(() -> {
|
||||
cover.setVisible(visible);
|
||||
});
|
||||
}
|
||||
try {
|
||||
TimeUnit.MILLISECONDS.sleep(20);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
.table-view {
|
||||
-fx-faint-focus-color: transparent;
|
||||
-fx-focus-color: rgba(0, 0, 0, 0.2);
|
||||
-fx-background-insets: 0;
|
||||
}
|
||||
|
||||
.redcell:filled {
|
||||
-fx-background-color: #f5696c;
|
||||
-fx-background-insets: 0.5;
|
||||
}
|
||||
|
||||
.table-view:row-selection .table-row-cell:selected .redcell {
|
||||
-fx-background-color: null;
|
||||
}
|
||||
|
||||
.table-view:cell-selection .redcell:selected {
|
||||
-fx-background-color: -fx-table-cell-border-color, -fx-background;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#
|
||||
#Wed Dec 23 10:14:08 CST 2020
|
||||
designtopart=Design To Part
|
||||
DESIGNTOPART.PREF=Connor_Design_To_Part
|
||||
notransferdata.INFO=\u6CA1\u6709\u627E\u5230\u53EF\u4EE5\u8F6C\u6362\u7684\u7C7B\u578B
|
||||
propnotdefinedintype.ERROR2=\u5C5E\u6027"%s"\u672A\u5728\u7C7B\u578B"%s"\u4E2D\u5B9A\u4E49
|
||||
create.SUCCESS=\u56FE\u7EB8\u8F6C\u7269\u6599\u5B8C\u6210
|
||||
selectrev.INFO=\u672A\u9009\u62E9\u7248\u672C\u7C7B\u578B
|
||||
prefvalue.ERROR1=\u65E0\u6CD5\u89E3\u6790\u9996\u9009\u9879\u914D\u7F6E "%s"
|
||||
create.STATUS=\u56FE\u7EB8\u8F6C\u7269\u6599
|
||||
prefconfig.EMPTY=\u914D\u7F6E\u4E0D\u53EF\u4E3A\u7A7A
|
||||
readdata.STATUS=\u52A0\u8F7D\u6570\u636E
|
||||
createerror.TITLE=\u56FE\u7EB8\u8F6C\u7269\u6599\u9519\u8BEF
|
||||
tablerowdataempty.ERROR2="%s"\u8868\u7B2C%d\u884C\u5FC5\u586B\u5C5E\u6027\u5B58\u5728\u7A7A\u503C\uFF0C\u8BF7\u5B8C\u5584\u540E\u518D\u6267\u884C\u521B\u5EFA
|
||||
pref.ERROR1=\u9996\u9009\u9879"%s"\u914D\u7F6E\u9519\u8BEF
|
@ -0,0 +1,15 @@
|
||||
#
|
||||
#Wed Dec 23 10:14:08 CST 2020
|
||||
designtopart=\u56FE\u7EB8\u8F6C\u7269\u6599
|
||||
DESIGNTOPART.PREF=Connor_Design_To_Part
|
||||
notransferdata.INFO=\u6CA1\u6709\u627E\u5230\u53EF\u4EE5\u8F6C\u6362\u7684\u7C7B\u578B
|
||||
propnotdefinedintype.ERROR2=\u5C5E\u6027"%s"\u672A\u5728\u7C7B\u578B"%s"\u4E2D\u5B9A\u4E49
|
||||
create.SUCCESS=\u56FE\u7EB8\u8F6C\u7269\u6599\u5B8C\u6210
|
||||
selectrev.INFO=\u672A\u9009\u62E9\u7248\u672C\u7C7B\u578B
|
||||
prefvalue.ERROR1=\u65E0\u6CD5\u89E3\u6790\u9996\u9009\u9879\u914D\u7F6E "%s"
|
||||
create.STATUS=\u56FE\u7EB8\u8F6C\u7269\u6599
|
||||
prefconfig.EMPTY=\u914D\u7F6E\u4E0D\u53EF\u4E3A\u7A7A
|
||||
readdata.STATUS=\u52A0\u8F7D\u6570\u636E
|
||||
createerror.TITLE=\u56FE\u7EB8\u8F6C\u7269\u6599\u9519\u8BEF
|
||||
tablerowdataempty.ERROR2="%s"\u8868\u7B2C%d\u884C\u5FC5\u586B\u5C5E\u6027\u5B58\u5728\u7A7A\u503C\uFF0C\u8BF7\u5B8C\u5584\u540E\u518D\u6267\u884C\u521B\u5EFA
|
||||
pref.ERROR1=\u9996\u9009\u9879"%s"\u914D\u7F6E\u9519\u8BEF
|
@ -0,0 +1,22 @@
|
||||
package cn.net.connor.plm.batchRevision;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class BatchRevisionHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
BatchRevisionAction action = new BatchRevisionAction(application, null, null);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package cn.net.connor.plm.handlers;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import cn.net.connor.plm.dialogs.DataAllocationHandlerDialog;
|
||||
import cn.net.connor.plm.entity.Prop;
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class DataAllocationHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
// TODO Auto-generated method stub
|
||||
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||
|
||||
TCComponent rev = (TCComponent) app.getTargetComponent();
|
||||
try {
|
||||
TCComponent[] components = rev.getRelatedComponents("SB6_XGWJ");
|
||||
|
||||
String[] type1 = { "SB6_CatiaDesignXRevision", "SB6_AutocadDXRevision", "SB6_CatiaAssDXRevision",
|
||||
"SB6_CatiaSDXRevision", "SB6_AutocadAssDXRevision", "SB6_AutocadSDXRevision",
|
||||
"SB6_CatiaDesignLRevision", "SB6_AutocadDLRevision", "SB6_CatiaAssDLRevision",
|
||||
"SB6_CatiaSDLRevision", "SB6_AutocadAssDLRevision", "SB6_AutocadSDLRevision" };
|
||||
String type3 = "SB6_SZLXDRevisionMaster";
|
||||
|
||||
String[] prop1 = { "object_name", "item_id", "item_revision_id" };
|
||||
String[] prop3 = { "sb6_SZRM01", "sb6_SZRM02", "sb6_SZRM03", "sb6_SZRM04"};
|
||||
|
||||
// 获取当前本地日期和时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd");
|
||||
String localTime = now.format(formatter);
|
||||
System.out.println("localTime : "+ localTime);
|
||||
|
||||
List<Prop> propList1 = new ArrayList<>();
|
||||
List<Prop> propList2 = new ArrayList<>();
|
||||
List<Prop> propList3 = new ArrayList<>();
|
||||
|
||||
List<TCComponentItemRevision> relationRevs = new ArrayList<TCComponentItemRevision>();
|
||||
for (int i = 0; i < components.length; i++) {
|
||||
if (components[i] instanceof TCComponentItemRevision) {
|
||||
TCComponentItemRevision tcComponent = (TCComponentItemRevision) components[i];
|
||||
TCComponent[] components1 = tcComponent.getRelatedComponents("release_status_list");
|
||||
if (components1 == null || components1.length == 0) {
|
||||
MessageBox.post("存在未发布版本对象", "Error", MessageBox.ERROR);
|
||||
return null;
|
||||
}
|
||||
String type = tcComponent.getType();
|
||||
System.out.println("type : "+ type);
|
||||
|
||||
boolean flag1 = false;
|
||||
for (String tempType : type1) {
|
||||
if (type.equals(tempType)) {
|
||||
flag1 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
TCComponent form = tcComponent.getRelatedComponent("IMAN_master_form_rev");
|
||||
String itemId = tcComponent.getStringProperty("item_id");
|
||||
TCComponent owningUeserRelation = tcComponent.getRelatedComponent("owning_user");
|
||||
String ownerUser = owningUeserRelation.getStringProperty("user_name");
|
||||
if (ownerUser.contains("(")) {
|
||||
ownerUser = ownerUser.substring(0, ownerUser.indexOf("("));
|
||||
}
|
||||
int cnt = 0;
|
||||
|
||||
if (flag1) {
|
||||
relationRevs.add(tcComponent);
|
||||
String[] properties = tcComponent.getProperties(prop1);
|
||||
|
||||
String property1 = form.getStringProperty("sb6_ifls");
|
||||
if(property1 != null) {
|
||||
if (property1.equals("是")) {
|
||||
property1 = "临时";
|
||||
} else if (property1.equals("否")) {
|
||||
property1 = "正式";
|
||||
} else {
|
||||
System.out.println("null");
|
||||
}
|
||||
}else {
|
||||
System.out.println("sb6_ifls属性为空");
|
||||
}
|
||||
String property2 = form.getStringProperty("sb6_relatedfileno");
|
||||
propList1.add(new Prop("", "图纸", properties[cnt++], properties[cnt++], property1,
|
||||
properties[cnt++], ownerUser, localTime, property2));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type.equals("ChangeNoticeRevision")) {
|
||||
relationRevs.add(tcComponent);
|
||||
String[] properties = form.getProperties(new String[] { "sb6_CNRM05", "sb6_CNRM05" });
|
||||
TCComponent[] tempGx = tcComponent.getRelatedComponents("CMSolutionItems");
|
||||
String itemIds = getItemId(tempGx);
|
||||
String status = getDrawingStatu(tempGx);
|
||||
|
||||
propList2.add(new Prop("", "技术文件更改通知单", properties[cnt++], properties[cnt++], itemIds, status,
|
||||
ownerUser, localTime, itemId));
|
||||
} else if (type.equals("SB6_JSWTLSCLTZDRevision")) {
|
||||
relationRevs.add(tcComponent);
|
||||
String[] properties = form.getProperties(new String[] { "sb6_LSRM05", "sb6_LSRM05" });
|
||||
TCComponent[] tempGx = tcComponent.getRelatedComponents("SB6_LSSJRelation");
|
||||
String itemIds = getItemId(tempGx);
|
||||
String status = getDrawingStatu(tempGx);
|
||||
|
||||
propList2.add(new Prop("", "临时问题处理通知单", properties[cnt++], properties[cnt++], itemIds, status,
|
||||
ownerUser, localTime, itemId));
|
||||
}
|
||||
|
||||
if (type3.equals(type)) {
|
||||
relationRevs.add(tcComponent);
|
||||
String[] properties = form.getProperties(prop3);
|
||||
|
||||
propList3.add(new Prop("", "样件试制/试生产联系单", properties[cnt++], properties[cnt++], properties[cnt++],properties[cnt++],
|
||||
ownerUser, localTime, itemId));
|
||||
}
|
||||
}
|
||||
}
|
||||
DataAllocationHandlerDialog cmbd = new DataAllocationHandlerDialog(app,propList1,propList2,propList3,relationRevs);
|
||||
new Thread(cmbd).start();
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getItemId(TCComponent[] tempGx) throws TCException {
|
||||
StringBuffer str = new StringBuffer();
|
||||
for (int i = 0; i < tempGx.length; i++) {
|
||||
TCComponent tcComponent = tempGx[i];
|
||||
str.append(tcComponent.getStringProperty("item_id"));
|
||||
if (i != tempGx.length - 1) {
|
||||
str.append("\n");
|
||||
}
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public String getDrawingStatu(TCComponent[] tempGx) throws TCException {
|
||||
StringBuffer str = new StringBuffer();
|
||||
for (int i = 0; i < tempGx.length; i++) {
|
||||
TCComponent tcComponent = tempGx[i];
|
||||
TCComponent form = tcComponent.getRelatedComponent("IMAN_master_form_rev");
|
||||
String ifls = form.getStringProperty("sb6_ifls");
|
||||
if (ifls.equals("是")) {
|
||||
ifls = "临时" + tcComponent.getStringProperty("item_revision_id");
|
||||
} else if (ifls.equals("否")) {
|
||||
ifls = "正式" + tcComponent.getStringProperty("item_revision_id");
|
||||
} else {
|
||||
System.out.println("getDrawingStatu null");
|
||||
}
|
||||
System.out.println("ifls : " + ifls);
|
||||
str.append(ifls);
|
||||
if (i != tempGx.length - 1 || !ifls.isEmpty()) {
|
||||
str.append("\n");
|
||||
}
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.net.connor.test;
|
||||
|
||||
public class Colconfig {
|
||||
private String name;
|
||||
private String age;
|
||||
private String code;
|
||||
|
||||
public Colconfig(String name, String age, String code) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Colconfig() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(String age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.net.connor.test;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
public class Data {
|
||||
private SimpleStringProperty name = new SimpleStringProperty();
|
||||
private SimpleStringProperty age = new SimpleStringProperty();
|
||||
private SimpleStringProperty code = new SimpleStringProperty();
|
||||
|
||||
public Data() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Data(String name, String age, String code) {
|
||||
super();
|
||||
this.name.set(name);
|
||||
this.age.set(age);
|
||||
this.code.set(code);
|
||||
}
|
||||
|
||||
public SimpleStringProperty getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(SimpleStringProperty name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public SimpleStringProperty getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(SimpleStringProperty age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public SimpleStringProperty getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(SimpleStringProperty code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package cn.net.connor.test;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.Event;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.HPos;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.ComboBoxTableCell;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Callback;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public class Main extends Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Application.launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
StackPane root = new StackPane();
|
||||
ObservableList<String> list = FXCollections.observableArrayList();
|
||||
list.add("One");
|
||||
list.add("Two");
|
||||
list.add("Three");
|
||||
list.add("Four");
|
||||
|
||||
TableColumn name = new TableColumn("Name");
|
||||
TableColumn age = new TableColumn("age");
|
||||
TableColumn code = new TableColumn("code");
|
||||
|
||||
name.setCellValueFactory(new PropertyValueFactory<Colconfig, String>("name"));
|
||||
name.setCellFactory(ComboBoxTableCell.forTableColumn(list));
|
||||
|
||||
age.setCellValueFactory(new PropertyValueFactory<Colconfig, String>("age"));
|
||||
age.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
code.setCellValueFactory(new PropertyValueFactory<Colconfig, String>("code"));
|
||||
code.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
name.setOnEditCommit(new EventHandler<Event>() {
|
||||
@Override
|
||||
public void handle(Event arg0) {
|
||||
}
|
||||
});
|
||||
|
||||
ObservableList<Colconfig> datas = FXCollections.observableArrayList();
|
||||
datas.add(new Colconfig("A", "12", "1212"));
|
||||
datas.add(new Colconfig("B", "13", "1313"));
|
||||
datas.add(new Colconfig("C", "14", "1414"));
|
||||
|
||||
TableView table = new TableView(datas);
|
||||
table.setEditable(true);
|
||||
table.getColumns().addAll(name, age, code);
|
||||
|
||||
root.getChildren().add(table);
|
||||
Scene scene = new Scene(root, 300, 250);
|
||||
stage.setTitle("Test");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package cn.net.connor.test;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TitledPane;
|
||||
import javafx.scene.control.cell.ComboBoxTableCell;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Main2 extends Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Application.launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
VBox vBox = new VBox();
|
||||
Scene scene = new Scene(vBox, 500, 250);
|
||||
|
||||
ObservableList<String> list = FXCollections.observableArrayList();
|
||||
list.add("One");
|
||||
list.add("Two");
|
||||
list.add("Three");
|
||||
list.add("Four");
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ObservableList<Colconfig> datas = FXCollections.observableArrayList();
|
||||
datas.add(new Colconfig("A", "12", "1212"));
|
||||
datas.add(new Colconfig("B", "13", "1313"));
|
||||
datas.add(new Colconfig("C", "14", "1414"));
|
||||
|
||||
TableColumn<Colconfig, String> name = new TableColumn<>("Name");
|
||||
TableColumn<Colconfig, String> age = new TableColumn<>("Age");
|
||||
TableColumn<Colconfig, String> code = new TableColumn<>("Code");
|
||||
|
||||
name.setCellValueFactory(new PropertyValueFactory<Colconfig, String>("name"));
|
||||
name.setCellFactory(ComboBoxTableCell.forTableColumn(list));
|
||||
|
||||
age.setCellValueFactory(new PropertyValueFactory<Colconfig, String>("age"));
|
||||
age.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
code.setCellValueFactory(new PropertyValueFactory<Colconfig, String>("code"));
|
||||
code.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
TableView<Colconfig> table = new TableView<>(datas);
|
||||
name.setEditable(false);
|
||||
table.setEditable(true);
|
||||
table.getColumns().addAll(name, age, code);
|
||||
|
||||
TitledPane titledPane = new TitledPane("AutocadSDX" + i, table);
|
||||
titledPane.setMaxHeight(500);
|
||||
titledPane.setMinHeight(230);
|
||||
titledPane.expandedProperty().addListener((observable, wasExpanded, isExpanded) -> {
|
||||
titledPane.setMaxHeight(isExpanded ? 500 : 0);
|
||||
titledPane.setMinHeight(isExpanded ? 230 : Region.USE_PREF_SIZE);
|
||||
});
|
||||
titledPane.setAnimated(false);
|
||||
VBox.setVgrow(titledPane, Priority.ALWAYS);
|
||||
vBox.getChildren().add(titledPane);
|
||||
}
|
||||
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.net.connor.test;
|
||||
|
||||
public class PartBean {
|
||||
|
||||
private String id;
|
||||
private String uom;
|
||||
private String material;
|
||||
private String weight;
|
||||
|
||||
|
||||
|
||||
public PartBean() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PartBean(String id, String uom, String material, String weight) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.uom = uom;
|
||||
this.material = material;
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUom() {
|
||||
return uom;
|
||||
}
|
||||
|
||||
public void setUom(String uom) {
|
||||
this.uom = uom;
|
||||
}
|
||||
|
||||
public String getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public void setMaterial(String material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(String weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.net.connor.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
public List<Inner> inners;
|
||||
|
||||
public Test() {
|
||||
inners = new ArrayList<Test.Inner>();
|
||||
Inner inner = new Inner(true, "A");
|
||||
Inner inner2 = new Inner(true, "A");
|
||||
;
|
||||
inners.add(inner);
|
||||
inners.add(inner2);
|
||||
System.out.println(inner);
|
||||
System.out.println(inner2);
|
||||
System.out.println(inner == inner2);
|
||||
}
|
||||
|
||||
public static class Inner {
|
||||
public boolean flag;
|
||||
public String name;
|
||||
|
||||
public Inner(boolean flag, String name) {
|
||||
super();
|
||||
this.flag = flag;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Test();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class Activator extends AbstractUIPlugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "cn.net.connor.ml.plm"; //$NON-NLS-1$
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public Activator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class ChangeRequestTypeSelectDialog extends JDialog {
|
||||
private String selectedValue = null;
|
||||
|
||||
// 静态方法:显示对话框并返回选中的值
|
||||
public static String showComboBoxDialog(Component parent, String title, String labelText, String[] options) {
|
||||
// 创建一个模式化的 JDialog
|
||||
ChangeRequestTypeSelectDialog dialog = new ChangeRequestTypeSelectDialog(parent, title, labelText, options);
|
||||
dialog.setVisible(true); // 显示对话框,阻塞后续执行
|
||||
return dialog.selectedValue; // 返回用户选择的值
|
||||
}
|
||||
|
||||
// 私有构造函数
|
||||
private ChangeRequestTypeSelectDialog(Component parent, String title, String labelText, String[] options) {
|
||||
super(JOptionPane.getFrameForComponent(parent), title, true); // 模式化对话框
|
||||
|
||||
// 初始化组件
|
||||
JLabel label = new JLabel(labelText + ":");
|
||||
comboBox = new JComboBox<>(options);
|
||||
cancelButton = new JButton("取消");
|
||||
confirmButton = new JButton("确认");
|
||||
|
||||
// 设置布局
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new FlowLayout(FlowLayout.CENTER));
|
||||
|
||||
panel.add(label);
|
||||
panel.add(comboBox);
|
||||
|
||||
JPanel buttonPanel = new JPanel();
|
||||
buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
buttonPanel.add(cancelButton);
|
||||
buttonPanel.add(confirmButton);
|
||||
|
||||
this.add(panel, BorderLayout.CENTER);
|
||||
this.add(buttonPanel, BorderLayout.SOUTH);
|
||||
|
||||
// 事件处理
|
||||
confirmButton.addActionListener(e -> {
|
||||
selectedValue = (String) comboBox.getSelectedItem();
|
||||
dispose(); // 关闭对话框
|
||||
});
|
||||
|
||||
cancelButton.addActionListener(e -> {
|
||||
selectedValue = null;
|
||||
dispose(); // 关闭对话框
|
||||
});
|
||||
|
||||
// 设置窗口属性
|
||||
this.setSize(400, 150);
|
||||
this.setLocationRelativeTo(parent); // 居中显示
|
||||
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
}
|
||||
|
||||
private JComboBox<String> comboBox;
|
||||
private JButton cancelButton, confirmButton;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||
|
||||
public abstract class KCommand extends AbstractAIFCommand {
|
||||
|
||||
protected AbstractAIFApplication app;
|
||||
protected String actionInfo;
|
||||
|
||||
public KCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
this.app = app;
|
||||
this.actionInfo = actionInfo;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
/**
|
||||
* Add following config to MANIFEST.MF
|
||||
* Eclipse-RegisterBuddy: k.util
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class KHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) {
|
||||
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
|
||||
new Thread(new KAction(app,arg0.getCommand().getId())).start();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
|
||||
public class KLocale {
|
||||
|
||||
public static final Registry reg = Registry.getRegistry(KLocale.class);
|
||||
|
||||
public static String getString(String title) {
|
||||
if (isEmpty(title)) {
|
||||
return "";
|
||||
} else {
|
||||
String res = reg.getString(title);
|
||||
return isEmpty(res) ? title : res;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEmpty(String title) {
|
||||
return title == null || "".equals(title.trim());
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import java.awt.Dimension;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
/*
|
||||
* do not call executeOperation yourself
|
||||
* use session.performOperation
|
||||
*/
|
||||
public abstract class KOperation extends AbstractAIFOperation {
|
||||
|
||||
protected AbstractAIFApplication app;
|
||||
protected TCSession session;
|
||||
public String messageLabel;
|
||||
|
||||
public KOperation(AbstractAIFApplication app, String opName, String messageLabel) {
|
||||
super(opName, true);
|
||||
this.app = app;
|
||||
this.session = (TCSession) app.getSession();
|
||||
this.messageLabel = messageLabel;// ½ø¶ÈÌõÐÅÏ¢
|
||||
setSession(session);
|
||||
}
|
||||
|
||||
public abstract boolean init() throws Exception;
|
||||
|
||||
public abstract void execute() throws Exception;
|
||||
|
||||
@Override
|
||||
public void executeOperation() {
|
||||
ProgressBar pb = new ProgressBar(getCurrentDesktop(), new Dimension(250, 50), true);
|
||||
try {
|
||||
pb.showDialog();
|
||||
pb.setText(messageLabel);
|
||||
setStatus("Checking Data...");
|
||||
if (!init()) {
|
||||
pb.disposeDialog();
|
||||
return;
|
||||
}
|
||||
setStatus("Execute...");
|
||||
pb.setText(messageLabel);
|
||||
execute();
|
||||
pb.disposeDialog();
|
||||
} catch (Exception e) {
|
||||
pb.disposeDialog();
|
||||
KUtil.error(getCurrentDesktop(), "·¢ÉúÒì³££º\n" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import java.awt.Dimension;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
/*
|
||||
* do not call executeOperation yourself
|
||||
* use session.performOperation
|
||||
*/
|
||||
public abstract class KOperation2 extends AbstractAIFOperation {
|
||||
|
||||
protected AbstractAIFApplication app;
|
||||
protected TCSession session;
|
||||
protected ProgressBar pb;
|
||||
|
||||
public KOperation2(AbstractAIFApplication app, String opName) {
|
||||
super(opName, true);
|
||||
this.app = app;
|
||||
this.session = (TCSession) app.getSession();
|
||||
setSession(session);
|
||||
}
|
||||
|
||||
public abstract boolean init() throws Exception;
|
||||
|
||||
public abstract void execute() throws Exception;
|
||||
|
||||
@Override
|
||||
public void executeOperation() {
|
||||
pb = new ProgressBar(getCurrentDesktop(), new Dimension(250, 50), true);
|
||||
try {
|
||||
pb.showDialog();
|
||||
setStatus(KLocale.getString("initop.STATUS"));
|
||||
if (!init()) {
|
||||
pb.disposeDialog();
|
||||
return;
|
||||
}
|
||||
setStatus(KLocale.getString("exeop.STATUS"));
|
||||
execute();
|
||||
KUtil.setByPass(false);
|
||||
pb.disposeDialog();
|
||||
} catch (Exception e) {
|
||||
pb.disposeDialog();
|
||||
KUtil.setByPass(false);
|
||||
KUtil.error(getCurrentDesktop(), "·¢ÉúÒì³££º\n" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,130 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import com.teamcenter.rac.aif.AIFDesktop;
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ProgressBar extends AbstractAIFDialog {
|
||||
|
||||
private JLabel messageLabel;
|
||||
|
||||
private JProgressBar progressBar;
|
||||
|
||||
private boolean showBar = false;
|
||||
|
||||
public ProgressBar(AIFDesktop aifDesktop, Dimension dim, boolean showBar) {
|
||||
super(aifDesktop, false);
|
||||
this.showBar = showBar;
|
||||
initUI(dim);
|
||||
}
|
||||
|
||||
public ProgressBar(AbstractAIFDialog pd, Dimension dimension) {
|
||||
super(pd, false);
|
||||
initUI(dimension);
|
||||
}
|
||||
|
||||
public ProgressBar(Dimension dim, boolean showBar) {
|
||||
super(false);
|
||||
this.showBar = showBar;
|
||||
initUI(dim);
|
||||
}
|
||||
|
||||
public ProgressBar(AbstractAIFDialog pd, Dimension dimension, boolean showBar) {
|
||||
super(pd, false);
|
||||
this.showBar = showBar;
|
||||
initUI(dimension);
|
||||
}
|
||||
|
||||
private void initUI(Dimension dim) {
|
||||
this.setLayout(new BorderLayout(0, 0));
|
||||
this.setUndecorated(true);
|
||||
JPanel main = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints s = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 5, 2, 5), 0, 0);
|
||||
main.setBackground(new Color(53, 53, 53));
|
||||
if (dim != null) {
|
||||
this.setPreferredSize(dim);
|
||||
} else {
|
||||
this.setPreferredSize(new Dimension(200, 40));
|
||||
}
|
||||
messageLabel = new JLabel(" ");
|
||||
messageLabel.setForeground(Color.white);
|
||||
progressBar = new JProgressBar();
|
||||
progressBar.setForeground(Color.black);
|
||||
main.add(messageLabel, s);
|
||||
s.gridy++;
|
||||
s.insets = new Insets(0, 5, 2, 5);
|
||||
if (showBar) {
|
||||
main.add(progressBar, s);
|
||||
}
|
||||
this.add(BorderLayout.CENTER, main);
|
||||
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
|
||||
this.getRootPane().registerKeyboardAction(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
disposeDialog();
|
||||
}
|
||||
}, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
MouseAdapter ma = new MouseAdapter() {
|
||||
private Point pressPoint = new Point();
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
pressPoint = e.getPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
pressPoint = new Point();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
Rectangle r = ProgressBar.this.getBounds();
|
||||
setLocation(r.x + (e.getX() - pressPoint.x), r.y + (e.getY() - pressPoint.y));
|
||||
}
|
||||
};
|
||||
this.addMouseListener(ma);
|
||||
this.addMouseMotionListener(ma);
|
||||
}
|
||||
|
||||
public void setText(String message) {
|
||||
// System.out.println(message);
|
||||
messageLabel.setText(message);
|
||||
}
|
||||
|
||||
public void setText(String txt, int percent) {
|
||||
setText(txt);
|
||||
if (percent > progressBar.getMaximum()) {
|
||||
percent = progressBar.getMaximum();
|
||||
}
|
||||
progressBar.setValue(percent);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
disposeDialog();
|
||||
}
|
||||
|
||||
public void startProgress() {
|
||||
showDialog();
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
#
|
||||
#Thu Jan 21 10:28:16 CST 2021
|
||||
createscheduledeliverable.ERROR2=\u4E3A [%s] \u521B\u5EFA\u65F6\u95F4\u8868\u4EA4\u4ED8\u7269 [%s] \u5931\u8D25
|
||||
project=Project
|
||||
dsuidinpref.ERROR1=Error dataset uid set in preference\: %s
|
||||
valuenotinlov.ERROR2=LOV "%s" does not contain value\: %s
|
||||
writedata=Write Data
|
||||
querynotexist.ERROR1=Query not exist\: %s
|
||||
dialoginit.ERROR=Init Error
|
||||
preferror.ERROR1=Preference error\: %s
|
||||
norefindataset.ERROR1=Download file from dataset "%s" failed. No ref file.
|
||||
cancel=Cancel
|
||||
exeop.STATUS=Execute...
|
||||
initop.STATUS=Checking Data...
|
||||
noflowkey.ERROR=Missing key for flow number.
|
||||
wordfield_pagecount.NAME=\u9875\u6570
|
||||
nopropintype.ERROR2=Property is not defined in type "%s"\: %s.
|
||||
getflowno.ERROR1=Error getting new flow number for key\: %s
|
||||
formsave.ERRORTITLE=Error Saving Data
|
||||
wordfield_pageno.NAME=\u9875\u7801
|
||||
wordfield_totalpagenominus1.NAME=\u603B\u9875\u7801\u51CF\u4E00
|
||||
wordfield_totalpagecount.NAME=\u603B\u9875\u6570
|
||||
exceltitlenorelateinfo.ERROR=Title row in sheet does not have any relation info.
|
||||
selectProject=Select Project
|
||||
proplocationnotdefined.ERROR1=\u672A\u77E5\u5C5E\u6027\u4F4D\u7F6E\u201C%s\u201D\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E
|
||||
excelnotitle.ERROR=Can't find title row in excel sheet.
|
||||
loadCompFromUid.Error2=Error loading component "%s", UID \= "%s".
|
||||
uploadfilewhencheckout.ERROR1=Dataset "%s" is checked out. Upload file failed.
|
||||
wordfield_totalactualpagecountminus1.NAME=\u603B\u5B9E\u9645\u9875\u6570\u51CF\u4E00
|
||||
nodatainfile.ERROR1=No Data in File\: %s
|
||||
noexportdata.ERROR=\u6CA1\u6709\u6570\u636E\u53EF\u4EE5\u5BFC\u51FA
|
||||
notscheduleadmin.INFO=\u53EA\u6709\u534F\u8C03\u8005\u624D\u80FD\u64CD\u4F5C
|
||||
error=Error
|
||||
mergefile=Merge File...
|
||||
index=Index
|
||||
forminit.ERRORTITLE=Error Loading Rendering
|
||||
ok=OK
|
||||
wordfield_totalactualpagecount.NAME=\u603B\u5B9E\u9645\u9875\u6570
|
||||
requireprop.INFO1=\u8BF7\u586B\u5199\u5C5E\u6027\uFF1A%s
|
||||
functionnotavailable.INFO=\u6B64\u5BF9\u8C61\u4E0D\u53EF\u4F7F\u7528\u6B64\u529F\u80FD
|
||||
multiuserbyid.ERROR1=Find multiple users by id\: %s
|
||||
preparedata=Prepare Data
|
||||
dbconn.ERROR=Connect to database failed.
|
||||
typenotfound.ERROR1=Type not found\: %s
|
||||
filenotexist.ERROR1=File not exist\: %s
|
||||
wordfield_totalpagecountminus1.NAME=\u603B\u9875\u6570\u51CF\u4E00
|
||||
readdata=Read Data
|
||||
clearcache=Clear Cache
|
||||
exportsuccess.INFO=Export Complete.
|
||||
uploadfile=Upload File
|
||||
propnotdefinedintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u672A\u5B9A\u4E49\u5C5E\u6027\uFF1A%s
|
||||
foldernotexist.ERROR1=Folder not exist\: %s
|
||||
info=Info
|
||||
wordfield_totalpageno.NAME=\u603B\u9875\u7801
|
||||
multiuserbyname.ERROR1=Find multiple users by name\: %s
|
||||
exportopenfile.INFO=Export complete. Open file?
|
||||
prefnotconfiged.ERROR1=Prefernce not found\: %s
|
||||
export=Export
|
@ -0,0 +1,58 @@
|
||||
#
|
||||
#Thu Jan 21 10:28:16 CST 2021
|
||||
createscheduledeliverable.ERROR2=\u4E3A [%s] \u521B\u5EFA\u65F6\u95F4\u8868\u4EA4\u4ED8\u7269 [%s] \u5931\u8D25
|
||||
project=\u9879\u76EE
|
||||
dsuidinpref.ERROR1=\u8BF7\u68C0\u67E5\u9996\u9009\u9879<%s>\uFF0C\u901A\u8FC7\u914D\u7F6EUID\u672A\u627E\u5230\u6570\u636E\u96C6
|
||||
valuenotinlov.ERROR2=LOV "%s" \u4E2D\u672A\u5B9A\u4E49\u6570\u503C\uFF1A%s
|
||||
writedata=\u5199\u5165\u6570\u636E
|
||||
querynotexist.ERROR1=\u67E5\u8BE2\u4E0D\u5B58\u5728\uFF1A%s
|
||||
dialoginit.ERROR=\u521D\u59CB\u5316\u5F02\u5E38
|
||||
preferror.ERROR1=\u9996\u9009\u9879\u914D\u7F6E\u9519\u8BEF\uFF1A%s
|
||||
norefindataset.ERROR1=\u4ECE\u6570\u636E\u96C6\u201C%s\u201D\u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25\uFF0C\u6CA1\u6709\u627E\u5230\u5F15\u7528\u6587\u4EF6\u3002
|
||||
cancel=\u53D6\u6D88
|
||||
exeop.STATUS=\u6B63\u5728\u6267\u884C...
|
||||
initop.STATUS=\u68C0\u67E5\u6570\u636E...
|
||||
noflowkey.ERROR=\u6D41\u6C34\u7801\u952E\u503C\u4E0D\u53EF\u4E3A\u7A7A
|
||||
wordfield_pagecount.NAME=\u9875\u6570
|
||||
nopropintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u4E0D\u5B58\u5728\u5C5E\u6027\uFF1A%s
|
||||
getflowno.ERROR1=\u83B7\u53D6\u6D41\u6C34\u7801\u5931\u8D25\uFF1A%s
|
||||
formsave.ERRORTITLE=\u4FDD\u5B58\u6570\u636E\u51FA\u9519
|
||||
wordfield_pageno.NAME=\u9875\u7801
|
||||
wordfield_totalpagenominus1.NAME=\u603B\u9875\u7801\u51CF\u4E00
|
||||
wordfield_totalpagecount.NAME=\u603B\u9875\u6570
|
||||
exceltitlenorelateinfo.ERROR=\u6807\u9898\u884C\u6CA1\u6709\u89E3\u6790\u5230\u6620\u5C04\u5185\u5BB9
|
||||
selectProject=\u9009\u62E9\u9879\u76EE
|
||||
proplocationnotdefined.ERROR1=\u672A\u77E5\u5C5E\u6027\u4F4D\u7F6E\u201C%s\u201D\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E
|
||||
excelnotitle.ERROR=\u672A\u627E\u5230\u5DE5\u4F5C\u8868\u4E2D\u7684\u6807\u9898\u884C
|
||||
loadCompFromUid.Error2=\u52A0\u8F7D\u5BF9\u8C61\u201C%s\u201D\u5931\u8D25\uFF0CUID\=\u201C%s\u201D\u3002
|
||||
uploadfilewhencheckout.ERROR1=\u6570\u636E\u96C6\u201C%s\u201D\u5DF2\u7B7E\u51FA\uFF0C\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25\u3002\u8BF7\u7B7E\u5165\u540E\u518D\u8FDB\u884C\u64CD\u4F5C\u3002
|
||||
wordfield_totalactualpagecountminus1.NAME=\u603B\u5B9E\u9645\u9875\u6570\u51CF\u4E00
|
||||
nodatainfile.ERROR1=\u6587\u4EF6\u4E2D\u6CA1\u6709\u6570\u636E\uFF1A%s
|
||||
noexportdata.ERROR=\u6CA1\u6709\u6570\u636E\u53EF\u4EE5\u5BFC\u51FA
|
||||
notscheduleadmin.INFO=\u53EA\u6709\u534F\u8C03\u8005\u624D\u80FD\u64CD\u4F5C
|
||||
error=\u9519\u8BEF
|
||||
mergefile=\u5408\u5E76\u6587\u4EF6
|
||||
index=\u5E8F\u53F7
|
||||
forminit.ERRORTITLE=\u521D\u59CB\u5316\u754C\u9762\u5F02\u5E38
|
||||
ok=\u786E\u5B9A
|
||||
wordfield_totalactualpagecount.NAME=\u603B\u5B9E\u9645\u9875\u6570
|
||||
requireprop.INFO1=\u8BF7\u586B\u5199\u5C5E\u6027\uFF1A%s
|
||||
functionnotavailable.INFO=\u6B64\u5BF9\u8C61\u4E0D\u53EF\u4F7F\u7528\u6B64\u529F\u80FD
|
||||
multiuserbyid.ERROR1=\u901A\u8FC7id\u67E5\u8BE2\u5230\u591A\u4E2A\u7528\u6237\uFF1A%s
|
||||
preparedata=\u51C6\u5907\u6570\u636E
|
||||
dbconn.ERROR=\u8FDE\u63A5\u6570\u636E\u5E93\u5931\u8D25\u3002
|
||||
typenotfound.ERROR1=\u672A\u627E\u5230\u7C7B\u578B\uFF1A%s
|
||||
filenotexist.ERROR1=\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A%s
|
||||
wordfield_totalpagecountminus1.NAME=\u603B\u9875\u6570\u51CF\u4E00
|
||||
readdata=\u8BFB\u53D6\u6570\u636E
|
||||
clearcache=\u6E05\u7406\u7F13\u5B58
|
||||
exportsuccess.INFO=\u5BFC\u51FA\u5B8C\u6210
|
||||
uploadfile=\u4E0A\u4F20\u6587\u4EF6
|
||||
propnotdefinedintype.ERROR2=\u5BF9\u8C61\u7C7B\u578B\u201C%s\u201D\u672A\u5B9A\u4E49\u5C5E\u6027\uFF1A%s
|
||||
foldernotexist.ERROR1=\u6587\u4EF6\u5939\u4E0D\u5B58\u5728\uFF1A%s
|
||||
info=\u63D0\u793A
|
||||
wordfield_totalpageno.NAME=\u603B\u9875\u7801
|
||||
multiuserbyname.ERROR1=\u901A\u8FC7\u59D3\u540D\u67E5\u8BE2\u5230\u591A\u4E2A\u7528\u6237\uFF1A%s
|
||||
exportopenfile.INFO=\u5BFC\u51FA\u5B8C\u6210\uFF0C\u6253\u5F00\u6587\u4EF6\uFF1F
|
||||
prefnotconfiged.ERROR1=\u672A\u914D\u7F6E\u9996\u9009\u9879\uFF1A%s
|
||||
export=\u5BFC\u51FA
|
@ -0,0 +1,86 @@
|
||||
package com.connor.plm.sb02;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.RowSorter;
|
||||
import javax.swing.RowSorter.SortKey;
|
||||
import javax.swing.SortOrder;
|
||||
import javax.swing.table.TableRowSorter;
|
||||
|
||||
import antlr.collections.List;
|
||||
|
||||
public class ArrowIcon implements Icon {
|
||||
private final SortOrder sortOrder;
|
||||
private final int size;
|
||||
private final boolean ascending;
|
||||
public ArrowIcon(TableRowSorter<?> sorter, int column, boolean ascending) {
|
||||
this.ascending = ascending;
|
||||
this.size = 12;
|
||||
java.util.List<? extends SortKey> sortKeys = sorter.getSortKeys();
|
||||
if (sortKeys.size() > 0 && ((RowSorter.SortKey) sortKeys.get(0)).getColumn() == column) {
|
||||
this.sortOrder = ((RowSorter.SortKey) sortKeys.get(0)).getSortOrder();
|
||||
} else {
|
||||
this.sortOrder = SortOrder.ASCENDING;
|
||||
}
|
||||
}
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
g2.translate(x, y);
|
||||
if (ascending) {
|
||||
g2.rotate(Math.PI, size / 2.0, size / 2.0);
|
||||
}
|
||||
if (sortOrder == SortOrder.ASCENDING) {
|
||||
g2.draw(createUpTriangle(size));
|
||||
} else {
|
||||
g2.draw(createDownTriangle(size));
|
||||
}
|
||||
g2.dispose();
|
||||
}
|
||||
public int getIconWidth() {
|
||||
return size;
|
||||
}
|
||||
public int getIconHeight() {
|
||||
return size;
|
||||
}
|
||||
private Polygon createUpTriangle(int size) {
|
||||
Polygon triangle = new Polygon();
|
||||
triangle.addPoint(0, size);
|
||||
triangle.addPoint(size / 2, 0);
|
||||
triangle.addPoint(size, size);
|
||||
return triangle;
|
||||
}
|
||||
private Polygon createDownTriangle(int size) {
|
||||
Polygon triangle = new Polygon();
|
||||
triangle.addPoint(0, 0);
|
||||
triangle.addPoint(size, 0);
|
||||
triangle.addPoint(size / 2, size);
|
||||
return triangle;
|
||||
}
|
||||
}
|
||||
//±í¸ñÁÐÅÅÐòÀà
|
||||
class ColumnSorter implements Comparator<Object> {
|
||||
private final int col;
|
||||
private final boolean ascending;
|
||||
public ColumnSorter(int col, boolean ascending) {
|
||||
this.col = col;
|
||||
this.ascending = ascending;
|
||||
}
|
||||
@Override
|
||||
public int compare(Object a, Object b) {
|
||||
if (a instanceof Comparable && b instanceof Comparable) {
|
||||
if (ascending) {
|
||||
return ((Comparable) a).compareTo((Comparable) b);
|
||||
} else {
|
||||
return ((Comparable) b).compareTo((Comparable) a);
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.connor.plm.sb02;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class DateTest {
|
||||
public static void main(String[] args) {
|
||||
String ssString = "sss.sss";
|
||||
String[] split = ssString.split("\\.");
|
||||
System.out.println(split.length);
|
||||
String takeeffect = "";
|
||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-M-dd HH:mm");
|
||||
//LocalDateTime createDate = LocalDateTime.parse(create, fmt);
|
||||
LocalDateTime takeeffectDate = LocalDateTime.parse(takeeffect, fmt);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.connor.plm.sb02;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.connor.plm.KCommand;
|
||||
import com.connor.plm.KUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 派生更改请求ECR
|
||||
* @author kuma
|
||||
*
|
||||
*/
|
||||
public class DerivedChangeRequestCommand extends KCommand {
|
||||
|
||||
public DerivedChangeRequestCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
TCSession session = (TCSession) app.getSession();
|
||||
String preName = "Connor_Derive_CR";
|
||||
try {
|
||||
String[] prefVals = KUtil.getPrefVals(session, preName);
|
||||
InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
||||
StringBuffer newType = new StringBuffer();
|
||||
if (prefVals == null) {
|
||||
MessageBox.post(preName + "首选项未配置", "提示", MessageBox.INFORMATION);
|
||||
return;
|
||||
}
|
||||
ArrayList<ControlBean> beanList = new ArrayList<ControlBean>();
|
||||
KUtil.dealPref(prefVals, targetComponent, beanList, newType);
|
||||
System.out.println("newType:" + newType);
|
||||
if (newType.toString().isEmpty()) {
|
||||
// MessageBox.post(preName + "首选项配置有误,不存在新建的对象类型", "提示", MessageBox.INFORMATION);
|
||||
System.out.println("获取新建的对象类型失败,如果取消选择请忽略此条提醒!");
|
||||
return;
|
||||
}
|
||||
if (beanList.size() == 0) {
|
||||
MessageBox.post(preName + "首选项配置有误,不存在选中对象类型的配置", "提示", MessageBox.INFORMATION);
|
||||
return;
|
||||
}
|
||||
this.setRunnable(
|
||||
new DerivedChangeRequestDialog(app, beanList, newType, (TCComponentItemRevision) targetComponent));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.connor.plm.sb02;
|
||||
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
|
||||
import javafx.scene.control.TableColumn;
|
||||
|
||||
public class TableDemo extends JFrame{
|
||||
static JTable table;
|
||||
public TableDemo() {
|
||||
|
||||
setSize(600, 600);
|
||||
setLocationRelativeTo(null);
|
||||
|
||||
/*创建表格*/
|
||||
DefaultTableModel model = new DefaultTableModel();
|
||||
model.addColumn("编号",new Vector<Integer>());
|
||||
model.addColumn("书名", new Vector<String>());
|
||||
model.addColumn("作者", new Vector<String>());
|
||||
model.addColumn("是否选中", new Vector<String>());
|
||||
|
||||
table = new JTable(model);
|
||||
JScrollPane jp = new JScrollPane(table);
|
||||
for(int i = 0;i < 20 ;i ++) {
|
||||
model.addRow(new Vector<String>());
|
||||
}
|
||||
|
||||
|
||||
JTableHeader head = table.getTableHeader();
|
||||
//设置表头的大小
|
||||
head.setPreferredSize(new Dimension(head.getWidth(),30));
|
||||
//设置表头字体大小
|
||||
head.setFont(new Font("宋体",Font.BOLD,16));
|
||||
//设置表格的行宽
|
||||
table.setRowHeight(30);
|
||||
//设置表格行中字体大小
|
||||
table.setFont(new Font("宋体",Font.ROMAN_BASELINE,13));
|
||||
/*设置表格中的内容居中*/
|
||||
DefaultTableCellRenderer renderer=new DefaultTableCellRenderer();
|
||||
renderer.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
|
||||
table.setDefaultRenderer(Object.class, renderer);
|
||||
|
||||
/*定义复选框*/
|
||||
JCheckBox box = new JCheckBox();
|
||||
|
||||
/*getColumn()中数字填对应的第几行添加复选框*/
|
||||
table.getColumnModel().getColumn(3).setCellRenderer(new TableCellRenderer() {
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||
boolean isSelected, boolean hasFocus,int row, int column) {
|
||||
|
||||
|
||||
/*设置当复选框被选中整行被渲染*/
|
||||
box.setSelected(isSelected);
|
||||
|
||||
/*设置复选框在单元格中居中*/
|
||||
box.setHorizontalAlignment((int) 0.5f);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.add(jp);
|
||||
setVisible(true);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
TableDemo t = new TableDemo();
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.net.connor.ld.plm.ld06;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.RowSorter;
|
||||
import javax.swing.RowSorter.SortKey;
|
||||
import javax.swing.SortOrder;
|
||||
import javax.swing.table.TableRowSorter;
|
||||
|
||||
import antlr.collections.List;
|
||||
|
||||
public class ArrowIcon implements Icon {
|
||||
private final SortOrder sortOrder;
|
||||
private final int size;
|
||||
private final boolean ascending;
|
||||
public ArrowIcon(TableRowSorter<?> sorter, int column, boolean ascending) {
|
||||
this.ascending = ascending;
|
||||
this.size = 12;
|
||||
java.util.List<? extends SortKey> sortKeys = sorter.getSortKeys();
|
||||
if (sortKeys.size() > 0 && ((RowSorter.SortKey) sortKeys.get(0)).getColumn() == column) {
|
||||
this.sortOrder = ((RowSorter.SortKey) sortKeys.get(0)).getSortOrder();
|
||||
} else {
|
||||
this.sortOrder = SortOrder.ASCENDING;
|
||||
}
|
||||
}
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
g2.translate(x, y);
|
||||
if (ascending) {
|
||||
g2.rotate(Math.PI, size / 2.0, size / 2.0);
|
||||
}
|
||||
if (sortOrder == SortOrder.ASCENDING) {
|
||||
g2.draw(createUpTriangle(size));
|
||||
} else {
|
||||
g2.draw(createDownTriangle(size));
|
||||
}
|
||||
g2.dispose();
|
||||
}
|
||||
public int getIconWidth() {
|
||||
return size;
|
||||
}
|
||||
public int getIconHeight() {
|
||||
return size;
|
||||
}
|
||||
private Polygon createUpTriangle(int size) {
|
||||
Polygon triangle = new Polygon();
|
||||
triangle.addPoint(0, size);
|
||||
triangle.addPoint(size / 2, 0);
|
||||
triangle.addPoint(size, size);
|
||||
return triangle;
|
||||
}
|
||||
private Polygon createDownTriangle(int size) {
|
||||
Polygon triangle = new Polygon();
|
||||
triangle.addPoint(0, 0);
|
||||
triangle.addPoint(size, 0);
|
||||
triangle.addPoint(size / 2, size);
|
||||
return triangle;
|
||||
}
|
||||
}
|
||||
//表格列排序类
|
||||
class ColumnSorter implements Comparator<Object> {
|
||||
private final int col;
|
||||
private final boolean ascending;
|
||||
public ColumnSorter(int col, boolean ascending) {
|
||||
this.col = col;
|
||||
this.ascending = ascending;
|
||||
}
|
||||
@Override
|
||||
public int compare(Object a, Object b) {
|
||||
if (a instanceof Comparable && b instanceof Comparable) {
|
||||
if (ascending) {
|
||||
return ((Comparable) a).compareTo((Comparable) b);
|
||||
} else {
|
||||
return ((Comparable) b).compareTo((Comparable) a);
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.connor.plm;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
String value = null;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-dd HH:mm");
|
||||
value = sdf.format("");
|
||||
System.out.println(value);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue