Merge pull request 'zouxk' (#4) from zouxk into master
Reviewed-on: http://plmserver.cn:3000/jd/com.connor.jd.plm/pulls/4main
commit
6a7ec175a1
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,52 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String fileName = "111.xlsx";
|
||||
String[] filename = fileName.split("\\.");
|
||||
System.out.println(fileName.lastIndexOf("."));
|
||||
String[] arr = new String[] { "0,1", "1,10", "0,100", "xx", "1,2" };
|
||||
Arrays.sort(arr, new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
if (o1.indexOf(",") == -1 || o2.indexOf(",") == -1) {
|
||||
return 0;
|
||||
}
|
||||
String[] temp1 = o1.split(",");
|
||||
String[] temp2 = o2.split(",");
|
||||
if (temp1[0].equals(temp2[0])) {
|
||||
return Integer.parseInt(temp1[1]) - Integer.parseInt(temp2[1]);
|
||||
} else {
|
||||
return Integer.parseInt(temp1[0]) - Integer.parseInt(temp2[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
System.out.println(Arrays.toString(arr));
|
||||
List<String> list1 = new ArrayList<String>();
|
||||
List<String> list2 = new ArrayList<String>();
|
||||
List<String> list3 = new ArrayList<String>();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (arr[i].indexOf(",") == -1 || "0".equals(arr[i].split(",")[0])) {
|
||||
list1.add(arr[i]);
|
||||
} else {
|
||||
list2.add(arr[i]);
|
||||
}
|
||||
}
|
||||
int maxLength = Math.max(list1.size(), list2.size());
|
||||
for (int i = 0; i < maxLength; i++) {
|
||||
if (i > list1.size() - 1) {
|
||||
list3.add("");
|
||||
list3.add(list2.get(i));
|
||||
} else if (i > list2.size() - 1) {
|
||||
list3.add(list1.get(i));
|
||||
list3.add("");
|
||||
} else {
|
||||
list3.add(list1.get(i));
|
||||
list3.add(list2.get(i));
|
||||
}
|
||||
}
|
||||
System.out.println(Arrays.toString(list3.toArray()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,96 @@
|
||||
package com.connor.jd.plm.action;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class AddHLBOMAction extends AbstractAIFAction {
|
||||
|
||||
private AbstractAIFApplication app;
|
||||
private TCSession session;
|
||||
|
||||
public AddHLBOMAction(AbstractAIFApplication arg0, String arg1) {
|
||||
super(arg0, arg1);
|
||||
// TODO Auto-generated constructor stub
|
||||
this.app = arg0;
|
||||
this.session = (TCSession) app.getSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
TCComponent target = (TCComponent) app.getTargetComponent();
|
||||
TCComponentItemRevision rev = null;
|
||||
if (target instanceof TCComponentItemRevision) {
|
||||
rev = (TCComponentItemRevision) target;
|
||||
} else if (target instanceof TCComponentItem) {
|
||||
try {
|
||||
rev = ((TCComponentItem) target).getLatestItemRevision();
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
TCComponent[] revs = rev.getRelatedComponents("JD2_HLBOM");
|
||||
String itemId = rev.getProperty("item_id");
|
||||
String itemName = rev.getProperty("object_name");
|
||||
TCComponentItem newItem = null;
|
||||
session.getUserService().call("bs_bypass", new Object[] { true });
|
||||
if (revs.length == 0) {
|
||||
newItem = rev.saveAsItem(itemId + "-1", null);
|
||||
} else {
|
||||
Arrays.sort(revs, new Comparator<TCComponent>() {
|
||||
@Override
|
||||
public int compare(TCComponent o1, TCComponent o2) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
return o1.getProperty("item_id").compareTo(o2.getProperty("item_id"));
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
String str = revs[revs.length - 1].getProperty("item_id");
|
||||
str = str.split("-")[1];
|
||||
newItem = rev.saveAsItem(itemId + "-" + (Integer.parseInt(str) + 1), null);
|
||||
}
|
||||
rev.add("JD2_HLBOM", newItem);
|
||||
TCComponentItemRevision newRev = newItem.getLatestItemRevision();
|
||||
TCComponent[] comps = newRev.getRelatedComponents("JD2_HLBOM");
|
||||
System.out.println(Arrays.toString(comps));
|
||||
newRev.cutOperation("JD2_HLBOM", comps);
|
||||
newRev.lock();
|
||||
newRev.setProperty("jd2_ishl", "1");
|
||||
newRev.save();
|
||||
newRev.unlock();
|
||||
|
||||
rev.refresh();
|
||||
MessageBox.post("´´½¨³É¹¦", "Ìáʾ", MessageBox.WARNING);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, e.getMessage(), "´íÎó", JOptionPane.ERROR_MESSAGE);
|
||||
} finally {
|
||||
try {
|
||||
session.getUserService().call("bs_bypass", new Object[] { false });
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.connor.jd.plm.action;
|
||||
|
||||
import com.connor.jd.plm.dialogs.BOMManagementFrame;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||
|
||||
public class BOMManagementAction extends AbstractAIFAction {
|
||||
|
||||
private AbstractAIFApplication app;
|
||||
|
||||
public BOMManagementAction(AbstractAIFApplication arg0, String arg1) {
|
||||
super(arg0, arg1);
|
||||
// TODO Auto-generated constructor stub
|
||||
this.app = arg0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
new BOMManagementFrame(app);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.connor.jd.plm.action;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
public class ExportBOMAction extends AbstractAIFAction {
|
||||
private AbstractAIFApplication app;
|
||||
private TCSession session;
|
||||
|
||||
public ExportBOMAction(AbstractAIFApplication arg0, String arg1) {
|
||||
super(arg0, arg1);
|
||||
this.app = arg0;
|
||||
this.session = (TCSession) app.getSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
TCComponent target = (TCComponent) app.getTargetComponent();
|
||||
TCComponentItemRevision rev;
|
||||
if (target instanceof TCComponentItemRevision) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.connor.jd.plm.beans;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
public class BOMExportBean {
|
||||
private String pid;// 父id
|
||||
private String prev;// 父版本
|
||||
private String cid;// 子id
|
||||
private String crev;// 子版本
|
||||
private String childCount;// 子数量
|
||||
private String childUnit;// 子单位
|
||||
private String HLCount;// 回料数量
|
||||
private String SN;// 编号
|
||||
|
||||
public BOMExportBean(String pid, String prev, String cid, String crev, String childCount, String childUnit,
|
||||
String HLCount, String SN) {
|
||||
super();
|
||||
this.pid = pid;
|
||||
this.prev = prev;
|
||||
this.cid = cid;
|
||||
this.crev = crev;
|
||||
this.childCount = childCount;
|
||||
this.childUnit = childUnit;
|
||||
this.HLCount = HLCount;
|
||||
this.SN = SN;
|
||||
}
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getPrev() {
|
||||
return prev;
|
||||
}
|
||||
|
||||
public void setPrev(String prev) {
|
||||
this.prev = prev;
|
||||
}
|
||||
|
||||
public String getCid() {
|
||||
return cid;
|
||||
}
|
||||
|
||||
public void setCid(String cid) {
|
||||
this.cid = cid;
|
||||
}
|
||||
|
||||
public String getCrev() {
|
||||
return crev;
|
||||
}
|
||||
|
||||
public void setCrev(String crev) {
|
||||
this.crev = crev;
|
||||
}
|
||||
|
||||
public String getChildCount() {
|
||||
return childCount;
|
||||
}
|
||||
|
||||
public void setChildCount(String childCount) {
|
||||
this.childCount = childCount;
|
||||
}
|
||||
|
||||
public String getChildUnit() {
|
||||
return childUnit;
|
||||
}
|
||||
|
||||
public void setChildUnit(String childUnit) {
|
||||
this.childUnit = childUnit;
|
||||
}
|
||||
|
||||
public String getHLCount() {
|
||||
return HLCount;
|
||||
}
|
||||
|
||||
public void setHLCount(String HLCount) {
|
||||
this.HLCount = HLCount;
|
||||
}
|
||||
|
||||
public String getSN() {
|
||||
return SN;
|
||||
}
|
||||
|
||||
public void setSN(String SN) {
|
||||
this.SN = SN;
|
||||
}
|
||||
|
||||
public int isNegative() {
|
||||
return StrUtil.isBlank(HLCount) ? 0 : Integer.parseInt(HLCount) < 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.connor.jd.plm.beans;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
|
||||
public class BOMManageTableBean {
|
||||
|
||||
private String parentString;
|
||||
private String childString;
|
||||
private TCComponentItemRevision parentRev;
|
||||
private TCComponentItemRevision childRev;
|
||||
private TCComponentBOMLine parentLine;
|
||||
private TCComponentBOMLine childLine;
|
||||
|
||||
public BOMManageTableBean(String parentString, String childString, TCComponentItemRevision parentRev,
|
||||
TCComponentItemRevision childRev, TCComponentBOMLine parentLine, TCComponentBOMLine childLine) {
|
||||
super();
|
||||
this.parentString = parentString;
|
||||
this.childString = childString;
|
||||
this.parentRev = parentRev;
|
||||
this.childRev = childRev;
|
||||
this.parentLine = parentLine;
|
||||
this.childLine = childLine;
|
||||
}
|
||||
|
||||
public String getParentString() {
|
||||
return parentString;
|
||||
}
|
||||
|
||||
public void setParentString(String parentString) {
|
||||
this.parentString = parentString;
|
||||
}
|
||||
|
||||
public String getChildString() {
|
||||
return childString;
|
||||
}
|
||||
|
||||
public void setChildString(String childString) {
|
||||
this.childString = childString;
|
||||
}
|
||||
|
||||
public TCComponentItemRevision getParentRev() {
|
||||
return parentRev;
|
||||
}
|
||||
|
||||
public void setParentRev(TCComponentItemRevision parentRev) {
|
||||
this.parentRev = parentRev;
|
||||
}
|
||||
|
||||
public TCComponentItemRevision getChildRev() {
|
||||
return childRev;
|
||||
}
|
||||
|
||||
public void setChildRev(TCComponentItemRevision childRev) {
|
||||
this.childRev = childRev;
|
||||
}
|
||||
|
||||
public TCComponentBOMLine getParentLine() {
|
||||
return parentLine;
|
||||
}
|
||||
|
||||
public void setParentLine(TCComponentBOMLine parentLine) {
|
||||
this.parentLine = parentLine;
|
||||
}
|
||||
|
||||
public TCComponentBOMLine getChildLine() {
|
||||
return childLine;
|
||||
}
|
||||
|
||||
public void setChildLine(TCComponentBOMLine childLine) {
|
||||
this.childLine = childLine;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.connor.jd.plm.beans;
|
||||
|
||||
public class CheckBoxPo {
|
||||
public Object value = null;
|
||||
public String text = null;
|
||||
|
||||
public CheckBoxPo() {
|
||||
}
|
||||
|
||||
public CheckBoxPo(String text, Object value) {
|
||||
this.value = value;
|
||||
this.text = text;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.connor.jd.plm.beans;
|
||||
|
||||
public class ClassPropBean {
|
||||
private int id;
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public ClassPropBean(int id, String name, String value) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.connor.jd.plm.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomLovBean {
|
||||
private List<CustomLovBean> sub = new ArrayList<CustomLovBean>();
|
||||
public String displayName = "";
|
||||
|
||||
public CustomLovBean(String displayName) {
|
||||
super();
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public CustomLovBean(String displayName, String[] subArray) {
|
||||
super();
|
||||
this.displayName = displayName;
|
||||
translateArrayToSub(subArray);
|
||||
}
|
||||
|
||||
public void translateArrayToSub(String[] subArray) {
|
||||
for (int i = 0; i < subArray.length; i++) {
|
||||
sub.add(new CustomLovBean(subArray[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public List<CustomLovBean> getSub() {
|
||||
return sub;
|
||||
}
|
||||
|
||||
public boolean hasChild() {
|
||||
return sub.size() != 0;
|
||||
}
|
||||
|
||||
public void addSub(CustomLovBean clb) {
|
||||
sub.add(clb);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.connor.jd.plm.beans;
|
||||
|
||||
public class ResultData {
|
||||
private boolean res;
|
||||
private String Message;
|
||||
private Object data;
|
||||
|
||||
public ResultData(boolean res, String message, Object data) {
|
||||
super();
|
||||
this.res = res;
|
||||
Message = message;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public boolean isRes() {
|
||||
return res;
|
||||
}
|
||||
|
||||
public void setRes(boolean res) {
|
||||
this.res = res;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return Message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package com.connor.jd.plm.dialog;
|
||||
|
||||
import javafx.scene.control.Dialog;
|
||||
|
||||
public class MsgDialog extends Dialog<String> {
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,14 @@
|
||||
package com.connor.jd.plm.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
|
||||
public class ColorMaterialBean {
|
||||
public List<String[]> colorMaterial = new ArrayList<String[]>();
|
||||
public Map<TCComponentItemRevision, Object[]> data = new HashMap<TCComponentItemRevision, Object[]>();
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.connor.jd.plm.dialogs;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
public class MyTreeCellRenderer extends DefaultTreeCellRenderer {
|
||||
private TCSession session;
|
||||
|
||||
public MyTreeCellRenderer(TCSession session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf,
|
||||
int row, boolean hasFocus) {
|
||||
|
||||
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
||||
|
||||
setText(value.toString());
|
||||
|
||||
if (sel) {
|
||||
setForeground(getTextSelectionColor());
|
||||
} else {
|
||||
setForeground(getTextNonSelectionColor());
|
||||
}
|
||||
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
|
||||
String str = node.toString();
|
||||
if (!"".equals(str)) {
|
||||
// session.search(arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.connor.jd.plm.handlers;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.jd.plm.action.AddHLBOMAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class AddHLBOMHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
// TODO Auto-generated method stub
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
AddHLBOMAction action = new AddHLBOMAction(app, "");
|
||||
new Thread(action).start();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.connor.jd.plm.handlers;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.jd.plm.action.BOMManagementAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class BOMManagementHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
// TODO Auto-generated method stub
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
BOMManagementAction action = new BOMManagementAction(app, "");
|
||||
new Thread(action).start();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.connor.jd.plm.handlers;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.jd.plm.action.ExportBOMAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class ExportBOMHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
ExportBOMAction action = new ExportBOMAction(app, "");
|
||||
new Thread(action).start();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.connor.jd.plm.table;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.DefaultCellEditor;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import com.connor.jd.plm.utils.DatePickerUtil;
|
||||
import com.eltima.components.ui.DatePicker;
|
||||
|
||||
public class DatePickerCellEditor extends DefaultCellEditor {
|
||||
|
||||
private DatePicker datePicker;
|
||||
|
||||
public DatePickerCellEditor(JTextField arg0) {
|
||||
super(arg0);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
|
||||
// TODO Auto-generated method stub
|
||||
datePicker = DatePickerUtil.getDatePicker(null);
|
||||
return datePicker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
// TODO Auto-generated method stub
|
||||
return datePicker.getText();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.connor.jd.plm.table;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
|
||||
public class MyCellRenderer extends DefaultTableCellRenderer {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
|
||||
int row, int column) {
|
||||
// TODO Auto-generated method stub
|
||||
if (value instanceof JCheckBox) {
|
||||
return (JCheckBox) value;
|
||||
}
|
||||
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.connor.jd.plm.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
import cn.hutool.db.ds.simple.SimpleDataSource;
|
||||
|
||||
public class DBUtil {
|
||||
|
||||
public static DataSource getDataSource(TCSession session) {
|
||||
|
||||
Map<String, String> settingMap = getDbSetting(session);
|
||||
String str = settingMap.get("url") + settingMap.get("user") + settingMap.get("pass");
|
||||
DataSource dataSource = new SimpleDataSource(settingMap.get("url"), settingMap.get("user"),
|
||||
settingMap.get("pass"));
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
private static Map<String, String> getDbSetting(TCSession session) {
|
||||
Map<String, String> settingMap = null;
|
||||
String[] dbSettings = JDMethodUtil.getPrefStrArray("jd2_db_settings", session);
|
||||
if (dbSettings.length != 3) {
|
||||
JOptionPane.showMessageDialog(null, "jd2_db_settings数据库连接配置错误", "错误", JOptionPane.ERROR);
|
||||
} else {
|
||||
settingMap = new HashMap<String, String>();
|
||||
for (String s : dbSettings) {
|
||||
settingMap.put(s.substring(0, s.indexOf(":")), s.substring(s.indexOf(":") + 1, s.length()));
|
||||
}
|
||||
}
|
||||
return settingMap;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.connor.jd.plm.utils;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.eltima.components.ui.DatePicker;
|
||||
|
||||
public class DatePickerUtil {
|
||||
public static void main(String[] args) {
|
||||
|
||||
JFrame f = new JFrame("LoL");
|
||||
f.setSize(400, 300);
|
||||
f.setLocation(200, 200);
|
||||
f.setLayout(null);
|
||||
|
||||
final DatePicker datepick;
|
||||
datepick = getDatePicker("yyyy-MM-dd hh:mm");
|
||||
|
||||
f.add(datepick);
|
||||
|
||||
JButton b = new JButton("获取时间");
|
||||
b.setBounds(137, 183, 100, 30);
|
||||
f.add(b);
|
||||
|
||||
b.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JOptionPane.showMessageDialog(f, "获取控件中的日期:" + datepick.getText());
|
||||
System.out.println(datepick.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
f.setVisible(true);
|
||||
}
|
||||
|
||||
public static DatePicker getDatePicker(String format) {
|
||||
final DatePicker datepick;
|
||||
// 格式 如果包含事件会出现时间选择的UI
|
||||
String DefaultFormat = "yyyy-MM-dd";
|
||||
// 当前时间
|
||||
Date date = new Date();
|
||||
// 字体
|
||||
Font font = new Font("Times New Roman", Font.BOLD, 14);
|
||||
|
||||
Dimension dimension = new Dimension(180, 24);
|
||||
|
||||
// int[] hilightDays = { 1, 3, 5, 7 };
|
||||
|
||||
// int[] disabledDays = { 4, 6, 5, 9 };
|
||||
|
||||
datepick = new DatePicker(date, format == null ? DefaultFormat : format, font, dimension);
|
||||
|
||||
datepick.setLocation(137, 83);
|
||||
datepick.setBounds(137, 83, 180, 24);
|
||||
// 设置一个月份中需要高亮显示的日子
|
||||
// datepick.setHightlightdays(hilightDays, Color.red);
|
||||
// 设置一个月份中不需要的日子,呈灰色显示
|
||||
// datepick.setDisableddays(disabledDays);
|
||||
// 设置国家
|
||||
datepick.setLocale(Locale.CHINA);
|
||||
// 设置时钟面板可见
|
||||
if (format != null) {
|
||||
datepick.setTimePanleVisible(true);
|
||||
} else {
|
||||
datepick.setTimePanleVisible(false);
|
||||
}
|
||||
return datepick;
|
||||
}
|
||||
}
|
@ -0,0 +1,286 @@
|
||||
package com.connor.jd.plm.utils;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dialog.ModalityType;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import com.connor.jd.plm.dialogs.BOMManagementFrame;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
public class DialogUtil {
|
||||
|
||||
public static TableMsg createTableMsg(String[] header, List<String[]> msgContent) {
|
||||
DefaultTableModel msgModel = new DefaultTableModel(header, 0) {
|
||||
@Override
|
||||
public boolean isCellEditable(int paramInt1, int paramInt2) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
};
|
||||
JTable msgTable = new JTable(msgModel);
|
||||
for (int columnIndex = 0; columnIndex < msgTable.getColumnCount(); columnIndex++) {
|
||||
msgTable.getColumnModel().getColumn(columnIndex).setMinWidth(100);
|
||||
}
|
||||
msgTable.setRowHeight(25);
|
||||
msgTable.setShowGrid(false);
|
||||
msgTable.setAutoscrolls(true);
|
||||
msgTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||
msgTable.getTableHeader().setReorderingAllowed(false);
|
||||
// msgTable.getTableHeader().setVisible(false);
|
||||
|
||||
for (String[] row : msgContent) {
|
||||
msgModel.addRow(row);
|
||||
}
|
||||
|
||||
msgTable.invalidate();
|
||||
msgTable.repaint();
|
||||
JScrollPane msgPanel = new JScrollPane(msgTable);
|
||||
msgPanel.setPreferredSize(new Dimension(header.length * 100, 200));
|
||||
msgPanel.setBorder(BorderFactory.createEmptyBorder());
|
||||
return new TableMsg(msgPanel, msgTable);
|
||||
}
|
||||
|
||||
public static JDialog createSearchAndSelectRevDialog(BOMManagementFrame frame, JTable paramTable,
|
||||
JCheckBox selectAll, JButton field) {
|
||||
JDialog dialog = new JDialog();
|
||||
dialog.setTitle("搜索零组件版本");
|
||||
dialog.setSize(520, 400);
|
||||
dialog.setResizable(true);
|
||||
dialog.setAutoRequestFocus(true);
|
||||
dialog.setAlwaysOnTop(true);
|
||||
dialog.setLocationRelativeTo(frame);
|
||||
dialog.setModalityType(ModalityType.APPLICATION_MODAL);
|
||||
|
||||
JPanel content = new JPanel();
|
||||
content.setLayout(null);
|
||||
content.setPreferredSize(new Dimension(520, 400));
|
||||
JLabel targetLabel = new JLabel("目标");
|
||||
targetLabel.setBounds(10, 10, 50, 25);
|
||||
JTextField targetText = new JTextField();
|
||||
targetText.setText("输入要搜索的零组件ID");
|
||||
targetText.setForeground(Color.GRAY);
|
||||
if (!"".equals(field.getText())) {
|
||||
targetText.setText(field.getText().substring(0, field.getText().indexOf("/")));
|
||||
targetText.setForeground(Color.BLACK);
|
||||
}
|
||||
targetText.setBounds(20, 50, 300, 25);
|
||||
JButton searchBtn = new JButton("查找");
|
||||
searchBtn.setBounds(380, 50, 100, 25);
|
||||
|
||||
String[] colDisplayNames = new String[] { "对象", "描述", "发布状态", "所有者", "组ID", "对象" };
|
||||
DefaultTableModel model = new DefaultTableModel(colDisplayNames, 0) {
|
||||
@Override
|
||||
public boolean isCellEditable(int paramInt1, int paramInt2) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
JTable table = new JTable(model);
|
||||
table.getColumnModel().getColumn(0).setMinWidth(100);
|
||||
table.getColumnModel().getColumn(1).setMinWidth(100);
|
||||
table.getColumnModel().getColumn(2).setMinWidth(100);
|
||||
table.getColumnModel().getColumn(3).setMinWidth(100);
|
||||
table.getColumnModel().getColumn(4).setMinWidth(60);
|
||||
table.getColumnModel().getColumn(4).setPreferredWidth(60);
|
||||
TableColumnModel tcm = table.getColumnModel();
|
||||
TableColumn tc = tcm.getColumn(5);
|
||||
tc.setWidth(0);
|
||||
tc.setPreferredWidth(0);
|
||||
tc.setMaxWidth(0);
|
||||
tc.setMinWidth(0);
|
||||
table.getTableHeader().getColumnModel().getColumn(5).setMaxWidth(0);
|
||||
table.getTableHeader().getColumnModel().getColumn(5).setMinWidth(0);
|
||||
table.setRowHeight(25);
|
||||
table.setAutoscrolls(true);
|
||||
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||
table.getTableHeader().setReorderingAllowed(false);
|
||||
JScrollPane jsp = new JScrollPane(table);
|
||||
jsp.setBounds(20, 100, 460, 200);
|
||||
|
||||
JButton okBtn = new JButton("确定");
|
||||
okBtn.setBounds(140, 320, 100, 25);
|
||||
JButton cancelBtn = new JButton("取消");
|
||||
cancelBtn.setBounds(260, 320, 100, 25);
|
||||
|
||||
targetText.addFocusListener(new FocusListener() {
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
if ("".equals(targetText.getText())) {
|
||||
targetText.setText("输入要搜索的零组件ID");
|
||||
targetText.setForeground(Color.GRAY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
if ("输入要搜索的零组件ID".equals(targetText.getText())) {
|
||||
targetText.setText("");
|
||||
targetText.setForeground(Color.BLACK);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
targetText.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyTyped(KeyEvent paramKeyEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
super.keyTyped(paramKeyEvent);
|
||||
if (paramKeyEvent.getKeyChar() == KeyEvent.VK_ENTER) {
|
||||
searchBtn.doClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
searchBtn.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
int cnt = model.getRowCount();
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
model.removeRow(0);
|
||||
}
|
||||
table.revalidate();
|
||||
table.repaint();
|
||||
String text = targetText.getText();
|
||||
System.out.println(text);
|
||||
if ("输入要搜索的零组件ID".equals(text)) {
|
||||
return;
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
TCSession session = (TCSession) AIFUtility.getCurrentApplication().getSession();
|
||||
TCComponentItem[] items = getTarget(content, text, session);
|
||||
if (items == null) {
|
||||
return;
|
||||
}
|
||||
List<Object[]> tableDataList = new ArrayList<Object[]>();
|
||||
for (TCComponentItem item : items) {
|
||||
try {
|
||||
TCComponent[] comps = item.getRelatedComponents("revision_list");
|
||||
for (TCComponent comp : comps) {
|
||||
String objetcString = comp.getProperty("object_string");
|
||||
TCComponent[] forms = comp.getRelatedComponents("IMAN_master_form_rev");
|
||||
String desc = "";
|
||||
if (forms.length > 0) {
|
||||
desc = forms[0].getProperty("jd2_wlms");
|
||||
}
|
||||
TCComponent[] statusArray = comp.getRelatedComponents("release_status_list");
|
||||
String status = "";
|
||||
if (statusArray != null && statusArray.length > 0) {
|
||||
status = statusArray[statusArray.length - 1].getProperty("object_name");
|
||||
}
|
||||
String owningUser = comp.getProperty("owning_user");
|
||||
String groupId = comp.getProperty("owning_group");
|
||||
tableDataList.add(new Object[] { objetcString, desc, status, owningUser, groupId, comp });
|
||||
}
|
||||
} catch (TCException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
for (Object[] rowData : tableDataList) {
|
||||
model.addRow(rowData);
|
||||
}
|
||||
table.revalidate();
|
||||
table.repaint();
|
||||
System.out.println("搜索结果已显示,用时" + (System.currentTimeMillis() - startTime) + "ms");
|
||||
}
|
||||
});
|
||||
|
||||
okBtn.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent paramActionEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
frame.okCallback(table, paramTable, selectAll, field);
|
||||
// dialog.setVisible(false);
|
||||
dialog.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
cancelBtn.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent paramActionEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
// dialog.setVisible(false);
|
||||
dialog.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
content.add(targetLabel);
|
||||
content.add(targetText);
|
||||
content.add(searchBtn);
|
||||
content.add(jsp);
|
||||
content.add(okBtn);
|
||||
content.add(cancelBtn);
|
||||
|
||||
dialog.add(content);
|
||||
dialog.setVisible(true);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private static TCComponentItem[] getTarget(Component parent, String itemId, TCSession session) {
|
||||
TCComponent[] comps = null;
|
||||
try {
|
||||
comps = session.search("Item ID", new String[] { "零组件 ID" }, new String[] { itemId });
|
||||
// TCComponentItemType type = new TCComponentItemType();
|
||||
// comps = type.findItems(itemId);
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
if (comps == null || comps.length == 0) {
|
||||
JOptionPane.showMessageDialog(parent, "无效的物料编码,请确认编码是否正确", "提示", JOptionPane.WARNING_MESSAGE);
|
||||
return null;
|
||||
}
|
||||
TCComponentItem[] items = new TCComponentItem[comps.length];
|
||||
for (int i = 0; i < comps.length; i++) {
|
||||
items[i] = (TCComponentItem) comps[i];
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public static class TableMsg {
|
||||
public JScrollPane panel;
|
||||
public JTable table;
|
||||
|
||||
public TableMsg(JScrollPane panel, JTable table) {
|
||||
super();
|
||||
this.panel = panel;
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.connor.jd.plm.utils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.aspose.cells.Cells;
|
||||
import com.aspose.cells.License;
|
||||
import com.aspose.cells.Workbook;
|
||||
import com.aspose.cells.WorksheetCollection;
|
||||
|
||||
public class ExcelInfoScanner {
|
||||
|
||||
public static Map<Integer, String> getClassPropOptions(String path, String nodeName) {
|
||||
Map<Integer, String> res = new HashMap<Integer, String>();
|
||||
try {
|
||||
getLicense();
|
||||
Workbook excel = new Workbook(path);
|
||||
WorksheetCollection wc = excel.getWorksheets();
|
||||
Cells cells = wc.get(0).getCells();
|
||||
for (int i = 0; i <= cells.getMaxDataRow(); i++) {
|
||||
if (cells.get(i, 0).getStringValue().equals(nodeName)) {
|
||||
res.put(cells.get(i, 1).getIntValue(), cells.get(i, 2).getStringValue());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static boolean getLicense() throws Exception {
|
||||
boolean result = false;
|
||||
try {
|
||||
InputStream is = com.aspose.cells.Cell.class.getResourceAsStream("/com/aspose/cells/resources/license.xml");
|
||||
License aposeLic = new License();
|
||||
aposeLic.setLicense(is);
|
||||
result = true;
|
||||
is.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(System.out);
|
||||
throw e;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.connor.jd.plm.utils;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JList;
|
||||
|
||||
import com.connor.jd.plm.beans.CheckBoxPo;
|
||||
|
||||
public class KeyValComboBox extends JComboBox {
|
||||
|
||||
public KeyValComboBox(Vector values) {
|
||||
super(values);
|
||||
rendererData(); // 渲染数据
|
||||
}
|
||||
|
||||
public void rendererData() {
|
||||
DefaultListCellRenderer render = new DefaultListCellRenderer() {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value instanceof CheckBoxPo) {
|
||||
CheckBoxPo po = (CheckBoxPo) value;
|
||||
this.setText(po.text);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
this.setRenderer(render);
|
||||
}
|
||||
|
||||
// 修改Combox中的数据
|
||||
public void updateData(Vector values) {
|
||||
setModel(new DefaultComboBoxModel(values));
|
||||
rendererData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object anObject) { // 选中text与传入的参数相同的项
|
||||
if (anObject != null) {
|
||||
if (anObject instanceof CheckBoxPo) {
|
||||
super.setSelectedItem(anObject);
|
||||
}
|
||||
if (anObject instanceof String) {
|
||||
for (int index = 0; index < getItemCount(); index++) {
|
||||
CheckBoxPo po = (CheckBoxPo) getItemAt(index);
|
||||
if (po.text.equals(anObject.toString())) {
|
||||
super.setSelectedIndex(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.setSelectedItem(anObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectedValue(Object anObject) { // 选中value与传入的参数相同的项
|
||||
if (anObject != null) {
|
||||
if (anObject instanceof CheckBoxPo) {
|
||||
super.setSelectedItem(anObject);
|
||||
}
|
||||
if (anObject instanceof String) {
|
||||
for (int index = 0; index < getItemCount(); index++) {
|
||||
CheckBoxPo po = (CheckBoxPo) getItemAt(index);
|
||||
if (po.value.equals(anObject.toString())) {
|
||||
super.setSelectedIndex(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.setSelectedItem(anObject);
|
||||
}
|
||||
}
|
||||
|
||||
// 获得选中项的键值
|
||||
public Object getSelectedValue() {
|
||||
if (getSelectedItem() instanceof CheckBoxPo) {
|
||||
CheckBoxPo po = (CheckBoxPo) getSelectedItem();
|
||||
return po.value;
|
||||
}
|
||||
return (getSelectedItem() != null) ? getSelectedItem().toString() : null;
|
||||
}
|
||||
|
||||
// 获得选中项的显示文本
|
||||
public String getSelectedText() {
|
||||
if (getSelectedItem() instanceof CheckBoxPo) {
|
||||
CheckBoxPo po = (CheckBoxPo) getSelectedItem();
|
||||
return po.text;
|
||||
}
|
||||
return (getSelectedItem() != null) ? getSelectedItem().toString() : null;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.connor.jd.plm.utils;
|
||||
|
||||
public class StringCreateUtil {
|
||||
public static String createBlank(int num) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (num > 0) {
|
||||
sb.append(" ");
|
||||
num--;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String createPoint(int num) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (num > 0) {
|
||||
sb.append(".");
|
||||
num--;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue