bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (result[1] != null) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,167
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,168
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,169
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[] { result[0] }; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,170
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement) el, editIndex); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement) el, editIndex); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,171
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,172
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,173
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,174
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
|
private Element[] split(Element el, int offset, int space) { // If we are at an element boundary, then return an empty array. if ((offset == el.getStartOffset() || offset == el.getEndOffset()) && space == 0 && el.isLeaf()) return new Element[2]; // If the element is an instance of BranchElement, then we recursivly // call this method to perform the split. Element[] res = new Element[2]; if (el instanceof BranchElement) { int index = el.getElementIndex(offset); Element child = el.getElement(index); Element[] result = split(child, offset, space); Element[] removed; Element[] added; Element[] newAdded; int count = el.getElementCount(); if (!(result[1] == null)) { // This is the case when we can keep the first element. if (result[0] == null) { removed = new Element[count - index - 1]; newAdded = new Element[count - index - 1]; added = new Element[]{}; } // This is the case when we may not keep the first element. else { removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; } Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(newAdded); res = new Element[]{ null, newPar }; } else { removed = new Element[count - index]; for (int i = index; i < count; ++i) removed[i - index] = el.getElement(i); added = new Element[0]; Edit edit = getEditForParagraphAndIndex((BranchElement)el, index); edit.addRemovedElements(removed); edit.addAddedElements(added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); Edit edit2 = getEditForParagraphAndIndex(newPar, 0); edit2.addAddedElements(removed); res = new Element[]{ null, newPar }; } } else if (el instanceof LeafElement) { BranchElement par = (BranchElement) el.getParentElement(); Element el1 = createLeafElement(par, el.getAttributes(), el.getStartOffset(), offset); Element el2 = createLeafElement(par, el.getAttributes(), offset + space, el.getEndOffset()); res = new Element[]{ el1, el2 }; } return res; }
| 5,175
|
public Element getParagraphElement(int position) { BranchElement root = (BranchElement) getDefaultRootElement(); int start = root.getStartOffset(); int end = root.getEndOffset(); if (position >= end) position = end - 1; else if (position < start) position = start; Element par = root.positionToElement(position); assert par != null : "The paragraph element must not be null"; return par; }
|
public Element getParagraphElement(int position) { BranchElement root = (BranchElement) getDefaultRootElement(); int start = root.getStartOffset(); int end = root.getEndOffset(); if (position >= end) position = end - 1; else if (position < start) position = start; Element par = root.positionToElement(position); assert par != null : "The paragraph element must not be null"; return par; }
| 5,176
|
public Element getParagraphElement(int position) { BranchElement root = (BranchElement) getDefaultRootElement(); int start = root.getStartOffset(); int end = root.getEndOffset(); if (position >= end) position = end - 1; else if (position < start) position = start; Element par = root.positionToElement(position); assert par != null : "The paragraph element must not be null"; return par; }
|
public Element getParagraphElement(int position) { BranchElement root = (BranchElement) getDefaultRootElement(); int start = root.getStartOffset(); int end = root.getEndOffset(); if (position >= end) position = end - 1; else if (position < start) position = start; Element par = root.positionToElement(position); assert par != null : "The paragraph element must not be null"; return par; }
| 5,177
|
short handleInsertAfterNewline(Vector specs, int offset, int endOffset, Element prevParagraph, Element paragraph, AttributeSet a) { if (prevParagraph.getParentElement() == paragraph.getParentElement()) { specs.add(new ElementSpec(a, ElementSpec.EndTagType)); specs.add(new ElementSpec(a, ElementSpec.StartTagType)); if (prevParagraph.getEndOffset() != endOffset) return ElementSpec.JoinFractureDirection; // If there is an Element after this one, use JoinNextDirection. Element parent = paragraph.getParentElement(); if (parent.getElementCount() > parent.getElementIndex(offset) + 1) return ElementSpec.JoinNextDirection; } else { // TODO: What to do here? } return ElementSpec.OriginateDirection; }
|
short handleInsertAfterNewline(Vector specs, int offset, int endOffset, Element prevParagraph, Element paragraph, AttributeSet a) { if (prevParagraph.getParentElement() == paragraph.getParentElement()) { specs.add(new ElementSpec(a, ElementSpec.EndTagType)); specs.add(new ElementSpec(a, ElementSpec.StartTagType)); if (prevParagraph.getEndOffset() != endOffset) return ElementSpec.JoinFractureDirection; // If there is an Element after this one, use JoinNextDirection. Element parent = paragraph.getParentElement(); if (parent.getElementCount() > (parent.getElementIndex(offset) + 1)) return ElementSpec.JoinNextDirection; } else { // TODO: What to do here? } return ElementSpec.OriginateDirection; }
| 5,178
|
short handleInsertAfterNewline(Vector specs, int offset, int endOffset, Element prevParagraph, Element paragraph, AttributeSet a) { if (prevParagraph.getParentElement() == paragraph.getParentElement()) { specs.add(new ElementSpec(a, ElementSpec.EndTagType)); specs.add(new ElementSpec(a, ElementSpec.StartTagType)); if (prevParagraph.getEndOffset() != endOffset) return ElementSpec.JoinFractureDirection; // If there is an Element after this one, use JoinNextDirection. Element parent = paragraph.getParentElement(); if (parent.getElementCount() > parent.getElementIndex(offset) + 1) return ElementSpec.JoinNextDirection; } else { // TODO: What to do here? } return ElementSpec.OriginateDirection; }
|
short handleInsertAfterNewline(Vector specs, int offset, int endOffset, Element prevParagraph, Element paragraph, AttributeSet a) { if (prevParagraph.getParentElement() == paragraph.getParentElement()) { specs.add(new ElementSpec(a, ElementSpec.EndTagType)); specs.add(new ElementSpec(a, ElementSpec.StartTagType)); if (prevParagraph.getEndOffset() != endOffset) return ElementSpec.JoinFractureDirection; // If there is an Element after this one, use JoinNextDirection. Element parent = paragraph.getParentElement(); if (parent.getElementCount() > parent.getElementIndex(offset) + 1) return ElementSpec.JoinNextDirection; } else { // TODO: What to do here? } return ElementSpec.OriginateDirection; }
| 5,179
|
protected void insert(int offset, ElementSpec[] data) throws BadLocationException { if (data == null || data.length == 0) return; try { // writeLock() and writeUnlock() should always be in a try/finally // block so that locking balance is guaranteed even if some // exception is thrown. writeLock(); // First we collect the content to be inserted. StringBuffer contentBuffer = new StringBuffer(); for (int i = 0; i < data.length; i++) { // Collect all inserts into one so we can get the correct // ElementEdit ElementSpec spec = data[i]; if (spec.getArray() != null && spec.getLength() > 0) contentBuffer.append(spec.getArray(), spec.getOffset(), spec.getLength()); } int length = contentBuffer.length(); // If there was no content inserted then exit early. if (length == 0) return; UndoableEdit edit = content.insertString(offset, contentBuffer.toString()); // Create the DocumentEvent with the ElementEdit added DefaultDocumentEvent ev = new DefaultDocumentEvent(offset, length, DocumentEvent.EventType.INSERT); ev.addEdit(edit); // Finally we must update the document structure and fire the insert // update event. buffer.insert(offset, length, data, ev); fireInsertUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
|
protected void insert(int offset, ElementSpec[] data) throws BadLocationException { if (data == null || data.length == 0) return; try { // writeLock() and writeUnlock() should always be in a try/finally // block so that locking balance is guaranteed even if some // exception is thrown. writeLock(); // First we collect the content to be inserted. StringBuffer contentBuffer = new StringBuffer(); for (int i = 0; i < data.length; i++) { // Collect all inserts into one so we can get the correct // ElementEdit ElementSpec spec = data[i]; if (spec.getArray() != null && spec.getLength() > 0) contentBuffer.append(spec.getArray(), spec.getOffset(), spec.getLength()); } int length = contentBuffer.length(); // If there was no content inserted then exit early. if (length == 0) return; UndoableEdit edit = content.insertString(offset, contentBuffer.toString()); // Create the DocumentEvent with the ElementEdit added DefaultDocumentEvent ev = new DefaultDocumentEvent(offset, length, DocumentEvent.EventType.INSERT); ev.addEdit(edit); // Finally we must update the document structure and fire the insert // update event. buffer.insert(offset, length, data, ev); fireInsertUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
| 5,180
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
| 5,181
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
| 5,182
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
| 5,183
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
|
protectedvoidinsertUpdate(DefaultDocumentEventev,AttributeSetattr){super.insertUpdate(ev,attr);//Iftheattributesetisnull,useanemptyattributeset.if(attr==null)attr=SimpleAttributeSet.EMPTY;intoffset=ev.getOffset();intlength=ev.getLength();intendOffset=offset+length;AttributeSetparagraphAttributes=getParagraphElement(endOffset).getAttributes();Segmenttxt=newSegment();try{getText(offset,length,txt);}catch(BadLocationExceptionex){AssertionErrorae=newAssertionError("Unexpectedbadlocation");ae.initCause(ex);throwae;}intlen=0;Vectorspecs=newVector();ElementSpecfinalStartTag=null;shortfinalStartDirection=ElementSpec.OriginateDirection;booleanprevCharWasNewline=false;Elementprev=getCharacterElement(offset);Elementnext=getCharacterElement(endOffset);ElementprevParagraph=getParagraphElement(offset);Elementparagraph=getParagraphElement(endOffset);intsegmentEnd=txt.offset+txt.count;//Checktoseeifwe'reinsertingimmediatelyafteranewline.if(offset>0){try{Strings=getText(offset-1,1);if(s.equals("\n")){finalStartDirection=handleInsertAfterNewline(specs,offset,endOffset,prevParagraph,paragraph,paragraphAttributes);prevCharWasNewline=true;//Findthefinalstarttagfromtheonesjustcreated.for(inti=0;i<specs.size();i++)if(((ElementSpec)specs.get(i)).getType()==ElementSpec.StartTagType)finalStartTag=(ElementSpec)specs.get(i);}}catch(BadLocationExceptionble){//Thisshouldn'thappen.AssertionErrorae=newAssertionError();ae.initCause(ble);throwae;}}for(inti=txt.offset;i<segmentEnd;++i){len++;if(txt.array[i]=='\n'){//AddtheElementSpecforthecontent.specs.add(newElementSpec(attr,ElementSpec.ContentType,len));//AddElementSpecsforthenewline.specs.add(newElementSpec(null,ElementSpec.EndTagType));finalStartTag=newElementSpec(paragraphAttributes,ElementSpec.StartTagType);specs.add(finalStartTag);len=0;}}//Createlastelementiflastcharacterhasn'tbeenanewline.if(len>0)specs.add(newElementSpec(attr,ElementSpec.ContentType,len));//SetthedirectionofthelastspecoftypeStartTagType.//Ifweareinsertingafteranewlinethenthisvaluecomesfrom//handleInsertAfterNewline.if(finalStartTag!=null){if(prevCharWasNewline)finalStartTag.setDirection(finalStartDirection);elseif(prevParagraph.getEndOffset()!=endOffset)finalStartTag.setDirection(ElementSpec.JoinFractureDirection);else{//IfthereisanelementAFTERthisone,thensetthe//directiontoJoinNextDirection.Elementparent=prevParagraph.getParentElement();intindex=parent.getElementIndex(offset);if(index+1<parent.getElementCount()&&!parent.getElement(index+1).isLeaf())finalStartTag.setDirection(ElementSpec.JoinNextDirection);}}//Ifweareatthelastindex,thencheckifwecouldprobablybe//joinedwiththenextelement.//Thismeans://-wemustbeaContentTag//-ifthereisanextElement,wemusthavethesameattributes//-ifthereisnonextElement,butonewillbecreated,//wemusthavethesameattributesasthehigher-levelrun.ElementSpeclast=(ElementSpec)specs.lastElement();if(last.getType()==ElementSpec.ContentType){ElementcurrentRun=prevParagraph.getElement(prevParagraph.getElementIndex(offset));if(currentRun.getEndOffset()==endOffset){if(endOffset<getLength()&&next.getAttributes().isEqual(attr)&&last.getType()==ElementSpec.ContentType)last.setDirection(ElementSpec.JoinNextDirection);}else{if(finalStartTag!=null&&finalStartTag.getDirection()==ElementSpec.JoinFractureDirection&¤tRun.getAttributes().isEqual(attr)){last.setDirection(ElementSpec.JoinNextDirection);}}}//Ifweareatthefirstnewelement,thencheckifitcouldbe//joinedwiththepreviouselement.ElementSpecfirst=(ElementSpec)specs.firstElement();if(prev.getAttributes().isEqual(attr)&&first.getType()==ElementSpec.ContentType)first.setDirection(ElementSpec.JoinPreviousDirection);ElementSpec[]elSpecs=(ElementSpec[])specs.toArray(newElementSpec[specs.size()]);buffer.insert(offset,length,elSpecs,ev);}
| 5,184
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
| 5,185
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
| 5,186
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
|
protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); // If the attribute set is null, use an empty attribute set. if (attr == null) attr = SimpleAttributeSet.EMPTY; int offset = ev.getOffset(); int length = ev.getLength(); int endOffset = offset + length; AttributeSet paragraphAttributes = getParagraphElement(endOffset).getAttributes(); Segment txt = new Segment(); try { getText(offset, length, txt); } catch (BadLocationException ex) { AssertionError ae = new AssertionError("Unexpected bad location"); ae.initCause(ex); throw ae; } int len = 0; Vector specs = new Vector(); ElementSpec finalStartTag = null; short finalStartDirection = ElementSpec.OriginateDirection; boolean prevCharWasNewline = false; Element prev = getCharacterElement(offset); Element next = getCharacterElement(endOffset); Element prevParagraph = getParagraphElement(offset); Element paragraph = getParagraphElement(endOffset); int segmentEnd = txt.offset + txt.count; // Check to see if we're inserting immediately after a newline. if (offset > 0) { try { String s = getText(offset - 1, 1); if (s.equals("\n")) { finalStartDirection = handleInsertAfterNewline(specs, offset, endOffset, prevParagraph, paragraph, paragraphAttributes); prevCharWasNewline = true; // Find the final start tag from the ones just created. for (int i = 0; i < specs.size(); i++) if (((ElementSpec) specs.get(i)).getType() == ElementSpec.StartTagType) finalStartTag = (ElementSpec)specs.get(i); } } catch (BadLocationException ble) { // This shouldn't happen. AssertionError ae = new AssertionError(); ae.initCause(ble); throw ae; } } for (int i = txt.offset; i < segmentEnd; ++i) { len++; if (txt.array[i] == '\n') { // Add the ElementSpec for the content. specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Add ElementSpecs for the newline. specs.add(new ElementSpec(null, ElementSpec.EndTagType)); finalStartTag = new ElementSpec(paragraphAttributes, ElementSpec.StartTagType); specs.add(finalStartTag); len = 0; } } // Create last element if last character hasn't been a newline. if (len > 0) specs.add(new ElementSpec(attr, ElementSpec.ContentType, len)); // Set the direction of the last spec of type StartTagType. // If we are inserting after a newline then this value comes from // handleInsertAfterNewline. if (finalStartTag != null) { if (prevCharWasNewline) finalStartTag.setDirection(finalStartDirection); else if (prevParagraph.getEndOffset() != endOffset) finalStartTag.setDirection(ElementSpec.JoinFractureDirection); else { // If there is an element AFTER this one, then set the // direction to JoinNextDirection. Element parent = prevParagraph.getParentElement(); int index = parent.getElementIndex(offset); if (index + 1 < parent.getElementCount() && !parent.getElement(index + 1).isLeaf()) finalStartTag.setDirection(ElementSpec.JoinNextDirection); } } // If we are at the last index, then check if we could probably be // joined with the next element. // This means: // - we must be a ContentTag // - if there is a next Element, we must have the same attributes // - if there is no next Element, but one will be created, // we must have the same attributes as the higher-level run. ElementSpec last = (ElementSpec) specs.lastElement(); if (last.getType() == ElementSpec.ContentType) { Element currentRun = prevParagraph.getElement(prevParagraph.getElementIndex(offset)); if (currentRun.getEndOffset() == endOffset) { if (endOffset < getLength() && next.getAttributes().isEqual(attr) && last.getType() == ElementSpec.ContentType) last.setDirection(ElementSpec.JoinNextDirection); } else { if (finalStartTag != null && finalStartTag.getDirection() == ElementSpec.JoinFractureDirection && currentRun.getAttributes().isEqual(attr)) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If we are at the first new element, then check if it could be // joined with the previous element. ElementSpec first = (ElementSpec) specs.firstElement(); if (prev.getAttributes().isEqual(attr) && first.getType() == ElementSpec.ContentType) first.setDirection(ElementSpec.JoinPreviousDirection); ElementSpec[] elSpecs = (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]); buffer.insert(offset, length, elSpecs, ev); }
| 5,187
|
public void setCharacterAttributes(int offset, int length, AttributeSet attributes, boolean replace) { // Exit early if length is 0, so no DocumentEvent is created or fired. if (length == 0) return; try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally block to make // sure that locking happens in a balanced manner. writeLock(); DefaultDocumentEvent ev = new DefaultDocumentEvent( offset, length, DocumentEvent.EventType.CHANGE); // Modify the element structure so that the interval begins at an // element // start and ends at an element end. buffer.change(offset, length, ev); Element root = getDefaultRootElement(); // Visit all paragraph elements within the specified interval int end = offset + length; Element curr; for (int pos = offset; pos < end; ) { // Get the CharacterElement at offset pos. curr = getCharacterElement(pos); if (pos == curr.getEndOffset()) break; MutableAttributeSet a = (MutableAttributeSet) curr.getAttributes(); ev.addEdit(new AttributeUndoableEdit(curr, attributes, replace)); // If replace is true, remove all the old attributes. if (replace) a.removeAttributes(a); // Add all the new attributes. a.addAttributes(attributes); // Increment pos so we can check the next CharacterElement. pos = curr.getEndOffset(); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
|
public void setCharacterAttributes(int offset, int length, AttributeSet attributes, boolean replace) { // Exit early if length is 0, so no DocumentEvent is created or fired. if (length == 0) return; try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally block to make // sure that locking happens in a balanced manner. writeLock(); DefaultDocumentEvent ev = new DefaultDocumentEvent( offset, length, DocumentEvent.EventType.CHANGE); // Modify the element structure so that the interval begins at an // element // start and ends at an element end. buffer.change(offset, length, ev); Element root = getDefaultRootElement(); // Visit all paragraph elements within the specified interval int end = offset + length; Element curr; for (int pos = offset; pos < end; ) { // Get the CharacterElement at offset pos. curr = getCharacterElement(pos); if (pos == curr.getEndOffset()) break; MutableAttributeSet a = (MutableAttributeSet) curr.getAttributes(); ev.addEdit(new AttributeUndoableEdit(curr, attributes, replace)); // If replace is true, remove all the old attributes. if (replace) a.removeAttributes(a); // Add all the new attributes. a.addAttributes(attributes); // Increment pos so we can check the next CharacterElement. pos = curr.getEndOffset(); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
| 5,188
|
public void setCharacterAttributes(int offset, int length, AttributeSet attributes, boolean replace) { // Exit early if length is 0, so no DocumentEvent is created or fired. if (length == 0) return; try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally block to make // sure that locking happens in a balanced manner. writeLock(); DefaultDocumentEvent ev = new DefaultDocumentEvent( offset, length, DocumentEvent.EventType.CHANGE); // Modify the element structure so that the interval begins at an // element // start and ends at an element end. buffer.change(offset, length, ev); Element root = getDefaultRootElement(); // Visit all paragraph elements within the specified interval int end = offset + length; Element curr; for (int pos = offset; pos < end; ) { // Get the CharacterElement at offset pos. curr = getCharacterElement(pos); if (pos == curr.getEndOffset()) break; MutableAttributeSet a = (MutableAttributeSet) curr.getAttributes(); ev.addEdit(new AttributeUndoableEdit(curr, attributes, replace)); // If replace is true, remove all the old attributes. if (replace) a.removeAttributes(a); // Add all the new attributes. a.addAttributes(attributes); // Increment pos so we can check the next CharacterElement. pos = curr.getEndOffset(); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
|
public void setCharacterAttributes(int offset, int length, AttributeSet attributes, boolean replace) { // Exit early if length is 0, so no DocumentEvent is created or fired. if (length == 0) return; try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally block to make // sure that locking happens in a balanced manner. writeLock(); DefaultDocumentEvent ev = new DefaultDocumentEvent( offset, length, DocumentEvent.EventType.CHANGE); // Modify the element structure so that the interval begins at an // element // start and ends at an element end. buffer.change(offset, length, ev); Element root = getDefaultRootElement(); // Visit all paragraph elements within the specified interval int end = offset + length; Element curr; for (int pos = offset; pos < end; ) { // Get the CharacterElement at offset pos. curr = getCharacterElement(pos); if (pos == curr.getEndOffset()) break; MutableAttributeSet a = (MutableAttributeSet) curr.getAttributes(); ev.addEdit(new AttributeUndoableEdit(curr, attributes, replace)); // If replace is true, remove all the old attributes. if (replace) a.removeAttributes(a); // Add all the new attributes. a.addAttributes(attributes); // Increment pos so we can check the next CharacterElement. pos = curr.getEndOffset(); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
| 5,189
|
public void setCharacterAttributes(int offset, int length, AttributeSet attributes, boolean replace) { // Exit early if length is 0, so no DocumentEvent is created or fired. if (length == 0) return; try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally block to make // sure that locking happens in a balanced manner. writeLock(); DefaultDocumentEvent ev = new DefaultDocumentEvent( offset, length, DocumentEvent.EventType.CHANGE); // Modify the element structure so that the interval begins at an // element // start and ends at an element end. buffer.change(offset, length, ev); Element root = getDefaultRootElement(); // Visit all paragraph elements within the specified interval int end = offset + length; Element curr; for (int pos = offset; pos < end; ) { // Get the CharacterElement at offset pos. curr = getCharacterElement(pos); if (pos == curr.getEndOffset()) break; MutableAttributeSet a = (MutableAttributeSet) curr.getAttributes(); ev.addEdit(new AttributeUndoableEdit(curr, attributes, replace)); // If replace is true, remove all the old attributes. if (replace) a.removeAttributes(a); // Add all the new attributes. a.addAttributes(attributes); // Increment pos so we can check the next CharacterElement. pos = curr.getEndOffset(); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
|
public void setCharacterAttributes(int offset, int length, AttributeSet attributes, boolean replace) { // Exit early if length is 0, so no DocumentEvent is created or fired. if (length == 0) return; try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally block to make // sure that locking happens in a balanced manner. writeLock(); DefaultDocumentEvent ev = new DefaultDocumentEvent( offset, length, DocumentEvent.EventType.CHANGE); // Modify the element structure so that the interval begins at an // element // start and ends at an element end. buffer.change(offset, length, ev); Element root = getDefaultRootElement(); // Visit all paragraph elements within the specified interval int end = offset + length; Element curr; for (int pos = offset; pos < end;) { // Get the CharacterElement at offset pos. curr = getCharacterElement(pos); if (pos == curr.getEndOffset()) break; MutableAttributeSet a = (MutableAttributeSet) curr.getAttributes(); ev.addEdit(new AttributeUndoableEdit(curr, attributes, replace)); // If replace is true, remove all the old attributes. if (replace) a.removeAttributes(a); // Add all the new attributes. a.addAttributes(attributes); // Increment pos so we can check the next CharacterElement. pos = curr.getEndOffset(); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
| 5,190
|
public void setLogicalStyle(int position, Style style) { Element el = getParagraphElement(position); // getParagraphElement doesn't return null but subclasses might so // we check for null here. if (el == null) return; try { writeLock(); if (el instanceof AbstractElement) { AbstractElement ael = (AbstractElement) el; ael.setResolveParent(style); int start = el.getStartOffset(); int end = el.getEndOffset(); DefaultDocumentEvent ev = new DefaultDocumentEvent (start, end - start, DocumentEvent.EventType.CHANGE); fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } else throw new AssertionError("paragraph elements are expected to be" + "instances of AbstractDocument.AbstractElement"); } finally { writeUnlock(); } }
|
public void setLogicalStyle(int position, Style style) { Element el = getParagraphElement(position); // getParagraphElement doesn't return null but subclasses might so // we check for null here. if (el == null) return; try { writeLock(); if (el instanceof AbstractElement) { AbstractElement ael = (AbstractElement) el; ael.setResolveParent(style); int start = el.getStartOffset(); int end = el.getEndOffset(); DefaultDocumentEvent ev = new DefaultDocumentEvent (start, end - start, DocumentEvent.EventType.CHANGE); fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } else throw new AssertionError("paragraph elements are expected to be" + "instances of AbstractDocument.AbstractElement"); } finally { writeUnlock(); } }
| 5,191
|
public void setLogicalStyle(int position, Style style) { Element el = getParagraphElement(position); // getParagraphElement doesn't return null but subclasses might so // we check for null here. if (el == null) return; try { writeLock(); if (el instanceof AbstractElement) { AbstractElement ael = (AbstractElement) el; ael.setResolveParent(style); int start = el.getStartOffset(); int end = el.getEndOffset(); DefaultDocumentEvent ev = new DefaultDocumentEvent (start, end - start, DocumentEvent.EventType.CHANGE); fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } else throw new AssertionError("paragraph elements are expected to be" + "instances of AbstractDocument.AbstractElement"); } finally { writeUnlock(); } }
|
public void setLogicalStyle(int position, Style style) { Element el = getParagraphElement(position); // getParagraphElement doesn't return null but subclasses might so // we check for null here. if (el == null) return; try { writeLock(); if (el instanceof AbstractElement) { AbstractElement ael = (AbstractElement) el; ael.setResolveParent(style); int start = el.getStartOffset(); int end = el.getEndOffset(); DefaultDocumentEvent ev = new DefaultDocumentEvent (start, end - start, DocumentEvent.EventType.CHANGE); fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } else throw new AssertionError("paragraph elements are expected to be" + "instances of AbstractDocument.AbstractElement"); } finally { writeUnlock(); } }
| 5,192
|
public void setParagraphAttributes(int offset, int length, AttributeSet attributes, boolean replace) { try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally blocks to make // sure that locking occurs in a balanced manner. writeLock(); // Create a DocumentEvent to use for changedUpdate(). DefaultDocumentEvent ev = new DefaultDocumentEvent ( offset, length, DocumentEvent.EventType.CHANGE); // Have to iterate through all the _paragraph_ elements that are // contained or partially contained in the interval // (offset, offset + length). Element rootElement = getDefaultRootElement(); int startElement = rootElement.getElementIndex(offset); int endElement = rootElement.getElementIndex(offset + length - 1); if (endElement < startElement) endElement = startElement; for (int i = startElement; i <= endElement; i++) { Element par = rootElement.getElement(i); MutableAttributeSet a = (MutableAttributeSet) par.getAttributes(); // Add the change to the DocumentEvent. ev.addEdit(new AttributeUndoableEdit(par, attributes, replace)); // If replace is true remove the old attributes. if (replace) a.removeAttributes(a); // Add the new attributes. a.addAttributes(attributes); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
|
public void setParagraphAttributes(int offset, int length, AttributeSet attributes, boolean replace) { try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally blocks to make // sure that locking occurs in a balanced manner. writeLock(); // Create a DocumentEvent to use for changedUpdate(). DefaultDocumentEvent ev = new DefaultDocumentEvent ( offset, length, DocumentEvent.EventType.CHANGE); // Have to iterate through all the _paragraph_ elements that are // contained or partially contained in the interval // (offset, offset + length). Element rootElement = getDefaultRootElement(); int startElement = rootElement.getElementIndex(offset); int endElement = rootElement.getElementIndex(offset + length - 1); if (endElement < startElement) endElement = startElement; for (int i = startElement; i <= endElement; i++) { Element par = rootElement.getElement(i); MutableAttributeSet a = (MutableAttributeSet) par.getAttributes(); // Add the change to the DocumentEvent. ev.addEdit(new AttributeUndoableEdit(par, attributes, replace)); // If replace is true remove the old attributes. if (replace) a.removeAttributes(a); // Add the new attributes. a.addAttributes(attributes); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
| 5,193
|
public void setParagraphAttributes(int offset, int length, AttributeSet attributes, boolean replace) { try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally blocks to make // sure that locking occurs in a balanced manner. writeLock(); // Create a DocumentEvent to use for changedUpdate(). DefaultDocumentEvent ev = new DefaultDocumentEvent ( offset, length, DocumentEvent.EventType.CHANGE); // Have to iterate through all the _paragraph_ elements that are // contained or partially contained in the interval // (offset, offset + length). Element rootElement = getDefaultRootElement(); int startElement = rootElement.getElementIndex(offset); int endElement = rootElement.getElementIndex(offset + length - 1); if (endElement < startElement) endElement = startElement; for (int i = startElement; i <= endElement; i++) { Element par = rootElement.getElement(i); MutableAttributeSet a = (MutableAttributeSet) par.getAttributes(); // Add the change to the DocumentEvent. ev.addEdit(new AttributeUndoableEdit(par, attributes, replace)); // If replace is true remove the old attributes. if (replace) a.removeAttributes(a); // Add the new attributes. a.addAttributes(attributes); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
|
public void setParagraphAttributes(int offset, int length, AttributeSet attributes, boolean replace) { try { // Must obtain a write lock for this method. writeLock() and // writeUnlock() should always be in try/finally blocks to make // sure that locking occurs in a balanced manner. writeLock(); // Create a DocumentEvent to use for changedUpdate(). DefaultDocumentEvent ev = new DefaultDocumentEvent ( offset, length, DocumentEvent.EventType.CHANGE); // Have to iterate through all the _paragraph_ elements that are // contained or partially contained in the interval // (offset, offset + length). Element rootElement = getDefaultRootElement(); int startElement = rootElement.getElementIndex(offset); int endElement = rootElement.getElementIndex(offset + length - 1); if (endElement < startElement) endElement = startElement; for (int i = startElement; i <= endElement; i++) { Element par = rootElement.getElement(i); MutableAttributeSet a = (MutableAttributeSet) par.getAttributes(); // Add the change to the DocumentEvent. ev.addEdit(new AttributeUndoableEdit(par, attributes, replace)); // If replace is true remove the old attributes. if (replace) a.removeAttributes(a); // Add the new attributes. a.addAttributes(attributes); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock(); } }
| 5,194
|
public void propertyChange(PropertyChangeEvent e) { // Only need to listen for indeterminate changes. // All other things are done on a repaint. if (e.getPropertyName().equals(JProgressBar.INDETERMINATE_CHANGED_PROPERTY)) if (((Boolean) e.getNewValue()).booleanValue()) startAnimationTimer(); else stopAnimationTimer(); else progressBar.repaint(); }
|
public void propertyChange(PropertyChangeEvent e) { // Only need to listen for indeterminate changes. // All other things are done on a repaint. if (e.getPropertyName().equals(JProgressBar.INDETERMINATE_CHANGED_PROPERTY)) if (((Boolean) e.getNewValue()).booleanValue()) startAnimationTimer(); else stopAnimationTimer(); else progressBar.repaint(); }
| 5,195
|
public void incrementAnimationIndex() { animationIndex++; //numFrames is like string length, it should be named numFrames or something if (animationIndex >= numFrames) animationIndex = 0; progressBar.repaint(); }
|
protected void incrementAnimationIndex() { animationIndex++; //numFrames is like string length, it should be named numFrames or something if (animationIndex >= numFrames) animationIndex = 0; progressBar.repaint(); }
| 5,196
|
public void propertyChange(PropertyChangeEvent e) { // Check for orientation changes. if (e.getPropertyName().equals(JSlider.ORIENTATION_CHANGED_PROPERTY)) recalculateIfOrientationChanged(); else if (e.getPropertyName().equals(JSlider.MODEL_CHANGED_PROPERTY)) { BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue(); oldModel.removeChangeListener(changeListener); slider.getModel().addChangeListener(changeListener); calculateThumbLocation(); } // elif the componentOrientation changes (this is a bound property, // just undocumented) we change leftToRightCache. In Sun's // implementation, the LTR cache changes on a repaint. This is strange // since there is no need to do so. We could events here and // update the cache. // elif the border/insets change, we recalculateInsets. slider.repaint(); }
|
public void propertyChange(PropertyChangeEvent e) { // Check for orientation changes. if (e.getPropertyName().equals(JSlider.ORIENTATION_CHANGED_PROPERTY)) recalculateIfOrientationChanged(); else if (e.getPropertyName().equals(JSlider.MODEL_CHANGED_PROPERTY)) { BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue(); oldModel.removeChangeListener(changeListener); slider.getModel().addChangeListener(changeListener); calculateThumbLocation(); } // elif the componentOrientation changes (this is a bound property, // just undocumented) we change leftToRightCache. In Sun's // implementation, the LTR cache changes on a repaint. This is strange // since there is no need to do so. We could events here and // update the cache. // elif the border/insets change, we recalculateInsets. slider.repaint(); }
| 5,198
|
public void propertyChange(PropertyChangeEvent e) { // Check for orientation changes. if (e.getPropertyName().equals(JSlider.ORIENTATION_CHANGED_PROPERTY)) recalculateIfOrientationChanged(); else if (e.getPropertyName().equals(JSlider.MODEL_CHANGED_PROPERTY)) { BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue(); oldModel.removeChangeListener(changeListener); slider.getModel().addChangeListener(changeListener); calculateThumbLocation(); } // elif the componentOrientation changes (this is a bound property, // just undocumented) we change leftToRightCache. In Sun's // implementation, the LTR cache changes on a repaint. This is strange // since there is no need to do so. We could events here and // update the cache. // elif the border/insets change, we recalculateInsets. slider.repaint(); }
|
public void propertyChange(PropertyChangeEvent e) { // Check for orientation changes. if (e.getPropertyName().equals(JSlider.ORIENTATION_CHANGED_PROPERTY)) recalculateIfOrientationChanged(); else if (e.getPropertyName().equals("model")) { BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue(); oldModel.removeChangeListener(changeListener); slider.getModel().addChangeListener(changeListener); calculateThumbLocation(); } // elif the componentOrientation changes (this is a bound property, // just undocumented) we change leftToRightCache. In Sun's // implementation, the LTR cache changes on a repaint. This is strange // since there is no need to do so. We could events here and // update the cache. // elif the border/insets change, we recalculateInsets. slider.repaint(); }
| 5,199
|
public BindException(String message) { super(message); }
|
public BindException() { super(message); }
| 5,200
|
public BindException(String message) { super(message); }
|
public BindException(String message) { }
| 5,201
|
public static Object copyObject(Object obj, javax.rmi.ORB orb) throws RemoteException { if(delegate != null) return delegate.copyObject(obj, orb); else return null; }
|
public static java.lang.Object copyObject(java.lang.Object object, ORB orb) throws RemoteException { if(delegate != null) return delegate.copyObject(obj, orb); else return null; }
| 5,202
|
public static Object copyObject(Object obj, javax.rmi.ORB orb) throws RemoteException { if(delegate != null) return delegate.copyObject(obj, orb); else return null; }
|
public static Object copyObject(Object obj, javax.rmi.ORB orb) throws RemoteException { if(delegate != null) return delegate.copyObject(obj, orb); else return null; }
| 5,203
|
public static Object[] copyObjects(Object obj[], javax.rmi.ORB orb) throws RemoteException { if(delegate != null) return delegate.copyObjects(obj, orb); else return null; }
|
public static java.lang.Object[] copyObjects(java.lang.Object[] object, ORB orb) throws RemoteException { if(delegate != null) return delegate.copyObjects(obj, orb); else return null; }
| 5,204
|
public static Object[] copyObjects(Object obj[], javax.rmi.ORB orb) throws RemoteException { if(delegate != null) return delegate.copyObjects(obj, orb); else return null; }
|
public static Object[] copyObjects(Object obj[], javax.rmi.ORB orb) throws RemoteException { if(delegate != null) return delegate.copyObjects(obj, orb); else return null; }
| 5,205
|
public static ValueHandler createValueHandler() { if(delegate != null) return delegate.createValueHandler(); else return null; }
|
public static ValueHandler createValueHandler() { return delegate.createValueHandler(); else return null; }
| 5,206
|
public static ValueHandler createValueHandler() { if(delegate != null) return delegate.createValueHandler(); else return null; }
|
public static ValueHandler createValueHandler() { if(delegate != null) return delegate.createValueHandler(); else return null; }
| 5,207
|
public static String getCodebase(Class clz) { if(delegate != null) return delegate.getCodebase(clz); else return null; }
|
public static String getCodebase(Class clz) { return delegate.getCodebase(clz); else return null; }
| 5,208
|
public static String getCodebase(Class clz) { if(delegate != null) return delegate.getCodebase(clz); else return null; }
|
public static String getCodebase(Class clz) { if(delegate != null) return delegate.getCodebase(clz); else return null; }
| 5,209
|
public static Tie getTie(Remote target) { if(delegate != null) return delegate.getTie(target); else return null; }
|
public static Tie getTie(Remote target) { return delegate.getTie(target); else return null; }
| 5,210
|
public static Tie getTie(Remote target) { if(delegate != null) return delegate.getTie(target); else return null; }
|
public static Tie getTie(Remote target) { if(delegate != null) return delegate.getTie(target); else return null; }
| 5,211
|
public static boolean isLocal(Stub stub) throws RemoteException { if(delegate != null) return delegate.isLocal(stub); else return false; }
|
public static boolean isLocal(Stub stub) throws RemoteException { return delegate.isLocal(stub); else return false; }
| 5,212
|
public static boolean isLocal(Stub stub) throws RemoteException { if(delegate != null) return delegate.isLocal(stub); else return false; }
|
public static boolean isLocal(Stub stub) throws RemoteException { if(delegate != null) return delegate.isLocal(stub); else return false; }
| 5,213
|
public static RemoteException mapSystemException(SystemException ex) { if(delegate != null) return delegate.mapSystemException(ex); else return null; }
|
public static RemoteException mapSystemException(SystemException ex) { return delegate.mapSystemException(ex); else return null; }
| 5,214
|
public static RemoteException mapSystemException(SystemException ex) { if(delegate != null) return delegate.mapSystemException(ex); else return null; }
|
public static RemoteException mapSystemException(SystemException ex) { if(delegate != null) return delegate.mapSystemException(ex); else return null; }
| 5,215
|
public static Object readAny(InputStream in) { if(delegate != null) return delegate.readAny(in); else return null; }
|
public static java.lang.Object readAny(InputStream input) { if(delegate != null) return delegate.readAny(in); else return null; }
| 5,216
|
public static Object readAny(InputStream in) { if(delegate != null) return delegate.readAny(in); else return null; }
|
public static Object readAny(InputStream in) { if(delegate != null) return delegate.readAny(in); else return null; }
| 5,217
|
public static void registerTarget(Tie tie, Remote target) { if(delegate != null) delegate.registerTarget(tie, target); }
|
public static void registerTarget(Tie tie, Remote target) { delegate.registerTarget(tie, target); }
| 5,218
|
public static void unexportObject(Remote target) { if(delegate != null) delegate.unexportObject(target); }
|
public static void unexportObject(Remote target) { delegate.unexportObject(target); }
| 5,219
|
public static RemoteException wrapException(Throwable orig) { if(delegate != null) return delegate.wrapException(orig); else return null; }
|
public static RemoteException wrapException(Throwable exception) { if(delegate != null) return delegate.wrapException(orig); else return null; }
| 5,220
|
public static RemoteException wrapException(Throwable orig) { if(delegate != null) return delegate.wrapException(orig); else return null; }
|
public static RemoteException wrapException(Throwable orig) { if(delegate != null) return delegate.wrapException(orig); else return null; }
| 5,221
|
public static void writeAbstractObject(OutputStream out, Object obj) { if(delegate != null) delegate.writeAbstractObject(out, obj); }
|
public static void writeAbstractObject(OutputStream output, java.lang.Object object) { if(delegate != null) delegate.writeAbstractObject(out, obj); }
| 5,222
|
public static void writeAbstractObject(OutputStream out, Object obj) { if(delegate != null) delegate.writeAbstractObject(out, obj); }
|
public static void writeAbstractObject(OutputStream out, Object obj) { if(delegate != null) delegate.writeAbstractObject(out, obj); }
| 5,223
|
public static void writeAny(OutputStream out, Object obj) { if(delegate != null) delegate.writeAny(out, obj); }
|
public static void writeAny(OutputStream output, java.lang.Object object) { if(delegate != null) delegate.writeAny(out, obj); }
| 5,224
|
public static void writeAny(OutputStream out, Object obj) { if(delegate != null) delegate.writeAny(out, obj); }
|
public static void writeAny(OutputStream out, Object obj) { if(delegate != null) delegate.writeAny(out, obj); }
| 5,225
|
public static void writeRemoteObject(OutputStream out, Object obj) { if(delegate != null) delegate.writeRemoteObject(out, obj); }
|
public static void writeRemoteObject(OutputStream output, java.lang.Object object) { if(delegate != null) delegate.writeRemoteObject(out, obj); }
| 5,226
|
public static void writeRemoteObject(OutputStream out, Object obj) { if(delegate != null) delegate.writeRemoteObject(out, obj); }
|
public static void writeRemoteObject(OutputStream out, Object obj) { if(delegate != null) delegate.writeRemoteObject(out, obj); }
| 5,227
|
Object copyObject(Object obj, javax.rmi.ORB orb) throws RemoteException;
|
Object copyObject(Object obj, javax.rmi.ORB orb) throws RemoteException;
| 5,228
|
Object[] copyObjects(Object obj[], javax.rmi.ORB orb) throws RemoteException;
|
Object[] copyObjects(Object obj[], javax.rmi.ORB orb) throws RemoteException;
| 5,229
|
Object readAny(InputStream in);
|
Object readAny(InputStream in);
| 5,230
|
void writeAbstractObject(OutputStream out, Object obj);
|
void writeAbstractObject(OutputStream out, Object obj);
| 5,231
|
void writeAny(OutputStream out, Object obj);
|
void writeAny(OutputStream out, Object obj);
| 5,232
|
void writeRemoteObject(OutputStream out, Object obj);
|
void writeRemoteObject(OutputStream out, Object obj);
| 5,233
|
public abstract void copyArea(int x, int y, int width, int height, int dx, int dy);
|
public abstract void copyArea(int x, int y, int width, int height, int dx, int dy);
| 5,234
|
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { draw(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN)); }
|
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { draw(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN)); }
| 5,235
|
public void drawGlyphVector(GlyphVector g, float x, float y) { // TODO Auto-generated method stub }
|
public void drawGlyphVector(GlyphVector g, float x, float y) { // TODO Auto-generated method stub }
| 5,236
|
public final void drawPolyline(int[] xPoints, int[] yPoints, int npoints) { final GeneralPath path = new GeneralPath(GeneralPath.WIND_NON_ZERO, npoints * 2); path.moveTo(xPoints[0], yPoints[0]); for (int i = 1; i < npoints; i++) { path.lineTo(xPoints[i], yPoints[i]); } draw(path); }
|
public final void drawPolyline(int[] xPoints, int[] yPoints, int npoints) { final GeneralPath path = new GeneralPath(GeneralPath.WIND_NON_ZERO, npoints * 2); path.moveTo(xPoints[0], yPoints[0]); for (int i = 1; i < npoints; i++) { path.lineTo(xPoints[i], yPoints[i]); } draw(path); }
| 5,237
|
public final void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { draw(new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight)); }
|
public final void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { draw(new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight)); }
| 5,238
|
public void drawString(AttributedCharacterIterator iterator, float x, float y) { // TODO Auto-generated method stub }
|
public void drawString(AttributedCharacterIterator iterator, float x, float y) { // TODO Auto-generated method stub }
| 5,239
|
public final void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { fill(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN)); }
|
public final void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { fill(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN)); }
| 5,240
|
public final void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { fill(new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight)); }
|
public final void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { fill(new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight)); }
| 5,241
|
public FontRenderContext getFontRenderContext() { throw new RuntimeException("Not implemented yet"); }
|
public FontRenderContext getFontRenderContext() { throw new RuntimeException("Not implemented yet"); }
| 5,242
|
public void transform(AffineTransform Tx) { transform.concatenate(Tx); }
|
public void transform(AffineTransform Tx) { transform.concatenate(Tx); }
| 5,243
|
protected void decrLayer(Integer layer) { int sz = 0; if (layers.containsKey (layer)) sz = ((Integer)(layers.get (layer))).intValue () - 1; layers.put (layer, new Integer(sz)); }
|
private void decrLayer(Integer layer) { int sz = 0; if (layers.containsKey (layer)) sz = ((Integer)(layers.get (layer))).intValue () - 1; layers.put (layer, new Integer(sz)); }
| 5,244
|
protected void incrLayer(Integer layer) { int sz = 1; if (layers.containsKey (layer)) sz += ((Integer)(layers.get (layer))).intValue (); layers.put (layer, new Integer(sz)); }
|
private void incrLayer(Integer layer) { int sz = 1; if (layers.containsKey (layer)) sz += ((Integer)(layers.get (layer))).intValue (); layers.put (layer, new Integer(sz)); }
| 5,245
|
protected int[] layerToRange (Integer layer) { int[] ret = new int[2]; ret[1] = getComponents ().length; Iterator i = layers.entrySet ().iterator (); while (i.hasNext()) { Map.Entry pair = (Map.Entry) i.next(); Integer layerNum = (Integer) pair.getKey (); Integer layerSz = (Integer) pair.getValue (); if (layerNum.intValue() == layer.intValue()) { ret[0] = ret[1] - layerSz.intValue (); return ret; } else { ret[1] -= layerSz.intValue (); } } // should have found the layer during iteration throw new IllegalArgumentException (); }
|
private int[] layerToRange (Integer layer) { int[] ret = new int[2]; ret[1] = getComponents ().length; Iterator i = layers.entrySet ().iterator (); while (i.hasNext()) { Map.Entry pair = (Map.Entry) i.next(); Integer layerNum = (Integer) pair.getKey (); Integer layerSz = (Integer) pair.getValue (); if (layerNum.intValue() == layer.intValue()) { ret[0] = ret[1] - layerSz.intValue (); return ret; } else { ret[1] -= layerSz.intValue (); } } // should have found the layer during iteration throw new IllegalArgumentException (); }
| 5,246
|
public Dimension minimumLayoutSize(Container parent) { // Sun's implementation simply throws a ClassCastException if // parent is no JScrollPane, so do we. JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getMinimumSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getMinimumSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getMinimumSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getMinimumSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getMinimumSize().height; Insets i = sc.getInsets(); return new Dimension(width + i.left + i.right, height + i.top + i.bottom); }
|
public Dimension minimumLayoutSize(Container parent) { // Sun's implementation simply throws a ClassCastException if // parent is no JScrollPane, so do we. JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getMinimumSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getMinimumSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getMinimumSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getMinimumSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getMinimumSize().height; Insets i = sc.getInsets(); return new Dimension(width + i.left + i.right, height + i.top + i.bottom); }
| 5,247
|
public Dimension minimumLayoutSize(Container parent) { // Sun's implementation simply throws a ClassCastException if // parent is no JScrollPane, so do we. JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getMinimumSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getMinimumSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getMinimumSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getMinimumSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getMinimumSize().height; Insets i = sc.getInsets(); return new Dimension(width + i.left + i.right, height + i.top + i.bottom); }
|
public Dimension minimumLayoutSize(Container parent) { // Sun's implementation simply throws a ClassCastException if // parent is no JScrollPane, so do we. JScrollPane sc = (JScrollPane) parent; Dimension viewportSize = viewport.getMinimumSize(); int width = viewportSize.width; int height = viewportSize.height; if (hsb != null && hsb.isVisible()) height += hsb.getMinimumSize().height; if (vsb != null && vsb.isVisible()) width += vsb.getMinimumSize().width; if (rowHead != null && rowHead.isVisible()) width += rowHead.getMinimumSize().width; if (colHead != null && colHead.isVisible()) height += colHead.getMinimumSize().height; Insets i = sc.getInsets(); return new Dimension(width + i.left + i.right, height + i.top + i.bottom); }
| 5,248
|
public boolean canDrawRubberBand(RubberBand b) { // before we get the row col we first have to translate the x,y point // back to screen coordinates because we are translating the starting // point to the 5250 screen coordinates return !screen.isKeyboardLocked() && (screen.isWithinScreenArea(b.getStartPoint().x,b.getStartPoint().y)); }
|
public boolean canDrawRubberBand(RubberBand b) { // before we get the row col we first have to translate the x,y point // back to screen coordinates because we are translating the starting // point to the 5250 screen coordinates return screen.isWithinScreenArea(b.getStartPoint().x,b.getStartPoint().y); }
| 5,249
|
public void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-2, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-2, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); }
|
public void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() + 1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-2, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-2, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); }
| 5,250
|
public void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-2, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-2, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); }
|
public void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow() + 1, screen.getCurrentCol()-1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow() + 1, screen.getCurrentCol()-2, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow() + 1, screen.getCurrentCol() - 1, p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-2, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow() + 1, screen.getCurrentCol() - 1, p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); }
| 5,251
|
public void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-2, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-2, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); }
|
public void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-2, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow() - 2, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); }
| 5,252
|
public void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-2, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-2, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); }
|
public void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol()-2, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-2, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow() - 1, screen.getCurrentCol() - 1, p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); }
| 5,253
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getPosFromView(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
| 5,254
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.copyMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.copyMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
| 5,255
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
| 5,256
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + workR.width); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
| 5,257
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
|
private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_COPY); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width + 1 , workR.height + 1 ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + workR.height); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); createShortCutItems(kbMenu); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); if (isMacroRunning()) { action = new AbstractAction(LangTool.getString("popup.stopScript")) { public void actionPerformed(ActionEvent e) { setStopMacroRequested(); } }; popup.add(action); } else { JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (keyHandler.isRecording()) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { // this will add a sorted list of the macros to the macro menu addMacros(macMenu); } popup.add(macMenu); } popup.addSeparator(); JMenu xtfrMenu = new JMenu(LangTool.getString("popup.export")); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; xtfrMenu.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); action = new AbstractAction(LangTool.getString("popup.xtfrSpool")) { public void actionPerformed(ActionEvent e) { doMeSpool(); getFocusForMe(); } }; xtfrMenu.add(action); popup.add(xtfrMenu); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); GUIGraphicsUtils.positionPopup(me.getComponent(),popup, me.getX(),me.getY()); }
| 5,258
|
public void actionPerformed(ActionEvent e) { screen.sendKeys(MNEMONIC_PASTE); getFocusForMe(); }
|
public void actionPerformed(ActionEvent e) { screen.copyMe(); getFocusForMe(); }
| 5,259
|
public Point translateEnd(Point end) { return screen.translateEnd(end); }
|
publicPointtranslateEnd(Pointend){returnscreen.translateEnd(end);}
| 5,260
|
public void read_value(org.omg.CORBA.portable.InputStream input, TypeCode a_type ) throws MARSHAL { try { int kind = a_type.kind().value(); // Fixed needs special handling. if (kind == TCKind._tk_fixed) { BigDecimal dec = BigDecimalHelper.read(input, a_type.fixed_scale()); has = new FixedHolder(dec); } else { has = holderFactory.createHolder(a_type); if (has == null) throw new NO_IMPLEMENT("Not implemented for " + typeNamer.nameIt(a_type) ); } type(a_type); has._read(input); } catch (BadKind ex) { throw new MARSHAL("Bad kind: " + ex.getMessage()); } catch (IOException ex) { throw new MARSHAL("IO exception: " + ex.getMessage()); } }
|
public void read_value(org.omg.CORBA.portable.InputStream input, TypeCode a_type ) throws MARSHAL { try { int kind = a_type.kind().value(); // Fixed needs special handling. if (kind == TCKind._tk_fixed) { BigDecimal dec = BigDecimalHelper.read(input, a_type.fixed_scale()); has = new FixedHolder(dec); } else { has = holderFactory.createHolder(a_type); if (has == null) throw new NO_IMPLEMENT("Not implemented for " + typeNamer.nameIt(a_type) ); } type(a_type); has._read(input); } catch (BadKind ex) { throw new MARSHAL("Bad kind: " + ex.getMessage()); } catch (IOException ex) { throw new MARSHAL("IO exception: " + ex.getMessage()); } }
| 5,262
|
public final void setProxy(String proxyHost, String proxyPort) { this.proxyHost=proxyHost; this.proxyPort = proxyPort; proxySet = true; Properties systemProperties = System.getProperties(); systemProperties.put("socksProxySet","true"); systemProperties.put("socksProxyHost",proxyHost); systemProperties.put("socksProxyPort",proxyPort); System.setProperties(systemProperties); }
|
System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); publicSystem.out.println(" socks set "); finalSystem.out.println(" socks set "); voidSystem.out.println(" socks set "); setProxy(StringSystem.out.println(" socks set "); proxyHost,System.out.println(" socks set "); StringSystem.out.println(" socks set "); proxyPort)System.out.println(" socks set "); {System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); this.proxyHost=proxyHost;System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); this.proxyPortSystem.out.println(" socks set "); =System.out.println(" socks set "); proxyPort;System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); proxySetSystem.out.println(" socks set "); =System.out.println(" socks set "); true;System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); PropertiesSystem.out.println(" socks set "); systemPropertiesSystem.out.println(" socks set "); =System.out.println(" socks set "); System.getProperties();System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); systemProperties.put("socksProxySet","true");System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); systemProperties.put("socksProxyHost",proxyHost);System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); systemProperties.put("socksProxyPort",proxyPort);System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); System.setProperties(systemProperties);System.out.println(" socks set "); System.out.println(" socks set "); System.out.println(" socks set "); }
| 5,263
|
public void setRoot(TreeNode root) { // Sanity Check if (root == null) { throw new IllegalArgumentException("null root"); } // Set new root this.root = root; }
|
public void setRoot(TreeNode root) { // Sanity Check if (root == null) { throw new IllegalArgumentException("null root"); } // Set new root this.root = root; }
| 5,265
|
public void setLeadSelectionIndex(int leadIndex) { int oldLeadIndex = leadSelectionIndex; if (setLeadCalledFromAdd == false) oldSel = sel.clone(); leadSelectionIndex = leadIndex; if (anchorSelectionIndex == -1) return; int R1 = Math.min(anchorSelectionIndex, oldLeadIndex); int R2 = Math.max(anchorSelectionIndex, oldLeadIndex); int S1 = Math.min(anchorSelectionIndex, leadIndex); int S2 = Math.max(anchorSelectionIndex, leadIndex); int lo = Math.min(R1, S1); int hi = Math.max(R2, S2); BitSet oldRange = sel.get(lo, hi+1); if (isSelectedIndex(anchorSelectionIndex)) { sel.clear(R1, R2+1); sel.set(S1, S2+1); } else { sel.set(R1, R2+1); sel.clear(S1, S2+1); } BitSet newRange = sel.get(lo, hi+1); newRange.xor(oldRange); int beg = sel.nextSetBit(0), end = -1; for(int i=beg; i >= 0; i=sel.nextSetBit(i+1)) end = i; if (sel.equals(oldSel) == false) fireValueChanged(beg, end, valueIsAdjusting); }
|
public void setLeadSelectionIndex(int leadIndex) { int oldLeadIndex = leadSelectionIndex; if (setLeadCalledFromAdd == false) oldSel = sel.clone(); leadSelectionIndex = leadIndex; if (anchorSelectionIndex == -1) return; int R1 = Math.min(anchorSelectionIndex, oldLeadIndex); int R2 = Math.max(anchorSelectionIndex, oldLeadIndex); int S1 = Math.min(anchorSelectionIndex, leadIndex); int S2 = Math.max(anchorSelectionIndex, leadIndex); int lo = Math.min(R1, S1); int hi = Math.max(R2, S2); if (isSelectedIndex(anchorSelectionIndex)) { sel.clear(R1, R2+1); sel.set(S1, S2+1); } else { sel.set(R1, R2+1); sel.clear(S1, S2+1); } BitSet newRange = sel.get(lo, hi+1); newRange.xor(oldRange); int beg = sel.nextSetBit(0), end = -1; for(int i=beg; i >= 0; i=sel.nextSetBit(i+1)) end = i; if (sel.equals(oldSel) == false) fireValueChanged(beg, end, valueIsAdjusting); }
| 5,267
|
public void setLeadSelectionIndex(int leadIndex) { int oldLeadIndex = leadSelectionIndex; if (setLeadCalledFromAdd == false) oldSel = sel.clone(); leadSelectionIndex = leadIndex; if (anchorSelectionIndex == -1) return; int R1 = Math.min(anchorSelectionIndex, oldLeadIndex); int R2 = Math.max(anchorSelectionIndex, oldLeadIndex); int S1 = Math.min(anchorSelectionIndex, leadIndex); int S2 = Math.max(anchorSelectionIndex, leadIndex); int lo = Math.min(R1, S1); int hi = Math.max(R2, S2); BitSet oldRange = sel.get(lo, hi+1); if (isSelectedIndex(anchorSelectionIndex)) { sel.clear(R1, R2+1); sel.set(S1, S2+1); } else { sel.set(R1, R2+1); sel.clear(S1, S2+1); } BitSet newRange = sel.get(lo, hi+1); newRange.xor(oldRange); int beg = sel.nextSetBit(0), end = -1; for(int i=beg; i >= 0; i=sel.nextSetBit(i+1)) end = i; if (sel.equals(oldSel) == false) fireValueChanged(beg, end, valueIsAdjusting); }
|
public void setLeadSelectionIndex(int leadIndex) { int oldLeadIndex = leadSelectionIndex; if (setLeadCalledFromAdd == false) oldSel = sel.clone(); leadSelectionIndex = leadIndex; if (anchorSelectionIndex == -1) return; int R1 = Math.min(anchorSelectionIndex, oldLeadIndex); int R2 = Math.max(anchorSelectionIndex, oldLeadIndex); int S1 = Math.min(anchorSelectionIndex, leadIndex); int S2 = Math.max(anchorSelectionIndex, leadIndex); int lo = Math.min(R1, S1); int hi = Math.max(R2, S2); BitSet oldRange = sel.get(lo, hi+1); if (isSelectedIndex(anchorSelectionIndex)) { sel.clear(R1, R2+1); sel.set(S1, S2+1); } else { sel.set(R1, R2+1); sel.clear(S1, S2+1); } BitSet newRange = sel.get(lo, hi+1); newRange.xor(oldRange); int beg = sel.nextSetBit(0), end = -1; for(int i=beg; i >= 0; i=sel.nextSetBit(i+1)) end = i; if (sel.equals(oldSel) == false) fireValueChanged(beg, end, valueIsAdjusting); }
| 5,268
|
protected Graphics getComponentGraphics(Graphics g) { if (g instanceof Graphics2D) { g.setFont (this.getFont()); g.setColor (this.getForeground()); return g; } else { Graphics g2 = g.create (); g2.setFont (this.getFont()); g2.setColor (this.getForeground()); return g2; } }
|
protected Graphics getComponentGraphics(Graphics g) { if (g instanceof Graphics2D) { g.setFont (this.getFont()); g.setColor (this.getForeground()); return g; } else { Graphics g2 = g.create (); g2.setFont (this.getFont()); g2.setColor (this.getForeground()); return g2; } }
| 5,269
|
protected Graphics getComponentGraphics(Graphics g) { if (g instanceof Graphics2D) { g.setFont (this.getFont()); g.setColor (this.getForeground()); return g; } else { Graphics g2 = g.create (); g2.setFont (this.getFont()); g2.setColor (this.getForeground()); return g2; } }
|
protected Graphics getComponentGraphics(Graphics g) { if (g instanceof Graphics2D) { g.setFont (this.getFont()); g.setColor (this.getForeground()); return g; } else { Graphics g2 = g.create (); g2.setFont (this.getFont()); g2.setColor (this.getForeground()); return g2; } }
| 5,270
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.