📄 copytierstep3.java
字号:
model.showOnlyStereoTypes(new int[] { Constraint.TIME_SUBDIVISION, Constraint.INCLUDED_IN, Constraint.SYMBOLIC_SUBDIVISION, Constraint.SYMBOLIC_ASSOCIATION }); } else { // parent is symbolic subdivision or association model.showOnlyStereoTypes(new int[] { Constraint.SYMBOLIC_SUBDIVISION, Constraint.SYMBOLIC_ASSOCIATION }); } int col = model.findColumn(LinguisticTypeTableModel.NAME); for (int i = 0; i < model.getRowCount(); i++) { Object o = model.getValueAt(i, col); if (o instanceof String) { if (curType.getLinguisticTypeName().equals((String) o)) { selTypeName = (String) o; typeTable.setRowSelectionInterval(i, i); multiPane.setButtonEnabled(MultiStepPane.FINISH_BUTTON, true); break; } } } } /** * Never called. * * @see mpi.eudico.client.tool.viewer.enhanced.multistep.Step#enterStepBackward() */ public void enterStepBackward() { // n.a. } /** * Never called. * * @see mpi.eudico.client.tool.viewer.enhanced.multistep.Step#leaveStepForward() */ public boolean leaveStepForward() { // this is the last step, cannot go to next return false; } /** * Disable the finish button and allow a step back. * * @see mpi.eudico.client.tool.viewer.enhanced.multistep.Step#leaveStepBackward() */ public boolean leaveStepBackward() { multiPane.setButtonEnabled(MultiStepPane.FINISH_BUTTON, false); return true; } /** * No cleanup necessary. * * @see mpi.eudico.client.tool.viewer.enhanced.multistep.Step#cancelled() */ public void cancelled() { } /** * No cleanup necessary. * * @see mpi.eudico.client.tool.viewer.enhanced.multistep.Step#finished() */ public void finished() { } /** * This is the last step. When all conditions have been met create a * command and register as progress listener. Disable buttons. * * @return true if the process has been finished successfully * * @see mpi.eudico.client.tool.viewer.enhanced.multistep.Step#doFinish() */ public boolean doFinish() { // the actual reparenting/copying of the tier(s) // disable all buttons multiPane.setButtonEnabled(MultiStepPane.ALL_BUTTONS, false); //System.out.println("T: " + tierName + " P: " + newParentName + " LT: " + // selTypeName); // create a command passing the selected tier, the selected new parent and the // (new) linguistic type for selected tier // add this panel as progress listener adjustComponents(); if ((tierName != null) && (newParentName != null) && (selTypeName != null)) { Boolean includeDepTiers = Boolean.TRUE; if (copyMode) { com = (CopyTierCommand) ELANCommandFactory.createCommand(transcription, ELANCommandFactory.COPY_TIER); Object include = multiPane.getStepProperty("IncludeDepTiers"); if (include instanceof Boolean) { includeDepTiers = (Boolean) include; } } else { com = (CopyTierCommand) ELANCommandFactory.createCommand(transcription, ELANCommandFactory.REPARENT_TIER); } ((CopyTierCommand) com).addProgressListener(this); com.execute(transcription, new Object[] { tierName, newParentName, selTypeName, includeDepTiers }); return false; } else { progressLabel.setText("Illegal selection"); multiPane.setButtonEnabled(MultiStepPane.CANCEL_BUTTON, true); multiPane.setButtonEnabled(MultiStepPane.PREVIOUS_BUTTON, true); return false; } //System.out.println("T: " + tierName + " P: " + newParentName + " LT: " + selTypeName); //return false; } /** * Enable the finish button once a valid type has been selected. * * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) */ public void valueChanged(ListSelectionEvent lse) { if ((model != null) && lse.getValueIsAdjusting()) { int row = typeTable.getSelectedRow(); if (row > -1) { int col = model.findColumn(LinguisticTypeTableModel.NAME); String typeName = (String) model.getValueAt(row, col); for (int i = 0; i < types.size(); i++) { LinguisticType t = (LinguisticType) types.get(i); if (t.getLinguisticTypeName().equals(typeName)) { selTypeName = typeName; break; } } multiPane.setButtonEnabled(MultiStepPane.FINISH_BUTTON, true); } else { multiPane.setButtonEnabled(MultiStepPane.FINISH_BUTTON, false); } } } /** * Show the "add new linguistic type" dialog, then rescan the types to add * to the table. * * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { // store current selection, if any String typeName = null; if (typeTable.getRowCount() > 0) { int row = typeTable.getSelectedRow(); if (row > -1) { int col = model.findColumn(LinguisticTypeTableModel.NAME); typeName = (String) model.getValueAt(row, col); } } new EditTypeDialog(null, true, transcription, EditTypeDialog.ADD).setVisible(true); // update the table model for (int i = 0; i < types.size(); i++) { model.addLinguisticType((LinguisticType) types.get(i)); } if (typeName != null) { int col = model.findColumn(LinguisticTypeTableModel.NAME); String name = null; for (int i = 0; i < model.getRowCount(); i++) { name = (String) model.getValueAt(i, col); if (typeName.equals(name)) { typeTable.setRowSelectionInterval(i, i); multiPane.setButtonEnabled(MultiStepPane.FINISH_BUTTON, true); break; } } } } /** * @see mpi.eudico.client.annotator.util.ProgressListener#progressUpdated(java.lang.Object, * int, java.lang.String) */ public void progressUpdated(Object source, int percent, String message) { if ((progressLabel != null) && (message != null)) { progressLabel.setText(message); } if (percent < 0) { percent = 0; } else if (percent > 100) { percent = 100; } progressBar.setValue(percent); if (percent >= 100) { showMessageDialog("Operation completed"); if (com != null) { ((CopyTierCommand) com).removeProgressListener(this); } multiPane.close(); } } /** * @see mpi.eudico.client.annotator.util.ProgressListener#progressCompleted(java.lang.Object, * java.lang.String) */ public void progressCompleted(Object source, String message) { if (progressLabel != null) { progressLabel.setText(message); } showMessageDialog("Operation completed"); if (com != null) { ((CopyTierCommand) com).removeProgressListener(this); } multiPane.close(); } /** * @see mpi.eudico.client.annotator.util.ProgressListener#progressInterrupted(java.lang.Object, * java.lang.String) */ public void progressInterrupted(Object source, String message) { if (progressLabel != null) { progressLabel.setText(message); } // message dialog showWarningDialog("Operation interrupted: " + message); if (com != null) { ((CopyTierCommand) com).removeProgressListener(this); } multiPane.close(); } /** * Shows a warning/error dialog with the specified message string. * * @param message the message to display */ private void showWarningDialog(String message) { JOptionPane.showMessageDialog(this, message, ElanLocale.getString("Message.Warning"), JOptionPane.WARNING_MESSAGE); } /** * Shows a message dialog with the specified message string. * * @param message the message to display */ private void showMessageDialog(String message) { JOptionPane.showMessageDialog(this, message, null, JOptionPane.INFORMATION_MESSAGE); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -