rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
offset, newEndOffset); | pos, newEndOffset); | private void insertFirstContentTag(ElementSpec[] data) { ElementSpec first = data[0]; BranchElement paragraph = (BranchElement) elementStack.peek(); int index = paragraph.getElementIndex(offset); Element current = paragraph.getElement(index); int newEndOffset = offset + first.length; boolean onlyContent = data.length == 1; Edit edit = getEditForParagraphAndIndex(paragraph, index); switch (first.getDirection()) { case ElementSpec.JoinPreviousDirection: if (current.getEndOffset() != newEndOffset && !onlyContent) { Element newEl1 = createLeafElement(paragraph, current.getAttributes(), current.getStartOffset(), newEndOffset); edit.addAddedElement(newEl1); edit.addRemovedElement(current); offset = newEndOffset; } break; case ElementSpec.JoinNextDirection: if (offset != 0) { Element newEl1 = createLeafElement(paragraph, current.getAttributes(), current.getStartOffset(), offset); edit.addAddedElement(newEl1); Element next = paragraph.getElement(index + 1); if (onlyContent) newEl1 = createLeafElement(paragraph, next.getAttributes(), offset, next.getEndOffset()); else { newEl1 = createLeafElement(paragraph, next.getAttributes(), offset, newEndOffset); offset = newEndOffset; } edit.addAddedElement(newEl1); edit.addRemovedElement(current); edit.addRemovedElement(next); } break; default: if (current.getStartOffset() != offset) { Element newEl = createLeafElement(paragraph, current.getAttributes(), current.getStartOffset(), offset); edit.addAddedElement(newEl); } edit.addRemovedElement(current); Element newEl1 = createLeafElement(paragraph, first.getAttributes(), offset, newEndOffset); edit.addAddedElement(newEl1); if (current.getEndOffset() != endOffset) recreateLeaves(newEndOffset, paragraph, onlyContent); else offset = newEndOffset; break; } } |
int parentIndex = parent.getElementIndex(offset); | int parentIndex = parent.getElementIndex(pos); | private void insertFracture(ElementSpec tag) { // insert the fracture at offset. BranchElement parent = (BranchElement) elementStack.peek(); int parentIndex = parent.getElementIndex(offset); AttributeSet parentAtts = parent.getAttributes(); Element toFracture = parent.getElement(parentIndex); int parSize = parent.getElementCount(); Edit edit = getEditForParagraphAndIndex(parent, parentIndex); Element frac = toFracture; int leftIns = 0; int indexOfFrac = toFracture.getElementIndex(offset); int size = toFracture.getElementCount(); // gets the leaf that falls along the fracture frac = toFracture.getElement(indexOfFrac); while (!frac.isLeaf()) frac = frac.getElement(frac.getElementIndex(offset)); AttributeSet atts = frac.getAttributes(); int fracStart = frac.getStartOffset(); int fracEnd = frac.getEndOffset(); if (offset > fracStart && offset < fracEnd) { // recreate left-side of branch and all its children before offset // add the fractured leaves to the right branch BranchElement rightBranch = (BranchElement) createBranchElement(parent, parentAtts); // Check if left branch has already been edited. If so, we only // need to create the right branch. BranchElement leftBranch = null; Element[] added = null; if (edit.added.size() > 0 || edit.removed.size() > 0) { added = new Element[] { rightBranch }; // don't try to remove left part of tree parentIndex++; } else { leftBranch = (BranchElement) createBranchElement(parent, parentAtts); added = new Element[] { leftBranch, rightBranch }; // add fracture to leftBranch Element leftFracturedLeaf = createLeafElement(leftBranch, atts, fracStart, offset); leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf }); } if (!toFracture.isLeaf()) { // add all non-fracture elements to the branches if (indexOfFrac > 0 && leftBranch != null) { Element[] add = new Element[indexOfFrac]; for (int i = 0; i < indexOfFrac; i++) add[i] = toFracture.getElement(i); leftIns = add.length; leftBranch.replace(0, 0, add); } int count = size - indexOfFrac - 1; if (count > 0) { Element[] add = new Element[count]; int j = 0; int i = indexOfFrac + 1; while (j < count) add[j++] = toFracture.getElement(i++); rightBranch.replace(0, 0, add); } } // add to fracture to rightBranch // Check if we can join the right frac leaf with the next leaf int rm = 0; int end = fracEnd; Element next = rightBranch.getElement(0); if (next != null && next.isLeaf() && next.getAttributes().isEqual(atts)) { end = next.getEndOffset(); rm = 1; } Element rightFracturedLeaf = createLeafElement(rightBranch, atts, offset, end); rightBranch.replace(0, rm, new Element[] { rightFracturedLeaf }); // recreate those elements after parentIndex and add/remove all // new/old elements to parent int remove = parSize - parentIndex; Element[] removed = new Element[0]; Element[] added2 = new Element[0]; if (remove > 0) { removed = new Element[remove]; int s = 0; for (int j = parentIndex; j < parSize; j++) removed[s++] = parent.getElement(j); edit.addRemovedElements(removed); added2 = recreateAfterFracture(removed, parent, 1, rightBranch.getEndOffset()); } edit.addAddedElements(added); edit.addAddedElements(added2); elementStack.push(rightBranch); lastFractured = rightFracturedLeaf; } else fracNotCreated = true; } |
int indexOfFrac = toFracture.getElementIndex(offset); | int indexOfFrac = toFracture.getElementIndex(pos); | private void insertFracture(ElementSpec tag) { // insert the fracture at offset. BranchElement parent = (BranchElement) elementStack.peek(); int parentIndex = parent.getElementIndex(offset); AttributeSet parentAtts = parent.getAttributes(); Element toFracture = parent.getElement(parentIndex); int parSize = parent.getElementCount(); Edit edit = getEditForParagraphAndIndex(parent, parentIndex); Element frac = toFracture; int leftIns = 0; int indexOfFrac = toFracture.getElementIndex(offset); int size = toFracture.getElementCount(); // gets the leaf that falls along the fracture frac = toFracture.getElement(indexOfFrac); while (!frac.isLeaf()) frac = frac.getElement(frac.getElementIndex(offset)); AttributeSet atts = frac.getAttributes(); int fracStart = frac.getStartOffset(); int fracEnd = frac.getEndOffset(); if (offset > fracStart && offset < fracEnd) { // recreate left-side of branch and all its children before offset // add the fractured leaves to the right branch BranchElement rightBranch = (BranchElement) createBranchElement(parent, parentAtts); // Check if left branch has already been edited. If so, we only // need to create the right branch. BranchElement leftBranch = null; Element[] added = null; if (edit.added.size() > 0 || edit.removed.size() > 0) { added = new Element[] { rightBranch }; // don't try to remove left part of tree parentIndex++; } else { leftBranch = (BranchElement) createBranchElement(parent, parentAtts); added = new Element[] { leftBranch, rightBranch }; // add fracture to leftBranch Element leftFracturedLeaf = createLeafElement(leftBranch, atts, fracStart, offset); leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf }); } if (!toFracture.isLeaf()) { // add all non-fracture elements to the branches if (indexOfFrac > 0 && leftBranch != null) { Element[] add = new Element[indexOfFrac]; for (int i = 0; i < indexOfFrac; i++) add[i] = toFracture.getElement(i); leftIns = add.length; leftBranch.replace(0, 0, add); } int count = size - indexOfFrac - 1; if (count > 0) { Element[] add = new Element[count]; int j = 0; int i = indexOfFrac + 1; while (j < count) add[j++] = toFracture.getElement(i++); rightBranch.replace(0, 0, add); } } // add to fracture to rightBranch // Check if we can join the right frac leaf with the next leaf int rm = 0; int end = fracEnd; Element next = rightBranch.getElement(0); if (next != null && next.isLeaf() && next.getAttributes().isEqual(atts)) { end = next.getEndOffset(); rm = 1; } Element rightFracturedLeaf = createLeafElement(rightBranch, atts, offset, end); rightBranch.replace(0, rm, new Element[] { rightFracturedLeaf }); // recreate those elements after parentIndex and add/remove all // new/old elements to parent int remove = parSize - parentIndex; Element[] removed = new Element[0]; Element[] added2 = new Element[0]; if (remove > 0) { removed = new Element[remove]; int s = 0; for (int j = parentIndex; j < parSize; j++) removed[s++] = parent.getElement(j); edit.addRemovedElements(removed); added2 = recreateAfterFracture(removed, parent, 1, rightBranch.getEndOffset()); } edit.addAddedElements(added); edit.addAddedElements(added2); elementStack.push(rightBranch); lastFractured = rightFracturedLeaf; } else fracNotCreated = true; } |
frac = frac.getElement(frac.getElementIndex(offset)); | frac = frac.getElement(frac.getElementIndex(pos)); | private void insertFracture(ElementSpec tag) { // insert the fracture at offset. BranchElement parent = (BranchElement) elementStack.peek(); int parentIndex = parent.getElementIndex(offset); AttributeSet parentAtts = parent.getAttributes(); Element toFracture = parent.getElement(parentIndex); int parSize = parent.getElementCount(); Edit edit = getEditForParagraphAndIndex(parent, parentIndex); Element frac = toFracture; int leftIns = 0; int indexOfFrac = toFracture.getElementIndex(offset); int size = toFracture.getElementCount(); // gets the leaf that falls along the fracture frac = toFracture.getElement(indexOfFrac); while (!frac.isLeaf()) frac = frac.getElement(frac.getElementIndex(offset)); AttributeSet atts = frac.getAttributes(); int fracStart = frac.getStartOffset(); int fracEnd = frac.getEndOffset(); if (offset > fracStart && offset < fracEnd) { // recreate left-side of branch and all its children before offset // add the fractured leaves to the right branch BranchElement rightBranch = (BranchElement) createBranchElement(parent, parentAtts); // Check if left branch has already been edited. If so, we only // need to create the right branch. BranchElement leftBranch = null; Element[] added = null; if (edit.added.size() > 0 || edit.removed.size() > 0) { added = new Element[] { rightBranch }; // don't try to remove left part of tree parentIndex++; } else { leftBranch = (BranchElement) createBranchElement(parent, parentAtts); added = new Element[] { leftBranch, rightBranch }; // add fracture to leftBranch Element leftFracturedLeaf = createLeafElement(leftBranch, atts, fracStart, offset); leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf }); } if (!toFracture.isLeaf()) { // add all non-fracture elements to the branches if (indexOfFrac > 0 && leftBranch != null) { Element[] add = new Element[indexOfFrac]; for (int i = 0; i < indexOfFrac; i++) add[i] = toFracture.getElement(i); leftIns = add.length; leftBranch.replace(0, 0, add); } int count = size - indexOfFrac - 1; if (count > 0) { Element[] add = new Element[count]; int j = 0; int i = indexOfFrac + 1; while (j < count) add[j++] = toFracture.getElement(i++); rightBranch.replace(0, 0, add); } } // add to fracture to rightBranch // Check if we can join the right frac leaf with the next leaf int rm = 0; int end = fracEnd; Element next = rightBranch.getElement(0); if (next != null && next.isLeaf() && next.getAttributes().isEqual(atts)) { end = next.getEndOffset(); rm = 1; } Element rightFracturedLeaf = createLeafElement(rightBranch, atts, offset, end); rightBranch.replace(0, rm, new Element[] { rightFracturedLeaf }); // recreate those elements after parentIndex and add/remove all // new/old elements to parent int remove = parSize - parentIndex; Element[] removed = new Element[0]; Element[] added2 = new Element[0]; if (remove > 0) { removed = new Element[remove]; int s = 0; for (int j = parentIndex; j < parSize; j++) removed[s++] = parent.getElement(j); edit.addRemovedElements(removed); added2 = recreateAfterFracture(removed, parent, 1, rightBranch.getEndOffset()); } edit.addAddedElements(added); edit.addAddedElements(added2); elementStack.push(rightBranch); lastFractured = rightFracturedLeaf; } else fracNotCreated = true; } |
if (offset > fracStart && offset < fracEnd) | if (pos >= fracStart && pos < fracEnd) | private void insertFracture(ElementSpec tag) { // insert the fracture at offset. BranchElement parent = (BranchElement) elementStack.peek(); int parentIndex = parent.getElementIndex(offset); AttributeSet parentAtts = parent.getAttributes(); Element toFracture = parent.getElement(parentIndex); int parSize = parent.getElementCount(); Edit edit = getEditForParagraphAndIndex(parent, parentIndex); Element frac = toFracture; int leftIns = 0; int indexOfFrac = toFracture.getElementIndex(offset); int size = toFracture.getElementCount(); // gets the leaf that falls along the fracture frac = toFracture.getElement(indexOfFrac); while (!frac.isLeaf()) frac = frac.getElement(frac.getElementIndex(offset)); AttributeSet atts = frac.getAttributes(); int fracStart = frac.getStartOffset(); int fracEnd = frac.getEndOffset(); if (offset > fracStart && offset < fracEnd) { // recreate left-side of branch and all its children before offset // add the fractured leaves to the right branch BranchElement rightBranch = (BranchElement) createBranchElement(parent, parentAtts); // Check if left branch has already been edited. If so, we only // need to create the right branch. BranchElement leftBranch = null; Element[] added = null; if (edit.added.size() > 0 || edit.removed.size() > 0) { added = new Element[] { rightBranch }; // don't try to remove left part of tree parentIndex++; } else { leftBranch = (BranchElement) createBranchElement(parent, parentAtts); added = new Element[] { leftBranch, rightBranch }; // add fracture to leftBranch Element leftFracturedLeaf = createLeafElement(leftBranch, atts, fracStart, offset); leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf }); } if (!toFracture.isLeaf()) { // add all non-fracture elements to the branches if (indexOfFrac > 0 && leftBranch != null) { Element[] add = new Element[indexOfFrac]; for (int i = 0; i < indexOfFrac; i++) add[i] = toFracture.getElement(i); leftIns = add.length; leftBranch.replace(0, 0, add); } int count = size - indexOfFrac - 1; if (count > 0) { Element[] add = new Element[count]; int j = 0; int i = indexOfFrac + 1; while (j < count) add[j++] = toFracture.getElement(i++); rightBranch.replace(0, 0, add); } } // add to fracture to rightBranch // Check if we can join the right frac leaf with the next leaf int rm = 0; int end = fracEnd; Element next = rightBranch.getElement(0); if (next != null && next.isLeaf() && next.getAttributes().isEqual(atts)) { end = next.getEndOffset(); rm = 1; } Element rightFracturedLeaf = createLeafElement(rightBranch, atts, offset, end); rightBranch.replace(0, rm, new Element[] { rightFracturedLeaf }); // recreate those elements after parentIndex and add/remove all // new/old elements to parent int remove = parSize - parentIndex; Element[] removed = new Element[0]; Element[] added2 = new Element[0]; if (remove > 0) { removed = new Element[remove]; int s = 0; for (int j = parentIndex; j < parSize; j++) removed[s++] = parent.getElement(j); edit.addRemovedElements(removed); added2 = recreateAfterFracture(removed, parent, 1, rightBranch.getEndOffset()); } edit.addAddedElements(added); edit.addAddedElements(added2); elementStack.push(rightBranch); lastFractured = rightFracturedLeaf; } else fracNotCreated = true; } |
Element leftFracturedLeaf = createLeafElement(leftBranch, atts, fracStart, offset); leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf }); | if (fracStart != pos) { Element leftFracturedLeaf = createLeafElement(leftBranch, atts, fracStart, pos); leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf }); } | private void insertFracture(ElementSpec tag) { // insert the fracture at offset. BranchElement parent = (BranchElement) elementStack.peek(); int parentIndex = parent.getElementIndex(offset); AttributeSet parentAtts = parent.getAttributes(); Element toFracture = parent.getElement(parentIndex); int parSize = parent.getElementCount(); Edit edit = getEditForParagraphAndIndex(parent, parentIndex); Element frac = toFracture; int leftIns = 0; int indexOfFrac = toFracture.getElementIndex(offset); int size = toFracture.getElementCount(); // gets the leaf that falls along the fracture frac = toFracture.getElement(indexOfFrac); while (!frac.isLeaf()) frac = frac.getElement(frac.getElementIndex(offset)); AttributeSet atts = frac.getAttributes(); int fracStart = frac.getStartOffset(); int fracEnd = frac.getEndOffset(); if (offset > fracStart && offset < fracEnd) { // recreate left-side of branch and all its children before offset // add the fractured leaves to the right branch BranchElement rightBranch = (BranchElement) createBranchElement(parent, parentAtts); // Check if left branch has already been edited. If so, we only // need to create the right branch. BranchElement leftBranch = null; Element[] added = null; if (edit.added.size() > 0 || edit.removed.size() > 0) { added = new Element[] { rightBranch }; // don't try to remove left part of tree parentIndex++; } else { leftBranch = (BranchElement) createBranchElement(parent, parentAtts); added = new Element[] { leftBranch, rightBranch }; // add fracture to leftBranch Element leftFracturedLeaf = createLeafElement(leftBranch, atts, fracStart, offset); leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf }); } if (!toFracture.isLeaf()) { // add all non-fracture elements to the branches if (indexOfFrac > 0 && leftBranch != null) { Element[] add = new Element[indexOfFrac]; for (int i = 0; i < indexOfFrac; i++) add[i] = toFracture.getElement(i); leftIns = add.length; leftBranch.replace(0, 0, add); } int count = size - indexOfFrac - 1; if (count > 0) { Element[] add = new Element[count]; int j = 0; int i = indexOfFrac + 1; while (j < count) add[j++] = toFracture.getElement(i++); rightBranch.replace(0, 0, add); } } // add to fracture to rightBranch // Check if we can join the right frac leaf with the next leaf int rm = 0; int end = fracEnd; Element next = rightBranch.getElement(0); if (next != null && next.isLeaf() && next.getAttributes().isEqual(atts)) { end = next.getEndOffset(); rm = 1; } Element rightFracturedLeaf = createLeafElement(rightBranch, atts, offset, end); rightBranch.replace(0, rm, new Element[] { rightFracturedLeaf }); // recreate those elements after parentIndex and add/remove all // new/old elements to parent int remove = parSize - parentIndex; Element[] removed = new Element[0]; Element[] added2 = new Element[0]; if (remove > 0) { removed = new Element[remove]; int s = 0; for (int j = parentIndex; j < parSize; j++) removed[s++] = parent.getElement(j); edit.addRemovedElements(removed); added2 = recreateAfterFracture(removed, parent, 1, rightBranch.getEndOffset()); } edit.addAddedElements(added); edit.addAddedElements(added2); elementStack.push(rightBranch); lastFractured = rightFracturedLeaf; } else fracNotCreated = true; } |
offset, end); | pos, end); | private void insertFracture(ElementSpec tag) { // insert the fracture at offset. BranchElement parent = (BranchElement) elementStack.peek(); int parentIndex = parent.getElementIndex(offset); AttributeSet parentAtts = parent.getAttributes(); Element toFracture = parent.getElement(parentIndex); int parSize = parent.getElementCount(); Edit edit = getEditForParagraphAndIndex(parent, parentIndex); Element frac = toFracture; int leftIns = 0; int indexOfFrac = toFracture.getElementIndex(offset); int size = toFracture.getElementCount(); // gets the leaf that falls along the fracture frac = toFracture.getElement(indexOfFrac); while (!frac.isLeaf()) frac = frac.getElement(frac.getElementIndex(offset)); AttributeSet atts = frac.getAttributes(); int fracStart = frac.getStartOffset(); int fracEnd = frac.getEndOffset(); if (offset > fracStart && offset < fracEnd) { // recreate left-side of branch and all its children before offset // add the fractured leaves to the right branch BranchElement rightBranch = (BranchElement) createBranchElement(parent, parentAtts); // Check if left branch has already been edited. If so, we only // need to create the right branch. BranchElement leftBranch = null; Element[] added = null; if (edit.added.size() > 0 || edit.removed.size() > 0) { added = new Element[] { rightBranch }; // don't try to remove left part of tree parentIndex++; } else { leftBranch = (BranchElement) createBranchElement(parent, parentAtts); added = new Element[] { leftBranch, rightBranch }; // add fracture to leftBranch Element leftFracturedLeaf = createLeafElement(leftBranch, atts, fracStart, offset); leftBranch.replace(leftIns, 0, new Element[] { leftFracturedLeaf }); } if (!toFracture.isLeaf()) { // add all non-fracture elements to the branches if (indexOfFrac > 0 && leftBranch != null) { Element[] add = new Element[indexOfFrac]; for (int i = 0; i < indexOfFrac; i++) add[i] = toFracture.getElement(i); leftIns = add.length; leftBranch.replace(0, 0, add); } int count = size - indexOfFrac - 1; if (count > 0) { Element[] add = new Element[count]; int j = 0; int i = indexOfFrac + 1; while (j < count) add[j++] = toFracture.getElement(i++); rightBranch.replace(0, 0, add); } } // add to fracture to rightBranch // Check if we can join the right frac leaf with the next leaf int rm = 0; int end = fracEnd; Element next = rightBranch.getElement(0); if (next != null && next.isLeaf() && next.getAttributes().isEqual(atts)) { end = next.getEndOffset(); rm = 1; } Element rightFracturedLeaf = createLeafElement(rightBranch, atts, offset, end); rightBranch.replace(0, rm, new Element[] { rightFracturedLeaf }); // recreate those elements after parentIndex and add/remove all // new/old elements to parent int remove = parSize - parentIndex; Element[] removed = new Element[0]; Element[] added2 = new Element[0]; if (remove > 0) { removed = new Element[remove]; int s = 0; for (int j = parentIndex; j < parSize; j++) removed[s++] = parent.getElement(j); edit.addRemovedElements(removed); added2 = recreateAfterFracture(removed, parent, 1, rightBranch.getEndOffset()); } edit.addAddedElements(added); edit.addAddedElements(added2); elementStack.push(rightBranch); lastFractured = rightFracturedLeaf; } else fracNotCreated = true; } |
int x = paragraph.getElementIndex(pos) + 1; | int x = 0; if (paragraph.getElementCount() > 0) x = paragraph.getElementIndex(pos) + 1; | protected void insertUpdate(ElementSpec[] data) { // Push the root and the paragraph at offset onto the element stack. Element current = root; int index; while (!current.isLeaf()) { index = current.getElementIndex(offset); elementStack.push(current); current = current.getElement(index); } int i = 0; int type = data[0].getType(); if (type == ElementSpec.ContentType) { // If the first tag is content we must treat it separately to allow // for joining properly to previous Elements and to ensure that // no extra LeafElements are erroneously inserted. insertFirstContentTag(data); pos += data[0].length; i = 1; } else { createFracture(data); i = 0; } // Handle each ElementSpec individually. for (; i < data.length; i++) { BranchElement paragraph = (BranchElement) elementStack.peek(); switch (data[i].getType()) { case ElementSpec.StartTagType: switch (data[i].getDirection()) { case ElementSpec.JoinFractureDirection: // Fracture the tree and ensure the appropriate element // is on top of the stack. fracNotCreated = false; insertFracture(data[i]); if (fracNotCreated) { if (lastFractured != null) elementStack.push(lastFractured.getParentElement()); else elementStack.push(paragraph.getElement(0)); } break; case ElementSpec.JoinNextDirection: // Push the next paragraph element onto the stack so // future insertions are added to it. int ix = paragraph.getElementIndex(pos) + 1; elementStack.push(paragraph.getElement(ix)); break; default: Element br = null; if (data.length > i + 1) { // leaves will be added to paragraph later int x = paragraph.getElementIndex(pos) + 1; Edit e = getEditForParagraphAndIndex(paragraph, x); br = (BranchElement) createBranchElement(paragraph, data[i].getAttributes()); e.added.add(br); elementStack.push(br); } else // need to add leaves to paragraph now br = insertParagraph(paragraph, pos); break; } break; case ElementSpec.EndTagType: elementStack.pop(); break; case ElementSpec.ContentType: insertContentTag(data[i]); offset = pos; break; } } } |
offset = newBranch.getEndOffset(); | pos = newBranch.getEndOffset(); | private void recreateLeaves(int start, BranchElement paragraph, boolean onlyContent) { int index = paragraph.getElementIndex(start); Element child = paragraph.getElement(index); AttributeSet atts = child.getAttributes(); if (!onlyContent) { BranchElement newBranch = (BranchElement) createBranchElement(paragraph, atts); Element newLeaf = createLeafElement(newBranch, atts, start, child.getEndOffset()); newBranch.replace(0, 0, new Element[] { newLeaf }); BranchElement parent = (BranchElement) paragraph.getParentElement(); int parSize = parent.getElementCount(); Edit edit = getEditForParagraphAndIndex(parent, parSize); edit.addAddedElement(newBranch); int paragraphSize = paragraph.getElementCount(); Element[] removed = new Element[paragraphSize - (index + 1)]; int s = 0; for (int j = index + 1; j < paragraphSize; j++) removed[s++] = paragraph.getElement(j); edit = getEditForParagraphAndIndex(paragraph, index); edit.addRemovedElements(removed); Element[] added = recreateAfterFracture(removed, newBranch, 0, child.getEndOffset()); newBranch.replace(1, 0, added); lastFractured = newLeaf; offset = newBranch.getEndOffset(); } else { Element newLeaf = createLeafElement(paragraph, atts, start, child.getEndOffset()); Edit edit = getEditForParagraphAndIndex(paragraph, index); edit.addAddedElement(newLeaf); } } |
BranchElement paragraph = (BranchElement) createBranchElement(section, null); | BranchElement paragraph = new BranchElement(section, null); | protected AbstractDocument.AbstractElement createDefaultRoot() { Element[] tmp; SectionElement section = new SectionElement(); BranchElement paragraph = (BranchElement) createBranchElement(section, null); tmp = new Element[1]; tmp[0] = paragraph; section.replace(0, 0, tmp); Element leaf = createLeafElement(paragraph, null, 0, 1); tmp = new Element[1]; tmp[0] = leaf; paragraph.replace(0, 0, tmp); return section; } |
Element leaf = createLeafElement(paragraph, null, 0, 1); | Element leaf = new LeafElement(paragraph, null, 0, 1); | protected AbstractDocument.AbstractElement createDefaultRoot() { Element[] tmp; SectionElement section = new SectionElement(); BranchElement paragraph = (BranchElement) createBranchElement(section, null); tmp = new Element[1]; tmp[0] = paragraph; section.replace(0, 0, tmp); Element leaf = createLeafElement(paragraph, null, 0, 1); tmp = new Element[1]; tmp[0] = leaf; paragraph.replace(0, 0, tmp); return section; } |
if (prevParagraph.getEndOffset() != endOffset) | if (paragraph.getStartOffset() != endOffset) | 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; } return ElementSpec.OriginateDirection; } |
throw new BAD_OPERATION("Contains not a string value type"); | { BAD_OPERATION bad = new BAD_OPERATION("String value type expected"); bad.minor = Minor.Any; throw bad; } | public static String extract(Any an_any) { if (an_any.type().equal(type())) { an_any.type(tString); return an_any.extract_string(); } else throw new BAD_OPERATION("Contains not a string value type"); } |
throw new MARSHAL("String expected"); | MARSHAL m = new MARSHAL("String expected"); m.minor = Minor.ClassCast; throw m; | public void write_value(OutputStream ostream, Serializable a_string) { try { ostream.write_string((String) a_string); } catch (ClassCastException ex) { throw new MARSHAL("String expected"); } } |
void adjustPositionsInRange(int offset, int length, int incr) | private void adjustPositionsInRange(int offset, int length, int incr) | void adjustPositionsInRange(int offset, int length, int incr) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark += incr; } } |
new GapContentPosition(offset)); | new GapContentPosition(offset), new WeakPositionComparator()); | void adjustPositionsInRange(int offset, int length, int incr) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark += incr; } } |
while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) | while (index1 > 0) { WeakReference r = (WeakReference) positions.get(index1 - 1); GapContentPosition p = (GapContentPosition) r.get(); if (p != null && p.mark == offset || p == null) | void adjustPositionsInRange(int offset, int length, int incr) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark += incr; } } |
GapContentPosition p = (GapContentPosition) i.next(); | WeakReference r = (WeakReference) i.next(); GapContentPosition p = (GapContentPosition) r.get(); if (p == null) continue; | void adjustPositionsInRange(int offset, int length, int incr) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark += incr; } } |
int index = Collections.binarySearch(positions, pos); | int index = Collections.binarySearch(positions, r, new WeakPositionComparator()); | public Position createPosition(final int offset) throws BadLocationException { if (offset < 0 || offset > length()) throw new BadLocationException("The offset was out of the bounds of this" + " buffer", offset); // We store the actual array index in the GapContentPosition. The real // offset is then calculated in the GapContentPosition. int mark = offset; if (offset >= gapStart) mark += gapEnd - gapStart; GapContentPosition pos = new GapContentPosition(mark); // Add this into our list in a sorted fashion. int index = Collections.binarySearch(positions, pos); if (index < 0) index = -(index + 1); positions.add(index, pos); return pos; } |
positions.add(index, pos); | positions.add(index, r); | public Position createPosition(final int offset) throws BadLocationException { if (offset < 0 || offset > length()) throw new BadLocationException("The offset was out of the bounds of this" + " buffer", offset); // We store the actual array index in the GapContentPosition. The real // offset is then calculated in the GapContentPosition. int mark = offset; if (offset >= gapStart) mark += gapEnd - gapStart; GapContentPosition pos = new GapContentPosition(mark); // Add this into our list in a sorted fashion. int index = Collections.binarySearch(positions, pos); if (index < 0) index = -(index + 1); positions.add(index, pos); return pos; } |
GapContentPosition pos = (GapContentPosition) i.next(); | WeakReference r = (WeakReference) i.next(); GapContentPosition pos = (GapContentPosition) r.get(); | private void dumpPositions() { for (Iterator i = positions.iterator(); i.hasNext();) { GapContentPosition pos = (GapContentPosition) i.next(); System.err.println("position at: " + pos.mark); } } |
new GapContentPosition(offset)); | new GapContentPosition(offset), new WeakPositionComparator()); | protected Vector getPositionsInRange(Vector v, int offset, int length) { Vector res = v; if (res == null) res = new Vector(); else res.clear(); int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) res.add(p); } return res; } |
while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) | while (index1 > 0) { WeakReference r = (WeakReference) positions.get(index1 - 1); GapContentPosition p = (GapContentPosition) r.get(); if (p != null && p.mark == offset || p == null) | protected Vector getPositionsInRange(Vector v, int offset, int length) { Vector res = v; if (res == null) res = new Vector(); else res.clear(); int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) res.add(p); } return res; } |
GapContentPosition p = (GapContentPosition) i.next(); | WeakReference r = (WeakReference) i.next(); GapContentPosition p = (GapContentPosition) r.get(); if (p == null) continue; | protected Vector getPositionsInRange(Vector v, int offset, int length) { Vector res = v; if (res == null) res = new Vector(); else res.clear(); int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) res.add(p); } return res; } |
void setPositionsInRange(int offset, int length, int value) | private void setPositionsInRange(int offset, int length, int value) | void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark = value; } } |
new GapContentPosition(offset)); | new GapContentPosition(offset), new WeakPositionComparator()); | void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark = value; } } |
while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) | while (index1 > 0) { WeakReference r = (WeakReference) positions.get(index1 - 1); GapContentPosition p = (GapContentPosition) r.get(); if (p != null && p.mark == offset || p == null) | void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark = value; } } |
GapContentPosition p = (GapContentPosition) i.next(); | WeakReference r = (WeakReference) i.next(); GapContentPosition p = (GapContentPosition) r.get(); if (p == null) continue; | void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset)); if (index1 < 0) index1 = -(index1 + 1); // Search the first index with the specified offset. The binarySearch does // not necessarily find the first one. while (index1 > 0 && ((GapContentPosition) positions.get(index1 - 1)).mark == offset) index1--; for (ListIterator i = positions.listIterator(index1); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark = value; } } |
setPositionsInRange(gapEnd, newGapEnd - gapEnd, newGapEnd + 1); | setPositionsInRange(gapEnd, newGapEnd - gapEnd, newGapEnd); | protected void shiftGapEndUp(int newGapEnd) { if (newGapEnd == gapEnd) return; assert newGapEnd > gapEnd : "The new gap end must be greater than the " + "old gap end."; setPositionsInRange(gapEnd, newGapEnd - gapEnd, newGapEnd + 1); gapEnd = newGapEnd; } |
else { if (event.getID() == MouseEvent.MOUSE_RELEASED) clearSelectedPath(); } | public void processMouseEvent(MouseEvent event) { Component source = ((Component) event.getSource()); // In the case of drag event, event.getSource() returns component // where drag event originated. However menu element processing this // event should be the one over which mouse is currently located, // which is not necessary the source of the drag event. Component mouseOverMenuComp; // find over which menu element the mouse is currently located if (event.getID() == MouseEvent.MOUSE_DRAGGED || event.getID() == MouseEvent.MOUSE_RELEASED) mouseOverMenuComp = componentForPoint(source, event.getPoint()); else mouseOverMenuComp = source; // Process this event only if mouse is located over some menu element if (mouseOverMenuComp != null && (mouseOverMenuComp instanceof MenuElement)) { MenuElement[] path = getPath(mouseOverMenuComp); ((MenuElement) mouseOverMenuComp).processMouseEvent(event, path, manager); // FIXME: Java specification says that mouse events should be // forwarded to subcomponents. The code below does it, but // menu's work fine without it. This code is commented for now. /* MenuElement[] subComponents = ((MenuElement) mouseOverMenuComp) .getSubElements(); for (int i = 0; i < subComponents.length; i++) { subComponents[i].processMouseEvent(event, path, manager); } */ } } |
|
return value.getClass().getName() + " " + result; | return value.getClass().getName() + "=" + result; | public String toString() { String result = super.toString(); if (value != UNSET) return value.getClass().getName() + " " + result; return result; } |
Ext2Debugger.debug("Ext2fs filesystem constructed sucessfully"); Ext2Debugger.debug( | log.debug("Ext2fs filesystem constructed sucessfully"); log.debug( | public Ext2FileSystem(Device device) throws FileSystemException { if (device == null) { throw new FileSystemException("null device!"); } this.device = device; try { this.api = (BlockDeviceAPI) device.getAPI(BlockDeviceAPI.class); } catch (ApiNotFoundException ex) { throw new FileSystemException("Device is not a block device", ex); } closed = false; byte data[]; //points to the byte where the fs metadata parsing has reached long byteIndex; cache = new BlockCache(50, (float) 0.75); try { data = new byte[Superblock.SUPERBLOCK_LENGTH]; //skip the first 1024 bytes (bootsector) and read the superblock byteIndex = 1024; api.read(byteIndex, data, 0, Superblock.SUPERBLOCK_LENGTH); byteIndex += Superblock.SUPERBLOCK_LENGTH; superblock = new Superblock(data); //read the group descriptors groupCount = (int) Math.ceil((double) superblock.getBlocksCount() / (double) superblock.getBlocksPerGroup()); groupDescriptors = new GroupDescriptor[groupCount]; for (int i = 0; i < groupCount; i++) { data = new byte[GroupDescriptor.GROUPDESCRIPTOR_LENGTH]; api.read(byteIndex + i * GroupDescriptor.GROUPDESCRIPTOR_LENGTH, data, 0, GroupDescriptor.GROUPDESCRIPTOR_LENGTH); groupDescriptors[i] = new GroupDescriptor(data); } byteIndex += superblock.getBlockSize(); /* * //go through each block group //XXX byteIndex = ... //read the block bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, * (int)superblock.getBlockSize()); FSBitmap blockBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode bitmap //XXX what if it doesn't fit? data = new byte[(int)superblock.getBlockSize()]; api.read( byteIndex, data, 0, (int)superblock.getBlockSize()); FSBitmap * inodeBitmap = new FSBitmap(data); byteIndex += superblock.getBlockSize(); * * //read the inode table //XXX what if it doesn't fit? Inode inodeTable[] = new Inode[ (int)superblock.getInodesCount() ]; */ } catch (FileSystemException e) { throw e; } catch (Exception e) { throw new FileSystemException(e); } Ext2Debugger.debug("Ext2fs filesystem constructed sucessfully"); Ext2Debugger.debug( " superblock: #blocks: " + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + superblock.getINodesPerGroup()); } |
Ext2Debugger.debug("Ext2FileSystem.getRootEntry()", 2); | log.debug("Ext2FileSystem.getRootEntry()"); | public FSEntry getRootEntry() throws IOException { Ext2Debugger.debug("Ext2FileSystem.getRootEntry()", 2); try { if (!closed) { return new Ext2Entry(getINode(Ext2Constants.EXT2_ROOT_INO), "/", Ext2Constants.EXT2_FT_DIR); } } catch (FileSystemException e) { throw new IOException(e); } return null; } |
protected void resolve() throws PluginException { | protected void resolve(PluginRegistryModel registry) throws PluginException { | protected void resolve() throws PluginException { // Do nothing } |
protected void unresolve() throws PluginException { | protected void unresolve(PluginRegistryModel registry) throws PluginException { | protected void unresolve() throws PluginException { // Do nothing } |
for (Iterator i = requestHeaders.keySet().iterator(); i.hasNext(); ) | for (Iterator i = requestHeaders.iterator(); i.hasNext(); ) | public Response dispatch() throws IOException { if (dispatched) { throw new ProtocolException("request already dispatched"); } final String CRLF = "\r\n"; final String HEADER_SEP = ": "; final String US_ASCII = "US-ASCII"; final String version = connection.getVersion(); Response response; int contentLength = -1; boolean retry = false; int attempts = 0; boolean expectingContinue = false; if (requestBodyWriter != null) { contentLength = requestBodyWriter.getContentLength(); String expect = getHeader("Expect"); if (expect != null && expect.equals("100-continue")) { expectingContinue = true; } else { setHeader("Content-Length", Integer.toString(contentLength)); } } try { // Loop while authentication fails or continue do { retry = false; // Get socket output and input streams OutputStream out = connection.getOutputStream(); // Request line String requestUri = path; if (connection.isUsingProxy() && !"*".equals(requestUri) && !"CONNECT".equals(method)) { requestUri = getRequestURI(); } String line = method + ' ' + requestUri + ' ' + version + CRLF; out.write(line.getBytes(US_ASCII)); // Request headers for (Iterator i = requestHeaders.keySet().iterator(); i.hasNext(); ) { String name =(String) i.next(); String value =(String) requestHeaders.get(name); line = name + HEADER_SEP + value + CRLF; out.write(line.getBytes(US_ASCII)); } out.write(CRLF.getBytes(US_ASCII)); // Request body if (requestBodyWriter != null && !expectingContinue) { byte[] buffer = new byte[4096]; int len; int count = 0; requestBodyWriter.reset(); do { len = requestBodyWriter.write(buffer); if (len > 0) { out.write(buffer, 0, len); } count += len; } while (len > -1 && count < contentLength); } out.flush(); // Get response while(true) { response = readResponse(connection.getInputStream()); int sc = response.getCode(); if (sc == 401 && authenticator != null) { if (authenticate(response, attempts++)) { retry = true; } } else if (sc == 100) { if (expectingContinue) { requestHeaders.remove("Expect"); setHeader("Content-Length", Integer.toString(contentLength)); expectingContinue = false; retry = true; } else { // A conforming server can send an unsoliceted // Continue response but *should* not (RFC 2616 // sec 8.2.3). Ignore the bogus Continue // response and get the real response that // should follow continue; } } break; } } while (retry); } catch (IOException e) { connection.close(); throw e; } return response; } |
String name =(String) i.next(); String value =(String) requestHeaders.get(name); line = name + HEADER_SEP + value + CRLF; | Headers.HeaderElement elt = (Headers.HeaderElement)i.next(); line = elt.name + HEADER_SEP + elt.value + CRLF; | public Response dispatch() throws IOException { if (dispatched) { throw new ProtocolException("request already dispatched"); } final String CRLF = "\r\n"; final String HEADER_SEP = ": "; final String US_ASCII = "US-ASCII"; final String version = connection.getVersion(); Response response; int contentLength = -1; boolean retry = false; int attempts = 0; boolean expectingContinue = false; if (requestBodyWriter != null) { contentLength = requestBodyWriter.getContentLength(); String expect = getHeader("Expect"); if (expect != null && expect.equals("100-continue")) { expectingContinue = true; } else { setHeader("Content-Length", Integer.toString(contentLength)); } } try { // Loop while authentication fails or continue do { retry = false; // Get socket output and input streams OutputStream out = connection.getOutputStream(); // Request line String requestUri = path; if (connection.isUsingProxy() && !"*".equals(requestUri) && !"CONNECT".equals(method)) { requestUri = getRequestURI(); } String line = method + ' ' + requestUri + ' ' + version + CRLF; out.write(line.getBytes(US_ASCII)); // Request headers for (Iterator i = requestHeaders.keySet().iterator(); i.hasNext(); ) { String name =(String) i.next(); String value =(String) requestHeaders.get(name); line = name + HEADER_SEP + value + CRLF; out.write(line.getBytes(US_ASCII)); } out.write(CRLF.getBytes(US_ASCII)); // Request body if (requestBodyWriter != null && !expectingContinue) { byte[] buffer = new byte[4096]; int len; int count = 0; requestBodyWriter.reset(); do { len = requestBodyWriter.write(buffer); if (len > 0) { out.write(buffer, 0, len); } count += len; } while (len > -1 && count < contentLength); } out.flush(); // Get response while(true) { response = readResponse(connection.getInputStream()); int sc = response.getCode(); if (sc == 401 && authenticator != null) { if (authenticate(response, attempts++)) { retry = true; } } else if (sc == 100) { if (expectingContinue) { requestHeaders.remove("Expect"); setHeader("Content-Length", Integer.toString(contentLength)); expectingContinue = false; retry = true; } else { // A conforming server can send an unsoliceted // Continue response but *should* not (RFC 2616 // sec 8.2.3). Ignore the bogus Continue // response and get the real response that // should follow continue; } } break; } } while (retry); } catch (IOException e) { connection.close(); throw e; } return response; } |
for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) | for (Iterator i = headers.iterator(); i.hasNext(); ) | void notifyHeaderHandlers(Headers headers) { for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String name =(String) entry.getKey(); // Handle Set-Cookie if ("Set-Cookie".equalsIgnoreCase(name)) { String value = (String) entry.getValue(); handleSetCookie(value); } ResponseHeaderHandler handler = (ResponseHeaderHandler) responseHeaderHandlers.get(name); if (handler != null) { String value = (String) entry.getValue(); handler.setValue(value); } } } |
Map.Entry entry = (Map.Entry) i.next(); String name =(String) entry.getKey(); | Headers.HeaderElement entry = (Headers.HeaderElement) i.next(); | void notifyHeaderHandlers(Headers headers) { for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String name =(String) entry.getKey(); // Handle Set-Cookie if ("Set-Cookie".equalsIgnoreCase(name)) { String value = (String) entry.getValue(); handleSetCookie(value); } ResponseHeaderHandler handler = (ResponseHeaderHandler) responseHeaderHandlers.get(name); if (handler != null) { String value = (String) entry.getValue(); handler.setValue(value); } } } |
if ("Set-Cookie".equalsIgnoreCase(name)) { String value = (String) entry.getValue(); handleSetCookie(value); } | if ("Set-Cookie".equalsIgnoreCase(entry.name)) handleSetCookie(entry.value); | void notifyHeaderHandlers(Headers headers) { for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String name =(String) entry.getKey(); // Handle Set-Cookie if ("Set-Cookie".equalsIgnoreCase(name)) { String value = (String) entry.getValue(); handleSetCookie(value); } ResponseHeaderHandler handler = (ResponseHeaderHandler) responseHeaderHandlers.get(name); if (handler != null) { String value = (String) entry.getValue(); handler.setValue(value); } } } |
(ResponseHeaderHandler) responseHeaderHandlers.get(name); | (ResponseHeaderHandler) responseHeaderHandlers.get(entry.name); | void notifyHeaderHandlers(Headers headers) { for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String name =(String) entry.getKey(); // Handle Set-Cookie if ("Set-Cookie".equalsIgnoreCase(name)) { String value = (String) entry.getValue(); handleSetCookie(value); } ResponseHeaderHandler handler = (ResponseHeaderHandler) responseHeaderHandlers.get(name); if (handler != null) { String value = (String) entry.getValue(); handler.setValue(value); } } } |
{ String value = (String) entry.getValue(); handler.setValue(value); } | handler.setValue(entry.value); | void notifyHeaderHandlers(Headers headers) { for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String name =(String) entry.getKey(); // Handle Set-Cookie if ("Set-Cookie".equalsIgnoreCase(name)) { String value = (String) entry.getValue(); handleSetCookie(value); } ResponseHeaderHandler handler = (ResponseHeaderHandler) responseHeaderHandlers.get(name); if (handler != null) { String value = (String) entry.getValue(); handler.setValue(value); } } } |
planes.initalizeFieldPlanes(); | protected void clearTable() { oia.setKeyBoardLocked(true); screenFields.clearFFT(); pendingInsert = false; homePos = -1; } |
|
if (desktopPane == null) return frame.getDesktopIcon().getBounds(); | protected Rectangle getBoundsForIconOf(JInternalFrame frame) { // IconRects has no order to it. // The icon _must_ be placed in the first free slot (working from // the bottom left corner) // The icon also must not be placed where another icon is placed // (regardless whether that frame is an icon currently or not) JDesktopPane desktopPane = frame.getDesktopPane(); Rectangle paneBounds = desktopPane.getBounds(); Insets insets = desktopPane.getInsets(); Dimension pref = frame.getDesktopIcon().getPreferredSize(); if (desktopPane == null) return frame.getDesktopIcon().getBounds(); Component[] frames = desktopPane.getComponents(); int count = 0; for (int i = 0, j = 0; i < frames.length; i++) if (frames[i] instanceof JDesktopIcon || frames[i] instanceof JInternalFrame && ((JInternalFrame) frames[i]).getWasIcon() && frames[i] != frame) count++; iconRects = new Rectangle[count]; for (int i = 0, j = 0; i < frames.length; i++) if (frames[i] instanceof JDesktopIcon) iconRects[--count] = frames[i].getBounds(); else if (frames[i] instanceof JInternalFrame && ((JInternalFrame) frames[i]).getWasIcon() && frames[i] != frame) iconRects[--count] = ((JInternalFrame) frames[i]).getDesktopIcon() .getBounds(); int startingX = insets.left; int startingY = paneBounds.height - insets.bottom - pref.height; Rectangle ideal = new Rectangle(startingX, startingY, pref.width, pref.height); boolean clear = true; while (iconRects.length > 0) { clear = true; for (int i = 0; i < iconRects.length; i++) { if (iconRects[i] != null && iconRects[i].intersects(ideal)) { clear = false; break; } } if (clear) return ideal; startingX += pref.width; if (startingX + pref.width > paneBounds.width - insets.right) { startingX = insets.left; startingY -= pref.height; } ideal.setBounds(startingX, startingY, pref.width, pref.height); } return ideal; } |
|
+ XMLDeclAttribs.get("dtdName") + "\">"); | + XMLDeclAttribs.get("dtdName") +"\""); ArrayList hrefObjList = findAllChildHrefObjects(); StringBuffer entityString = new StringBuffer (); StringBuffer notationString = new StringBuffer (); if (hrefObjList.size() > 0) { if (Specification.getInstance().isPrettyXDFOutput()) entityString.append(Constants.NEW_LINE); synchronized (hrefObjList) { Iterator iter = hrefObjList.iterator(); while (iter.hasNext()) { Href hrefObj = (Href) iter.next(); if (Specification.getInstance().isPrettyXDFOutput()) entityString.append(Specification.getInstance().getPrettyXDFOutputIndentation()); entityString.append("<!ENTITY " + hrefObj.getName()); if (hrefObj.getPubId() != null) entityString.append(" PUBLIC \"" + hrefObj.getPubId() + "\""); if (hrefObj.getSysId() != null) entityString.append(" SYSTEM \"" + hrefObj.getSysId() + "\""); if (hrefObj.getNdata() != null) entityString.append(" NDATA " + hrefObj.getNdata()); entityString.append(">"); if (Specification.getInstance().isPrettyXDFOutput()) entityString.append(Constants.NEW_LINE); } } } synchronized (XMLNotationHash) { Iterator iter = XMLNotationHash.iterator(); while (iter.hasNext()) { Hashtable notationHash = (Hashtable) iter.next(); if (notationHash.containsKey("name")) { if (Specification.getInstance().isPrettyXDFOutput()) notationString.append(Specification.getInstance().getPrettyXDFOutputIndentation()); notationString.append("<!NOTATION " + notationHash.get("name")); if (notationHash.containsKey("publicId")) notationString.append(" PUBLIC \"" + notationHash.get("publicId") + "\""); if (notationHash.containsKey("systemId")) notationString.append(" SYSTEM \"" + notationHash.get("systemId") + "\""); notationString.append(">"); if (Specification.getInstance().isPrettyXDFOutput()) notationString.append(Constants.NEW_LINE); } else { Log.warnln("Notation entry lacks name, ignoring entry\n"); } } } if(entityString.length() > 0 || notationString.length() > 0 ) { writeOut(outputstream, " ["); if(entityString.length() > 0) writeOut(outputstream, entityString.toString()); if (notationString.length() > 0 ) writeOut(outputstream, notationString.toString()); writeOut(outputstream, "]"); } writeOut(outputstream, ">"); | private void writeXMLDeclToOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs ) { // initial statement writeOut(outputstream, "<?xml"); writeOut(outputstream, " version=\"" + Specification.getInstance().getXMLSpecVersion() + "\""); // print attributes Enumeration keys = XMLDeclAttribs.keys(); while ( keys.hasMoreElements() ) { String attribName = (String) keys.nextElement(); if (attribName.equals("version") ) { Log.errorln("XMLDeclAttrib hash has version attribute, not allowed and ignoring."); } else if ( attribName.equals("dtdName") || attribName.equals("rootName") ) { // skip over it } else writeOut(outputstream, " " + attribName + "=\"" + XMLDeclAttribs.get(attribName) + "\""); } writeOut(outputstream, " ?>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); // Print the DOCTYPE DECL only if right info exists if (XMLDeclAttribs.containsKey("rootName") && XMLDeclAttribs.containsKey("dtdName")) { // print the DOCTYPE DECL IF its a structure node if(classXDFNodeName != null && classXDFNodeName.equals(Specification.getInstance().getXDFStructureNodeName()) ) { writeOut(outputstream, "<!DOCTYPE " + XMLDeclAttribs.get("rootName") + " SYSTEM \"" + XMLDeclAttribs.get("dtdName") + "\">"); } if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); } else Log.errorln("Passed XMLDeclAttributes table lacks either dtdName, rootName entries, ignoring DOCTYPE line printout"); } |
Log.errorln("Passed XMLDeclAttributes table lacks either dtdName, rootName entries, ignoring DOCTYPE line printout"); | Log.errorln("Passed XMLDeclAttributes table lacks either dtdName or rootName entries, ignoring DOCTYPE line printout"); | private void writeXMLDeclToOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs ) { // initial statement writeOut(outputstream, "<?xml"); writeOut(outputstream, " version=\"" + Specification.getInstance().getXMLSpecVersion() + "\""); // print attributes Enumeration keys = XMLDeclAttribs.keys(); while ( keys.hasMoreElements() ) { String attribName = (String) keys.nextElement(); if (attribName.equals("version") ) { Log.errorln("XMLDeclAttrib hash has version attribute, not allowed and ignoring."); } else if ( attribName.equals("dtdName") || attribName.equals("rootName") ) { // skip over it } else writeOut(outputstream, " " + attribName + "=\"" + XMLDeclAttribs.get(attribName) + "\""); } writeOut(outputstream, " ?>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); // Print the DOCTYPE DECL only if right info exists if (XMLDeclAttribs.containsKey("rootName") && XMLDeclAttribs.containsKey("dtdName")) { // print the DOCTYPE DECL IF its a structure node if(classXDFNodeName != null && classXDFNodeName.equals(Specification.getInstance().getXDFStructureNodeName()) ) { writeOut(outputstream, "<!DOCTYPE " + XMLDeclAttribs.get("rootName") + " SYSTEM \"" + XMLDeclAttribs.get("dtdName") + "\">"); } if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); } else Log.errorln("Passed XMLDeclAttributes table lacks either dtdName, rootName entries, ignoring DOCTYPE line printout"); } |
AncestorListener[] ls = getAncestorListeners(); AncestorEvent ev = new AncestorEvent(this, AncestorEvent.ANCESTOR_ADDED, this, parent); for (int i = 0; i < ls.length; i++) { ls[i].ancestorAdded(ev); } | fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED); | public void addNotify() { super.addNotify(); // let parents inherit the keybord mapping InputMap input = getInputMap(); ActionMap actions = getActionMap(); Container parent = getParent(); while ((parent != null) && (parent instanceof JComponent)) { JComponent jParent = (JComponent) parent; InputMap parentInput = jParent.getInputMap(); ActionMap parentAction = jParent.getActionMap(); KeyStroke[] ikeys = input.keys(); for (int i = 0; i < ikeys.length; i++) { Object o = input.get(ikeys[i]); parentInput.put(ikeys[i], o); } Object[] akeys = actions.keys(); for (int i = 0; i < akeys.length; i++) { Action a = actions.get(akeys[i]); parentAction.put(akeys[i], a); } parent = jParent.getParent(); } // notify ancestor listeners AncestorListener[] ls = getAncestorListeners(); AncestorEvent ev = new AncestorEvent(this, AncestorEvent.ANCESTOR_ADDED, this, parent); for (int i = 0; i < ls.length; i++) { ls[i].ancestorAdded(ev); } // fire property change event for 'ancestor' firePropertyChange("ancestor", null, parent); } |
g.setFont (this.getFont()); g.setColor (this.getForeground()); return g; | Graphics g2 = g; int options = getDebugGraphicsOptions(); if (options != DebugGraphics.NONE_OPTION) { if (!(g2 instanceof DebugGraphics)) g2 = new DebugGraphics(g); DebugGraphics dg = (DebugGraphics) g2; dg.setDebugOptions(dg.getDebugOptions() | options); } g2.setFont(this.getFont()); g2.setColor(this.getForeground()); return g2; | protected Graphics getComponentGraphics(Graphics g) { g.setFont (this.getFont()); g.setColor (this.getForeground()); return g; } |
return 0; | String option = System.getProperty("gnu.javax.swing.DebugGraphics"); int options = debugGraphicsOptions; if (option != null && option.length() != 0) { if (options < 0) options = 0; if (option.equals("LOG")) options |= DebugGraphics.LOG_OPTION; else if (option.equals("FLASH")) options |= DebugGraphics.FLASH_OPTION; } return options; | public int getDebugGraphicsOptions() { return 0; } |
AncestorListener[] ls = getAncestorListeners(); AncestorEvent ev = new AncestorEvent(this, AncestorEvent.ANCESTOR_ADDED, this, parent); for (int i = 0; i < ls.length; i++) { ls[i].ancestorAdded(ev); } | fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED); | public void removeNotify() { super.removeNotify(); // let parents inherit the keybord mapping InputMap input = getInputMap(); ActionMap actions = getActionMap(); Container parent = getParent(); while ((parent != null) && (parent instanceof JComponent)) { JComponent jParent = (JComponent) parent; InputMap parentInput = jParent.getInputMap(); ActionMap parentAction = jParent.getActionMap(); KeyStroke[] ikeys = input.allKeys(); for (int i = 0; i < ikeys.length; i++) { parentInput.remove(ikeys[i]); } Object[] akeys = actions.allKeys(); for (int i = 0; i < akeys.length; i++) { parentAction.remove(akeys[i]); } parent = jParent.getParent(); } // notify ancestor listeners AncestorListener[] ls = getAncestorListeners(); AncestorEvent ev = new AncestorEvent(this, AncestorEvent.ANCESTOR_ADDED, this, parent); for (int i = 0; i < ls.length; i++) { ls[i].ancestorAdded(ev); } // fire property change event for 'ancestor' firePropertyChange("ancestor", parent, null); } |
if (v == true) fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED); else fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED); | public void setVisible(boolean v) { // No need to do anything if the actual value doesn't change. if (isVisible() == v) return; super.setVisible(v); Container parent = getParent(); if (parent != null) parent.repaint(getX(), getY(), getWidth(), getHeight()); revalidate(); } |
|
if (blockSize < 2048) { return false; } | public boolean supports(PartitionTableEntry pte, byte[] firstSector, FSBlockDeviceAPI devApi) { if (pte != null) { // CD-ROM's do not have a partition table. return false; } else { try { final int blockSize = devApi.getSectorSize(); final int offset = blockSize * 16; final byte[] data = new byte[ blockSize]; devApi.read(offset, data, 0, data.length); final String id = new String(data, 1, 5, "US-ASCII"); //System.out.println("id=" + id); return id.equals("CD001"); } catch (IOException ex) { // Ignore } return false; } } |
|
if (md == null) throw new IllegalArgumentException("Message digest MUST NOT be null"); | protected BaseSignature(String schemeName, IMessageDigest md) { super(); this.schemeName = schemeName; this.md = md; } |
|
return schemeName; | return schemeName + "-" + md.name(); | public String name() { return schemeName; } |
this(1); | this(10); | public StringContent() { this(1); } |
CssParser cp = new CssParser(); try { cp.parse(base, new StringReader(rule), false, false); } catch (IOException io) { } | public void addRule(String rule) { // FIXME: Not implemented. } |
|
if (member < 1) throw new IllegalArgumentException("member may not be less than 1"); | public NumberUpSupported(int member) { super(member); } |
|
public void ctx(Context a_context) | public Context ctx() | public void ctx(Context a_context) { m_context = a_context; } |
m_context = a_context; | return m_context; | public void ctx(Context a_context) { m_context = a_context; } |
m_sys_ex = ObjectCreator.readSystemException(input); | m_sys_ex = ObjectCreator.readSystemException(input, m_rph.service_context); | private void p_invoke() throws SystemException, ForwardRequest { binaryReply response = submit(); if (m_rph == null) m_rph = response.header.create_reply_header(); cdrBufInput input = response.getStream(); input.setOrb(orb); m_rph.read(input); // The stream must be aligned sinve v1.2, but only once. boolean align = response.header.version.since_inclusive(1, 2); switch (m_rph.reply_status) { case ReplyHeader.NO_EXCEPTION : NamedValue arg; // Read return value, if set. if (m_result != null) { if (align) { input.align(8); align = false; } m_result.value().read_value(input, m_result.value().type()); } // Read returned parameters, if set. if (m_args != null) for (int i = 0; i < m_args.count(); i++) { try { arg = m_args.item(i); // Both ARG_INOUT and ARG_OUT have this binary flag set. if ((arg.flags() & ARG_OUT.value) != 0) { if (align) { input.align(8); align = false; } arg.value().read_value(input, arg.value().type()); } } catch (Bounds ex) { Unexpected.error(ex); } } if (m_interceptor != null) m_interceptor.receive_reply(m_info); break; case ReplyHeader.SYSTEM_EXCEPTION : if (align) { input.align(8); align = false; } readExceptionId(input); m_sys_ex = ObjectCreator.readSystemException(input); m_environment.exception(m_sys_ex); if (m_interceptor != null) m_interceptor.receive_exception(m_info); throw m_sys_ex; case ReplyHeader.USER_EXCEPTION : if (align) { input.align(8); align = false; } readExceptionId(input); // Prepare an Any that will hold the exception. gnuAny exc = new gnuAny(); exc.setOrb(orb); exc.insert_Streamable(new streamReadyHolder(input)); UnknownUserException unuex = new UnknownUserException(exc); m_environment.exception(unuex); if (m_interceptor != null) m_interceptor.receive_exception(m_info); break; case ReplyHeader.LOCATION_FORWARD_PERM : case ReplyHeader.LOCATION_FORWARD : if (response.header.version.since_inclusive(1, 2)) input.align(8); IOR forwarded = new IOR(); try { forwarded._read_no_endian(input); } catch (IOException ex) { new MARSHAL("Cant read forwarding info", 5103, CompletionStatus.COMPLETED_NO ); } setIor(forwarded); m_forward_ior = forwarded; if (m_interceptor != null) m_interceptor.receive_other(m_info); // Repeat with the forwarded information. p_invoke(); return; default : throw new MARSHAL("Unknow reply status", 8100 + m_rph.reply_status, CompletionStatus.COMPLETED_NO ); } } |
byte[] r = new byte[ response_header.message_size ]; int n = 0; reading: while (n < r.length) | byte [] r; if (orb instanceof Functional_ORB) | public synchronized binaryReply submit() throws ForwardRequest { gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader(); header.setBigEndian(Big_endian); // The byte order will be Big Endian by default. header.message_type = gnu.CORBA.GIOP.MessageHeader.REQUEST; header.version = useVersion(ior.Internet.version); RequestHeader rh = header.create_request_header(); rh.operation = m_operation; rh.object_key = ior.key; // Update interceptor. m_rqh = rh; if (m_interceptor != null) m_interceptor.send_request(m_info); // Prepare the submission. cdrBufOutput request_part = new cdrBufOutput(); request_part.setOffset(header.getHeaderSize()); request_part.setVersion(header.version); request_part.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets)); request_part.setOrb(orb); request_part.setBigEndian(header.isBigEndian()); // This also sets the stream encoding to the encoding, specified // in the header. rh.write(request_part); if (m_args != null && m_args.count() > 0) { write_parameters(header, request_part); if (m_parameter_buffer != null) throw new BAD_INV_ORDER("Please either add parameters or " + "write them into stream, but not both " + "at once." ); } if (m_parameter_buffer != null) { write_parameter_buffer(header, request_part); } // Now the message size is available. header.message_size = request_part.buffer.size(); Socket socket = null; java.lang.Object key = ior.Internet.host + ":" + ior.Internet.port; synchronized (SocketRepository.class) { socket = SocketRepository.get_socket(key); } try { long pause = PAUSE_INITIAL; if (socket == null) { // The BindException may be thrown under very heavy parallel // load. For some time, just wait, exceptiong the socket to free. Open: for (int i = 0; i < PAUSE_STEPS; i++) { try { socket = new Socket(ior.Internet.host, ior.Internet.port); break Open; } catch (BindException ex) { try { // Expecting to free a socket via finaliser. System.gc(); Thread.sleep(pause); pause = pause * 2; if (pause > PAUSE_MAX) pause = PAUSE_MAX; } catch (InterruptedException iex) { } } } } if (socket == null) throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port + " in use" ); socket.setKeepAlive(true); OutputStream socketOutput = socket.getOutputStream(); // Write the message header. header.write(socketOutput); // Write the request header and parameters (if present). request_part.buffer.writeTo(socketOutput); socketOutput.flush(); if (!socket.isClosed()) { MessageHeader response_header = new MessageHeader(); InputStream socketInput = socket.getInputStream(); response_header.read(socketInput); byte[] r = new byte[ response_header.message_size ]; int n = 0; reading: while (n < r.length) { n += socketInput.read(r, n, r.length - n); } return new binaryReply(orb, response_header, r); } else return EMPTY; } catch (IOException io_ex) { MARSHAL m = new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" + ior.Internet.port, 10000 + ior.Internet.port, CompletionStatus.COMPLETED_NO ); m.initCause(io_ex); throw m; } finally { try { if (socket != null && !socket.isClosed()) { socket.setSoTimeout(Functional_ORB.TANDEM_REQUESTS); SocketRepository.put_socket(key, socket); } } catch (IOException scx) { InternalError ierr = new InternalError(); ierr.initCause(scx); throw ierr; } } } |
n += socketInput.read(r, n, r.length - n); | Functional_ORB fo = (Functional_ORB) orb; r =response_header.readMessage(socketInput, socket, fo.TOUT_WHILE_READING, fo.TOUT_AFTER_RECEIVING); | public synchronized binaryReply submit() throws ForwardRequest { gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader(); header.setBigEndian(Big_endian); // The byte order will be Big Endian by default. header.message_type = gnu.CORBA.GIOP.MessageHeader.REQUEST; header.version = useVersion(ior.Internet.version); RequestHeader rh = header.create_request_header(); rh.operation = m_operation; rh.object_key = ior.key; // Update interceptor. m_rqh = rh; if (m_interceptor != null) m_interceptor.send_request(m_info); // Prepare the submission. cdrBufOutput request_part = new cdrBufOutput(); request_part.setOffset(header.getHeaderSize()); request_part.setVersion(header.version); request_part.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets)); request_part.setOrb(orb); request_part.setBigEndian(header.isBigEndian()); // This also sets the stream encoding to the encoding, specified // in the header. rh.write(request_part); if (m_args != null && m_args.count() > 0) { write_parameters(header, request_part); if (m_parameter_buffer != null) throw new BAD_INV_ORDER("Please either add parameters or " + "write them into stream, but not both " + "at once." ); } if (m_parameter_buffer != null) { write_parameter_buffer(header, request_part); } // Now the message size is available. header.message_size = request_part.buffer.size(); Socket socket = null; java.lang.Object key = ior.Internet.host + ":" + ior.Internet.port; synchronized (SocketRepository.class) { socket = SocketRepository.get_socket(key); } try { long pause = PAUSE_INITIAL; if (socket == null) { // The BindException may be thrown under very heavy parallel // load. For some time, just wait, exceptiong the socket to free. Open: for (int i = 0; i < PAUSE_STEPS; i++) { try { socket = new Socket(ior.Internet.host, ior.Internet.port); break Open; } catch (BindException ex) { try { // Expecting to free a socket via finaliser. System.gc(); Thread.sleep(pause); pause = pause * 2; if (pause > PAUSE_MAX) pause = PAUSE_MAX; } catch (InterruptedException iex) { } } } } if (socket == null) throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port + " in use" ); socket.setKeepAlive(true); OutputStream socketOutput = socket.getOutputStream(); // Write the message header. header.write(socketOutput); // Write the request header and parameters (if present). request_part.buffer.writeTo(socketOutput); socketOutput.flush(); if (!socket.isClosed()) { MessageHeader response_header = new MessageHeader(); InputStream socketInput = socket.getInputStream(); response_header.read(socketInput); byte[] r = new byte[ response_header.message_size ]; int n = 0; reading: while (n < r.length) { n += socketInput.read(r, n, r.length - n); } return new binaryReply(orb, response_header, r); } else return EMPTY; } catch (IOException io_ex) { MARSHAL m = new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" + ior.Internet.port, 10000 + ior.Internet.port, CompletionStatus.COMPLETED_NO ); m.initCause(io_ex); throw m; } finally { try { if (socket != null && !socket.isClosed()) { socket.setSoTimeout(Functional_ORB.TANDEM_REQUESTS); SocketRepository.put_socket(key, socket); } } catch (IOException scx) { InternalError ierr = new InternalError(); ierr.initCause(scx); throw ierr; } } } |
MARSHAL m = new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" + ior.Internet.port, 10000 + ior.Internet.port, | COMM_FAILURE m = new COMM_FAILURE("Unable to open a socket at " + ior.Internet.host + ":" + ior.Internet.port, 0xC9, | public synchronized binaryReply submit() throws ForwardRequest { gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader(); header.setBigEndian(Big_endian); // The byte order will be Big Endian by default. header.message_type = gnu.CORBA.GIOP.MessageHeader.REQUEST; header.version = useVersion(ior.Internet.version); RequestHeader rh = header.create_request_header(); rh.operation = m_operation; rh.object_key = ior.key; // Update interceptor. m_rqh = rh; if (m_interceptor != null) m_interceptor.send_request(m_info); // Prepare the submission. cdrBufOutput request_part = new cdrBufOutput(); request_part.setOffset(header.getHeaderSize()); request_part.setVersion(header.version); request_part.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets)); request_part.setOrb(orb); request_part.setBigEndian(header.isBigEndian()); // This also sets the stream encoding to the encoding, specified // in the header. rh.write(request_part); if (m_args != null && m_args.count() > 0) { write_parameters(header, request_part); if (m_parameter_buffer != null) throw new BAD_INV_ORDER("Please either add parameters or " + "write them into stream, but not both " + "at once." ); } if (m_parameter_buffer != null) { write_parameter_buffer(header, request_part); } // Now the message size is available. header.message_size = request_part.buffer.size(); Socket socket = null; java.lang.Object key = ior.Internet.host + ":" + ior.Internet.port; synchronized (SocketRepository.class) { socket = SocketRepository.get_socket(key); } try { long pause = PAUSE_INITIAL; if (socket == null) { // The BindException may be thrown under very heavy parallel // load. For some time, just wait, exceptiong the socket to free. Open: for (int i = 0; i < PAUSE_STEPS; i++) { try { socket = new Socket(ior.Internet.host, ior.Internet.port); break Open; } catch (BindException ex) { try { // Expecting to free a socket via finaliser. System.gc(); Thread.sleep(pause); pause = pause * 2; if (pause > PAUSE_MAX) pause = PAUSE_MAX; } catch (InterruptedException iex) { } } } } if (socket == null) throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port + " in use" ); socket.setKeepAlive(true); OutputStream socketOutput = socket.getOutputStream(); // Write the message header. header.write(socketOutput); // Write the request header and parameters (if present). request_part.buffer.writeTo(socketOutput); socketOutput.flush(); if (!socket.isClosed()) { MessageHeader response_header = new MessageHeader(); InputStream socketInput = socket.getInputStream(); response_header.read(socketInput); byte[] r = new byte[ response_header.message_size ]; int n = 0; reading: while (n < r.length) { n += socketInput.read(r, n, r.length - n); } return new binaryReply(orb, response_header, r); } else return EMPTY; } catch (IOException io_ex) { MARSHAL m = new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" + ior.Internet.port, 10000 + ior.Internet.port, CompletionStatus.COMPLETED_NO ); m.initCause(io_ex); throw m; } finally { try { if (socket != null && !socket.isClosed()) { socket.setSoTimeout(Functional_ORB.TANDEM_REQUESTS); SocketRepository.put_socket(key, socket); } } catch (IOException scx) { InternalError ierr = new InternalError(); ierr.initCause(scx); throw ierr; } } } |
throw new MARSHAL("Unable to write method arguments to CDR output."); | MARSHAL m = new MARSHAL("Unable to write method arguments to CDR output."); m.minor = Minor.CDR; throw m; | protected void write_parameter_buffer(MessageHeader header, cdrBufOutput request_part ) throws MARSHAL { try { if (header.version.since_inclusive(1, 2)) { request_part.align(8); } m_parameter_buffer.buffer.writeTo(request_part); } catch (IOException ex) { throw new MARSHAL("Unable to write method arguments to CDR output."); } } |
public SplitPaneDividerBorder(Color highlight, Color shadow) | public SplitPaneDividerBorder() | public SplitPaneDividerBorder(Color highlight, Color shadow) { this.highlight = (highlight != null) ? highlight : Color.white; this.shadow = (shadow != null) ? shadow : Color.black; } |
this.highlight = (highlight != null) ? highlight : Color.white; this.shadow = (shadow != null) ? shadow : Color.black; | public SplitPaneDividerBorder(Color highlight, Color shadow) { this.highlight = (highlight != null) ? highlight : Color.white; this.shadow = (shadow != null) ? shadow : Color.black; } |
|
return (highlight.getAlpha() == 255) && (shadow.getAlpha() == 255); | return true; | public boolean isBorderOpaque() { return (highlight.getAlpha() == 255) && (shadow.getAlpha() == 255); } |
Color highlight = UIManager.getColor("SplitPane.highlight"); Color shadow = UIManager.getColor("SplitPane.shadow"); | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Color oldColor, dcol; int x2, y2; JSplitPane sp; sp = getSplitPane(c); if (sp == null) return; x2 = x + width - 1; y2 = y + height - 1; oldColor = g.getColor(); dcol = c.getBackground(); try { switch (sp.getOrientation()) { case JSplitPane.HORIZONTAL_SPLIT: g.setColor(dcol); g.drawLine(x + 1, y, x2 - 1, y); g.drawLine(x + 1, y2, x2 - 1, y2); g.setColor(sp.getLeftComponent() != null ? highlight : dcol); g.drawLine(x, y, x, y2); g.setColor(sp.getRightComponent() != null ? shadow : dcol); g.drawLine(x2, y, x2, y2); break; case JSplitPane.VERTICAL_SPLIT: g.setColor(dcol); g.drawLine(x, y + 1, x, y2 - 1); g.drawLine(x2, y + 1, x2, y2 - 1); g.setColor(sp.getTopComponent() != null ? highlight : dcol); g.drawLine(x, y, x2, y); g.setColor(sp.getBottomComponent() != null ? shadow : dcol); g.drawLine(x, y2, x2, y2); break; } } finally { g.setColor(oldColor); } } |
|
return new SplitPaneDividerBorder( UIManager.getColor("SplitPane.highlight"), UIManager.getColor("SplitPane.darkShadow")); | return new SplitPaneDividerBorder(); | public static Border getSplitPaneDividerBorder() { /* See comment in methods above for why this border is not shared. */ return new SplitPaneDividerBorder( UIManager.getColor("SplitPane.highlight"), UIManager.getColor("SplitPane.darkShadow")); } |
MyFileChooser pcFileChooser = new MyFileChooser(workingDir); | TN5250jFileChooser pcFileChooser = new TN5250jFileChooser(workingDir); | private void getEditor() { String workingDir = System.getProperty("user.dir"); MyFileChooser pcFileChooser = new MyFileChooser(workingDir); int ret = pcFileChooser.showOpenDialog(this); // check to see if something was actually chosen if (ret == JFileChooser.APPROVE_OPTION) { File file = pcFileChooser.getSelectedFile(); try { editor.setText(file.getCanonicalPath()); } catch (IOException e) { } } } |
MyFileChooser pcFileChooser = new MyFileChooser(workingDir); | TN5250jFileChooser pcFileChooser = new TN5250jFileChooser(workingDir); | private void getPCFile() { String workingDir = System.getProperty("user.dir"); MyFileChooser pcFileChooser = new MyFileChooser(workingDir); // set the file filters for the file chooser ExportFileFilter filter; if (((String)cvtType.getSelectedItem()).equals(LangTool.getString("spool.toPDF"))) filter = new ExportFileFilter("pdf","PDF Files"); else filter = new ExportFileFilter("txt","Text Files"); pcFileChooser.addChoosableFileFilter(filter ); int ret = pcFileChooser.showSaveDialog(this); // check to see if something was actually chosen if (ret == JFileChooser.APPROVE_OPTION) { File file = pcFileChooser.getSelectedFile(); pcPathInfo.setText(filter.setExtension(file)); } } |
public void addPropertyChangeListener(PropertyChangeListener listener) {} | public void addPropertyChangeListener(PropertyChangeListener listener) { super.addPropertyChangeListener(listener); } | public void addPropertyChangeListener(PropertyChangeListener listener) {} |
public AccessibleStateSet getAccessibleStateSet() { return null; } | public AccessibleStateSet getAccessibleStateSet() { return super.getAccessibleStateSet(); } | public AccessibleStateSet getAccessibleStateSet() { return null; } |
{ Graphics g2 = g; Image doubleBuffer = null; RepaintManager rm = RepaintManager.currentManager(this); if (isDoubleBuffered() && (rm.isDoubleBufferingEnabled()) && (! Thread.holdsLock(paintLock))) { doubleBuffer = rm.getOffscreenBuffer(this, getWidth(), getHeight()); } synchronized (paintLock) { if (doubleBuffer != null) { g2 = doubleBuffer.getGraphics(); g2.setClip(g.getClipBounds()); } g2 = getComponentGraphics(g2); paintComponent(g2); paintBorder(g2); paintChildren(g2); if (doubleBuffer != null) g.drawImage(doubleBuffer, 0, 0, (ImageObserver) null); } } | { paintComponent(g); paintBorder(g); paintChildren(g); } | public void paint(Graphics g) { Graphics g2 = g; Image doubleBuffer = null; RepaintManager rm = RepaintManager.currentManager(this); if (isDoubleBuffered() && (rm.isDoubleBufferingEnabled()) && (! Thread.holdsLock(paintLock))) { doubleBuffer = rm.getOffscreenBuffer(this, getWidth(), getHeight()); } synchronized (paintLock) { if (doubleBuffer != null) { g2 = doubleBuffer.getGraphics(); g2.setClip(g.getClipBounds()); } g2 = getComponentGraphics(g2); paintComponent(g2); paintBorder(g2); paintChildren(g2); if (doubleBuffer != null) g.drawImage(doubleBuffer, 0, 0, (ImageObserver) null); } } |
protected void paintChildren(Graphics g) { super.paint(g); } | protected void paintChildren(Graphics g) { Component[] children = getComponents(); for (int i = children.length - 1; i >= 0; --i) { if (!children[i].isVisible()) continue; Rectangle bounds = children[i].getBounds(); Rectangle oldClip = g.getClipBounds(); if (oldClip == null) oldClip = bounds; Rectangle clip = oldClip.intersection(bounds); if (clip.isEmpty()) continue; boolean translated = false; try { g.setClip(clip.x, clip.y, clip.width, clip.height); g.translate(bounds.x, bounds.y); translated = true; children[i].paint(g); } finally { if (translated) g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); } } } | protected void paintChildren(Graphics g) { super.paint(g); } |
{ | { Hashtable t = getClientProperties(); Object old = t.get(key); | public final void putClientProperty(Object key, Object value) { if (value != null) getClientProperties().put(key, value); else getClientProperties().remove(key); } |
getClientProperties().put(key, value); | t.put(key, value); | public final void putClientProperty(Object key, Object value) { if (value != null) getClientProperties().put(key, value); else getClientProperties().remove(key); } |
getClientProperties().remove(key); } | t.remove(key); firePropertyChange(key.toString(), old, value); } | public final void putClientProperty(Object key, Object value) { if (value != null) getClientProperties().put(key, value); else getClientProperties().remove(key); } |
return checking; | return rootPaneCheckingEnabled; | protected boolean isRootPaneCheckingEnabled() { return checking; } |
checking = enabled; | rootPaneCheckingEnabled = enabled; | protected void setRootPaneCheckingEnabled(boolean enabled) { checking = enabled; } |
sendEMail.release(); sendEMail = null; | public void run() {// if (parent == null)// parent = new JFrame(); try { if (sendEMail.send()) {// JOptionPane.showMessageDialog(// parent,// LangTool.getString("em.confirmationMessage")// + " "// + (String) toAddress.getSelectedItem(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_MESSAGE);//// if (session != null) {// config.setProperty(// "emailTo",// getToTokens(// config.getStringProperty("emailTo"),// toAddress));// config.saveSessionProps();// setToCombo(config.getStringProperty("emailTo"), toAddress);// } }// } catch (IOException ioe) {// System.out.println(ioe.getMessage()); } catch (Exception ex) { System.out.println(ex.getMessage()); } } |
|
setSendEMail(sem); new Thread(this).start(); | myThread.start(); | private void sendIt(Frame parent, SendEMail sem) { setSendEMail(sem); new Thread(this).start();// if (parent == null)// parent = new JFrame();//// try {// if (sem.send()) {//// JOptionPane.showMessageDialog(// parent,// LangTool.getString("em.confirmationMessage")// + " "// + (String) toAddress.getSelectedItem(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_MESSAGE);//// if (session != null) {// config.setProperty(// "emailTo",// getToTokens(// config.getStringProperty("emailTo"),// toAddress));// config.saveSessionProps();// setToCombo(config.getStringProperty("emailTo"), toAddress);// }// }// } catch (IOException ioe) {// System.out.println(ioe.getMessage());// } catch (Exception ex) {// System.out.println(ex.getMessage());// } } |
attachmentName.setText(""); | if (fileName != null || fileName.length() > 0) attachmentName.setText(fileName); else attachmentName.setText(""); | private JPanel setupMailPanel(String fileName) { JPanel semp = new JPanel(); semp.setLayout(new GridBagLayout()); text = new JRadioButton(LangTool.getString("em.text")); graphic = new JRadioButton(LangTool.getString("em.graphic")); normal = new JRadioButton(LangTool.getString("em.normalmail"),true); screenshot = new JRadioButton(LangTool.getString("em.screenshot")); // Group the radio buttons. ButtonGroup tGroup = new ButtonGroup(); tGroup.add(text); tGroup.add(graphic); ButtonGroup mGroup = new ButtonGroup(); mGroup.add(normal); mGroup.add(screenshot); text.setSelected(false); text.setEnabled(false); graphic.setEnabled(false); JLabel screenDump = new JLabel(LangTool.getString("em.screendump")); JLabel tol = new JLabel(LangTool.getString("em.to")); JLabel subl = new JLabel(LangTool.getString("em.subject")); JLabel bodyl = new JLabel(LangTool.getString("em.body")); JLabel fnl = new JLabel(LangTool.getString("em.fileName")); JLabel tom = new JLabel(LangTool.getString("em.typeofmail")); browse = new JButton(LangTool.getString("em.choosefile")); browse.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { browse_actionPerformed(e); } }); toAddress = new JComboBox(); toAddress.setPreferredSize(new Dimension(175, 25)); toAddress.setEditable(true); subject = new JTextField(30); bodyText = new JTextArea(6, 30); JScrollPane bodyScrollPane = new JScrollPane(bodyText); bodyScrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); bodyScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); attachmentName = new JTextField(fileName, 30); attachmentName.setText(""); text.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { setAttachmentName(); } }); normal.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { setTypeOfMail(); } }); if (sendScreen) { screenshot.setSelected(true); } else { normal.setSelected(true); } config = null; if (session != null) { config = session.getConfiguration(); if (config.isPropertyExists("emailTo")) { setToCombo(config.getStringProperty("emailTo"), toAddress); } } semp.setBorder(BorderFactory.createEtchedBorder()); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); semp.add(tom, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 15, 5, 5); semp.add(normal, gbc); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 45, 5, 10); semp.add(screenshot, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 10, 5, 5); semp.add(screenDump, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 15, 5, 5); semp.add(text, gbc); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 45, 5, 10); semp.add(graphic, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); semp.add(tol, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); semp.add(toAddress, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); semp.add(subl, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); semp.add(subject, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.gridheight = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); semp.add(bodyl, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.gridwidth = 2; gbc.gridheight = 3; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); semp.add(bodyScrollPane, gbc); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 7; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 5, 5); semp.add(fnl, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 7; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 10); semp.add(attachmentName, gbc); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 8; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(5, 5, 10, 10); semp.add(browse, gbc); return semp; } |
return attr != null && attr.containsAttributes(this) | return getAttributeCount() == attr.getAttributeCount() | public boolean isEqual(AttributeSet attr) { return attr != null && attr.containsAttributes(this) && this.containsAttributes(attr); } |
if (editorKit == null) setEditorKit(createDefaultEditorKit()); | public EditorKit getEditorKit() { return editorKit; } |
|
else if (evt.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY)) closeFrame(frame); | public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(JInternalFrame.IS_MAXIMUM_PROPERTY)) { if (frame.isMaximum()) maximizeFrame(frame); else minimizeFrame(frame); } else if (evt.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY)) closeFrame(frame); else if (evt.getPropertyName().equals(JInternalFrame.IS_ICON_PROPERTY)) { if (frame.isIcon()) iconifyFrame(frame); else deiconifyFrame(frame); } else if (evt.getPropertyName().equals(JInternalFrame.IS_SELECTED_PROPERTY)) { if (frame.isSelected()) activateFrame(frame); else getDesktopManager().deactivateFrame(frame); } else if (evt.getPropertyName().equals(JInternalFrame.ROOT_PANE_PROPERTY) || evt.getPropertyName().equals(JInternalFrame.GLASS_PANE_PROPERTY)) { Component old = (Component) evt.getOldValue(); old.removeMouseListener(glassPaneDispatcher); old.removeMouseMotionListener(glassPaneDispatcher); Component newPane = (Component) evt.getNewValue(); newPane.addMouseListener(glassPaneDispatcher); newPane.addMouseMotionListener(glassPaneDispatcher); frame.revalidate(); } /* FIXME: need to add ancestor properties to JComponents. else if (evt.getPropertyName().equals(JComponent.ANCESTOR_PROPERTY)) { if (desktopPane != null) desktopPane.removeComponentListener(componentListener); desktopPane = frame.getDesktopPane(); if (desktopPane != null) desktopPane.addComponentListener(componentListener); } */ } |
|
DesktopManager value = frame.getDesktopPane().getDesktopManager(); | DesktopManager value = null; JDesktopPane pane = frame.getDesktopPane(); if (pane != null) value = frame.getDesktopPane().getDesktopManager(); | protected DesktopManager getDesktopManager() { DesktopManager value = frame.getDesktopPane().getDesktopManager(); if (value == null) value = createDesktopManager(); return value; } |
int count = event.getClickCount(); if (count >= 2) { int newDot = getComponent().viewToModel(event.getPoint()); JTextComponent t = getComponent(); try { if (count == 3) t.select(Utilities.getRowStart(t, newDot), Utilities.getRowEnd(t, newDot)); else { int nextWord = Utilities.getNextWord(t, newDot); if (newDot == nextWord) t.select(nextWord, Utilities.getNextWord(t, nextWord)); else { int previousWord = Utilities.getPreviousWord(t, newDot); int previousWordEnd = Utilities.getWordEnd(t, previousWord); if (newDot >= previousWordEnd && newDot <= nextWord) t.select(previousWordEnd, nextWord); else t.select(previousWord, previousWordEnd); } } } catch(BadLocationException ble) { } dot = newDot; } | public void mouseClicked(MouseEvent event) { // TODO: Implement double- and triple-click behaviour here. } |
|
if (event.isShiftDown()) moveCaret(event); else | public void mousePressed(MouseEvent event) { positionCaret(event); } |
|
int dot = getDot(); | dot = Math.min(dot, textComponent.getDocument().getLength()); dot = Math.max(dot, 0); | public void paint(Graphics g) { JTextComponent comp = getComponent(); if (comp == null) return; int dot = getDot(); Rectangle rect = null; try { rect = textComponent.modelToView(dot); } catch (BadLocationException e) { AssertionError ae; ae = new AssertionError("Unexpected bad caret location: " + dot); ae.initCause(e); throw ae; } if (rect == null) return; // Check if paint has possibly been called directly, without a previous // call to damage(). In this case we need to do some cleanup first. if ((x != rect.x) || (y != rect.y)) { repaint(); // Erase previous location of caret. x = rect.x; y = rect.y; width = 1; height = rect.height; } // Now draw the caret on the new position if visible. if (visible) { g.setColor(textComponent.getCaretColor()); g.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height); } } |
initStageDone = true; | setRootPaneCheckingEnabled(true); | public JApplet() { super.setLayout(new BorderLayout(1, 1)); getRootPane(); // Will do set/create. initStageDone = true; // Init stage is now over. } |
if (!initStageDone) | if (isRootPaneCheckingEnabled()) getContentPane().add(comp, constraints, index); else | protected void addImpl(Component comp, Object constraints, int index) { // If we're adding in the initialization stage use super.add. // Otherwise pass the add onto the content pane. if (!initStageDone) super.addImpl(comp, constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JApplet directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } } |
else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JApplet directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } | protected void addImpl(Component comp, Object constraints, int index) { // If we're adding in the initialization stage use super.add. // Otherwise pass the add onto the content pane. if (!initStageDone) super.addImpl(comp, constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JApplet directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } } |
|
if (initStageDone) { | public void setLayout(LayoutManager manager) { // Check if we're in initialization stage. If so, call super.setLayout // otherwise, valid calls go to the content pane if (initStageDone) { if (isRootPaneCheckingEnabled()) throw new Error("Cannot set layout. Use getContentPane().setLayout()" + "instead."); getContentPane().setLayout(manager); } else super.setLayout(manager); } |
|
throw new Error("Cannot set layout. Use getContentPane().setLayout()" + "instead."); | public void setLayout(LayoutManager manager) { // Check if we're in initialization stage. If so, call super.setLayout // otherwise, valid calls go to the content pane if (initStageDone) { if (isRootPaneCheckingEnabled()) throw new Error("Cannot set layout. Use getContentPane().setLayout()" + "instead."); getContentPane().setLayout(manager); } else super.setLayout(manager); } |
|
} | public void setLayout(LayoutManager manager) { // Check if we're in initialization stage. If so, call super.setLayout // otherwise, valid calls go to the content pane if (initStageDone) { if (isRootPaneCheckingEnabled()) throw new Error("Cannot set layout. Use getContentPane().setLayout()" + "instead."); getContentPane().setLayout(manager); } else super.setLayout(manager); } |
|
Log.debug("in TaggedXMLDataIOStyle, constructor"); | public TaggedXMLDataIOStyle(Array parentArray) { Log.debug("in TaggedXMLDataIOStyle, constructor"); this.parentArray = parentArray; } |
|
writeOut(outputstream, "<" + TagToAxisNodeName + " axisIdRef=\"" + axisId + "\"" + " tag = \"" + tag + "\"/>"); | writeOut(outputstream, "<" + TagToAxisNodeName + " axisIdRef=\""); writeOutAttribute(outputstream, axisId); writeOut(outputstream, "\""); writeOut(outputstream, " tag = \""); writeOutAttribute(outputstream, tag); writeOut(outputstream, "\""); | protected void specificIOStyleToXDF( OutputStream outputstream,String indent) { boolean niceOutput = Specification.getInstance().isPrettyXDFOutput(); //write out the tags info String[] tags = getAxisTags(); List axisList = parentArray.getAxisList(); String axisId; String tag; int stop = axisList.size(); synchronized (axisList) { for (int i = 0; i <stop; i++) { axisId = ((AxisInterface) axisList.get(i)).getAxisId(); tag = tags[i]; if (niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + TagToAxisNodeName + " axisIdRef=\"" + axisId + "\"" + " tag = \"" + tag + "\"/>"); } } } |
String strValue = new String(data, bytes_added, bytes_to_add); Log.debugln("AddByteData READCELL string(off:"+bytes_added+" len:"+bytes_to_add+") => ["+strValue+"]"); | private void addByteDataToCurrentArray ( Locator location, byte[] data, int startByte, int endByte, int amount, String endian ) // throws SetDataException throws SAXException { ArrayList commandList = (ArrayList) ((FormattedXMLDataIOStyle) CurrentArray.getXMLDataIOStyle()).getFormatCommands(); int nrofIOCmd = commandList.size(); int bytes_added = startByte; if (endByte > 0 && amount > endByte) amount = endByte; try { while (bytes_added < amount) { FormattedIOCmd currentIOCmd = (FormattedIOCmd) commandList.get(CurrentIOCmdIndex); // readCell if (currentIOCmd instanceof ReadCellFormattedIOCmd) { DataFormat currentDataFormat = DataFormatList[CurrentDataFormatIndex]; int bytes_to_add = currentDataFormat.numOfBytes(); // String strValue = new String(data, bytes_added, bytes_to_add);// Log.errorln("AddByteData READCELL string(off:"+bytes_added+" len:"+bytes_to_add+") => ["+strValue+"]"); if ( currentDataFormat instanceof IntegerDataFormat || currentDataFormat instanceof FloatDataFormat ) { String thisData = new String(data,bytes_added,bytes_to_add);// Log.errorln("Got Href Formatted Number Data:["+thisData.trim()+ "]["+bytes_added+"]["+bytes_to_add+"]"); try { addDataToCurrentArray(location, thisData.trim(), currentDataFormat, IntRadix[CurrentDataFormatIndex]); } catch (SetDataException e) { throw new SetDataException("Unable to setData:["+thisData+"], ignoring request"+e.getMessage()); } } else if (currentDataFormat instanceof StringDataFormat) { String thisData = new String(data,bytes_added,bytes_to_add);// Log.errorln("Got Href Formatted Character Data:["+thisData+ "]["+bytes_added+"]["+bytes_to_add+"]"); try { addDataToCurrentArray(location, thisData, currentDataFormat, IntRadix[CurrentDataFormatIndex]); } catch (SetDataException e) { throw new SetDataException("Unable to setData:["+thisData+"], ignoring request"+e.getMessage()); } } else if (currentDataFormat instanceof BinaryFloatDataFormat) { if (bytes_to_add == 4) { float myValue = convert4bytesToFloat(endian, data, bytes_added); //Log.errorln("Got Href Data BFloatSingle:["+myValue.toString()+"]["+bytes_added+"]["+bytes_to_add+"]"); CurrentArray.setData(location, myValue); } else if (bytes_to_add == 8) { // Log.errorln("Got Href Data BFloatDouble:["+myValue.toString()+"]["+bytes_added+"]["+bytes_to_add+"]"); double myValue = convert8bytesToDouble(endian, data, bytes_added); CurrentArray.setData(location, myValue); } else { Log.errorln("Error: got floating point with bit size != (32|64). Ignoring data."); } } else if (currentDataFormat instanceof BinaryIntegerDataFormat) { // short myValue = convert2bytesToShort (endian, data, bytes_added); // Log.errorln("Got Href Data Integer:["+myValue+ "]["+bytes_added+"]["+bytes_to_add+"]"); // int numOfBytes = ((BinaryIntegerDataFormat) currentDataFormat).numOfBytes(); // int myValue = convertBytesToInteger (bytes_to_add, endian, data, bytes_added); // CurrentArray.setData(location, myValue); // is it better to use a dispatch table here? switch (bytes_to_add) { case 1: { // 8-bit short val = convert1byteToShort (data, bytes_added); CurrentArray.setData(location, val); break; } case 2: { // 16-bit short val = convert2bytesToShort (endian, data, bytes_added); CurrentArray.setData(location, val); break; } case 3: { // 24-bit (unusual) int val = convert3bytesToInt (endian, data, bytes_added); CurrentArray.setData(location, val); break; } case 4: { // 32-bit int val = convert4bytesToInt (endian, data, bytes_added); CurrentArray.setData(location, val); break; } case 8: { // 64-bit long val = convert8bytesToLong (endian, data, bytes_added); CurrentArray.setData(location, val); break; } default: Log.errorln("XDF Can't handle binary integers of byte size:"+bytes_to_add+". Aborting!"); System.exit(-1); } } // advance the data pointer to next location location.next(); // advance our global pointer to the current DataFormat if (NrofDataFormats > 1) if (CurrentDataFormatIndex == (NrofDataFormats - 1)) CurrentDataFormatIndex = 0; else CurrentDataFormatIndex++; bytes_added += bytes_to_add; } else if (currentIOCmd instanceof SkipCharFormattedIOCmd) { Integer bytes_to_skip = ((SkipCharFormattedIOCmd) currentIOCmd).getCount(); bytes_added += bytes_to_skip.intValue(); } else if (currentIOCmd instanceof RepeatFormattedIOCmd) { // shouldnt happen Log.errorln("Argh getFormatCommands not working right, got repeat command in addByteData!!!"); System.exit(-1); } // advance our global pointer to the current IOCmd if (nrofIOCmd> 1) if (CurrentIOCmdIndex == (nrofIOCmd - 1)) CurrentIOCmdIndex = 0; else CurrentIOCmdIndex++; } } catch (SetDataException e) { throw new SAXException("Failed to load external data at byte_read:"+bytes_added+" msg:"+e.getMessage()); } } |
|
Thread printerThread = new PrinterThread(screen,font,numCols,numRows,colorBg); | Thread printerThread = new PrinterThread(screen, font, numCols, numRows, colorBg, (Session)gui); | public final void printMe() { Thread printerThread = new PrinterThread(screen,font,numCols,numRows,colorBg); printerThread.start(); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.