📄 getinfomulti.java
字号:
if (mcp.yOff.length() > 0) { td.setOff(td.getXOff(), TextUtils.atof(mcp.yOff)); tdChanged = true; } } if (mcp.textRotation > 0) { switch (mcp.textRotation) { case 1: td.setRotation(TextDescriptor.Rotation.ROT0); break; case 2: td.setRotation(TextDescriptor.Rotation.ROT90); break; case 3: td.setRotation(TextDescriptor.Rotation.ROT180); break; case 4: td.setRotation(TextDescriptor.Rotation.ROT270); break; } tdChanged = true; } if (mcp.anchor >= 0) { TextDescriptor.Position newPosition = TextDescriptor.Position.getPositionAt(mcp.anchor); td.setPos(newPosition); tdChanged = true; } if (mcp.font != null) { td.setFaceWithActiveFont(mcp.font); tdChanged = true; } if (mcp.color > 0) { td.setColorWithEGraphicsIndex(mcp.color-1); // -1 because of DEFAULT COLOR tdChanged = true; } if (mcp.units > 0) { TextDescriptor.Unit un = TextDescriptor.Unit.getUnitAt(mcp.units); td.setUnit(un); tdChanged = true; } if (mcp.show > 0) { TextDescriptor.DispPos sh = TextDescriptor.DispPos.getShowStylesAt(mcp.show); td.setDispPart(sh); tdChanged = true; } if (mcp.bold == 1) { td.setBold(true); tdChanged = true; } else if (mcp.bold == 2) { td.setBold(false); tdChanged = true; } if (mcp.italic == 1) { td.setItalic(true); tdChanged = true; } else if (mcp.italic == 2) { td.setItalic(false); tdChanged = true; } if (mcp.underline == 1) { td.setUnderline(true); tdChanged = true; } else if (mcp.underline == 2) { td.setUnderline(false); tdChanged = true; } if (mcp.invisOutside == 1) { td.setInterior(true); tdChanged = true; } else if (mcp.invisOutside == 2) { td.setInterior(false); tdChanged = true; } // update text descriptor if it changed if (tdChanged) eobj.setTextDescriptor(descKey, TextDescriptor.newTextDescriptor(td)); } } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; removeOthers = new javax.swing.JButton(); apply = new javax.swing.JButton(); selectionCount = new javax.swing.JLabel(); listPane = new javax.swing.JScrollPane(); ok = new javax.swing.JButton(); remove = new javax.swing.JButton(); cancel = new javax.swing.JButton(); possibleChanges = new javax.swing.JScrollPane(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("Multi-Object Properties"); setName(""); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); removeOthers.setText("Remove Others"); removeOthers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeOthersActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.weightx = 0.33; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(removeOthers, gridBagConstraints); apply.setText("Apply"); apply.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { applyActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.weightx = 0.33; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(apply, gridBagConstraints); selectionCount.setText("0 selections:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 0); getContentPane().add(selectionCount, gridBagConstraints); listPane.setMinimumSize(new java.awt.Dimension(300, 200)); listPane.setPreferredSize(new java.awt.Dimension(300, 200)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(listPane, gridBagConstraints); ok.setText("OK"); ok.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(ok, gridBagConstraints); remove.setText("Remove"); remove.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.weightx = 0.33; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(remove, gridBagConstraints); cancel.setText("Cancel"); cancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 2; getContentPane().add(cancel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); getContentPane().add(possibleChanges, gridBagConstraints); pack(); } // </editor-fold>//GEN-END:initComponents private void cancelActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cancelActionPerformed {//GEN-HEADEREND:event_cancelActionPerformed closeDialog(null); }//GEN-LAST:event_cancelActionPerformed private void okActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_okActionPerformed {//GEN-HEADEREND:event_okActionPerformed applyActionPerformed(evt); closeDialog(null); }//GEN-LAST:event_okActionPerformed private void removeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_removeActionPerformed {//GEN-HEADEREND:event_removeActionPerformed int [] items = list.getSelectedIndices(); List<Integer> indices = new ArrayList<Integer>(); for(int i=0; i<items.length; i++) { if (items[i] < highlightList.size()) indices.add(new Integer(items[i])); else System.out.println("Trying to remove an invalid element: " + items[i]); } Collections.sort(indices, new Comparator<Integer>() { public int compare(Integer c1, Integer c2) { return c2.compareTo(c1); } }); for(Integer index : indices) { highlightList.remove(index.intValue()); } if (wnd != null) { Highlighter highlighter = wnd.getHighlighter(); highlighter.clear(); highlighter.setHighlightList(highlightList); highlighter.finished(); } }//GEN-LAST:event_removeActionPerformed private void applyActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_applyActionPerformed {//GEN-HEADEREND:event_applyActionPerformed // change nodes MultiChangeParameters mcp = new MultiChangeParameters(); mcp.anchor = mcp.units = mcp.show = -1; mcp.code = null; if (nodeList.size() > 0) { mcp.xPos = findComponentStringValue(ChangeType.CHANGEXPOS); mcp.yPos = findComponentStringValue(ChangeType.CHANGEYPOS); mcp.xSize = findComponentStringValue(ChangeType.CHANGEXSIZE); mcp.ySize = findComponentStringValue(ChangeType.CHANGEYSIZE); mcp.rot = findComponentStringValue(ChangeType.CHANGEROTATION); mcp.lr = findComponentIntValue(ChangeType.CHANGEMIRRORLR); mcp.ud = findComponentIntValue(ChangeType.CHANGEMIRRORUD); mcp.expanded = findComponentIntValue(ChangeType.CHANGEEXPANDED); mcp.easySelect = findComponentIntValue(ChangeType.CHANGEEASYSELECT); mcp.invisOutside = findComponentIntValue(ChangeType.CHANGEINVOUTSIDECELL); mcp.locked = findComponentIntValue(ChangeType.CHANGELOCKED); } if (arcList.size() > 0) { mcp.width = findComponentStringValue(ChangeType.CHANGEWIDTH); mcp.rigid = findComponentIntValue(ChangeType.CHANGERIGID); mcp.fixedangle = findComponentIntValue(ChangeType.CHANGEFIXANGLE); mcp.slidable = findComponentIntValue(ChangeType.CHANGESLIDABLE); mcp.extension = findComponentIntValue(ChangeType.CHANGEEXTENSION); mcp.directional = findComponentIntValue(ChangeType.CHANGEDIRECTION); mcp.negated = findComponentIntValue(ChangeType.CHANGENEGATION); mcp.easySelect = findComponentIntValue(ChangeType.CHANGEEASYSELECT); } if (exportList.size() > 0) { mcp.characteristics = (String)findComboBoxValue(ChangeType.CHANGECHARACTERISTICS); mcp.bodyOnly = findComponentIntValue(ChangeType.CHANGEBODYONLY); mcp.alwaysDrawn = findComponentIntValue(ChangeType.CHANGEALWAYSDRAWN); mcp.pointSize = findComponentStringValue(ChangeType.CHANGEPOINTSIZE); mcp.unitSize = findComponentStringValue(ChangeType.CHANGEUNITSIZE); mcp.xOff = findComponentStringValue(ChangeType.CHANGEXOFF); mcp.yOff = findComponentStringValue(ChangeType.CHANGEYOFF); mcp.textRotation = findComponentIntValue(ChangeType.CHANGETEXTROT); Object anValue = findComboBoxValue(ChangeType.CHANGEANCHOR); if (anValue instanceof TextDescriptor.Position) mcp.anchor = ((TextDescriptor.Position)anValue).getIndex(); mcp.font = (String)findComboBoxValue(ChangeType.CHANGEFONT); mcp.color = findComboBoxIndex(ChangeType.CHANGECOLOR); mcp.bold = findComponentIntValue(ChangeType.CHANGEBOLD); mcp.italic = findComponentIntValue(ChangeType.CHANGEITALIC); mcp.underline = findComponentIntValue(ChangeType.CHANGEUNDERLINE); mcp.invisOutside = findComponentIntValue(ChangeType.CHANGEINVOUTSIDECELL); } if (textList.size() > 0) { mcp.pointSize = findComponentStringValue(ChangeType.CHANGEPOINTSIZE); mcp.unitSize = findComponentStringValue(ChangeType.CHANGEUNITSIZE); mcp.xOff = findComponentStringValue(ChangeType.CHANGEXOFF); mcp.yOff = findComponentStringValue(ChangeType.CHANGEYOFF); mcp.textRotation = findComponentIntValue(ChangeType.CHANGETEXTROT); Object anValue = findComboBoxValue(ChangeType.CHANGEANCHOR); if (anValue instanceof TextDescriptor.Position) mcp.anchor = ((TextDescriptor.Position)anValue).getIndex(); mcp.font = (String)findComboBoxValue(ChangeType.CHANGEFONT); mcp.color = findComboBoxIndex(ChangeType.CHANGECOLOR); Object cdValue = findComboBoxValue(ChangeType.CHANGECODE); if (cdValue instanceof CodeExpression.Code) mcp.code = (CodeExpression.Code)cdValue; Object unValue = findComboBoxValue(ChangeType.CHANGEUNITS); if (unValue instanceof TextDescriptor.Unit) mcp.units = ((TextDescriptor.Unit)unValue).getIndex(); Object shValue = findComboBoxValue(ChangeType.CHANGESHOW); if (shValue instanceof TextDescriptor.DispPos) mcp.show = ((TextDescriptor.DispPos)shValue).getIndex(); mcp.bold = findComponentIntValue(ChangeType.CHANGEBOLD); mcp.italic = findComponentIntValue(ChangeType.CHANGEITALIC); mcp.underline = findComponentIntValue(ChangeType.CHANGEUNDERLINE); mcp.invisOutside = findComponentIntValue(ChangeType.CHANGEINVOUTSIDECELL); } if (annotationTextList.size() > 0) { mcp.pointSize = findComponentStringValue(ChangeType.CHANGEPOINTSIZE); mcp.unitSize = findComponentStringValue(ChangeType.CHANGEUNITSIZE); mcp.xPos = findComponentStringValue(ChangeType.CHANGEXPOS); mcp.yPos = findComponentStringValue(ChangeType.CHANGEYPOS); mcp.textRotation = findComponentIntValue(ChangeType.CHANGETEXTROT); Object anValue = findComboBoxValue(ChangeType.CHANGEANCHOR); if (anValue instanceof TextDescriptor.Position) mcp.anchor = ((TextDescriptor.Position)anValue).getIndex(); mcp.font = (String)findComboBoxValue(ChangeType.CHANGEFONT); mcp.color = findComboBoxIndex(ChangeType.CHANGECOLOR); Object cdValue = findComboBoxValue(ChangeType.CHANGECODE); if (cdValue instanceof CodeExpression.Code) mcp.code = (CodeExpression.Code)cdValue; Object unValue = findComboBoxValue(ChangeType.CHANGEUNITS); if (unValue instanceof TextDescriptor.Unit) mcp.units = ((TextDescriptor.Unit)unValue).getIndex(); Object shValue = findComboBoxValue(ChangeType.CHANGESHOW); if (shValue instanceof TextDescriptor.DispPos) mcp.show = ((TextDescriptor.DispPos)shValue).getIndex(); mcp.bold = findComponentIntValue(ChangeType.CHANGEBOLD); mcp.italic = findComponentIntValue(ChangeType.CHANGEITALIC); mcp.underline = findComponentIntValue(ChangeType.CHANGEUNDERLINE); mcp.invisOutside = findComponentIntValue(ChangeType.CHANGEINVOUTSIDECELL); } new MultiChange(mcp, nodeList, arcList, exportList, textList, annotationTextList); }//GEN-LAST:event_applyActionPerformed private void removeOthersActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_removeOthersActionPerformed {//GEN-HEADEREND:event_removeOthersActionPerformed int [] items = list.getSelectedIndices(); Set<Integer> keepIndices = new HashSet<Integer>(); for(int i=0; i<items.length; i++) keepIndices.add(new Integer(items[i])); int len = highlightList.size(); for(int i=len-1; i>=0; i--) { if (keepIndices.contains(new Integer(i))) continue; highlightList.remove(i); } if (wnd != null) { Highlighter highlighter = wnd.getHighlighter(); highlighter.clear(); highlighter.setHighlightList(highlightList); highlighter.finished(); } }//GEN-LAST:event_removeOthersActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog { super.closeDialog(); // clear the list of highlights so that this dialog doesn't trap memory highlightList.clear(); }//GEN-LAST:event_closeDialog // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton apply; private javax.swing.JButton cancel; private javax.swing.JScrollPane listPane; private javax.swing.JButton ok; private javax.swing.JScrollPane possibleChanges; private javax.swing.JButton remove; private javax.swing.JButton removeOthers; private javax.swing.JLabel selectionCount; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -