rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); }
g.drawLine(x + 2, y + h - 2, x + w - 1, y + h - 2); break; case SwingConstants.BOTTOM: g.setColor(shadow); g.drawLine(x + w - 2, y, x + w - 2, y + h - 2);
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Color saved = g.getColor(); if (! isSelected || tabPlacement != SwingConstants.TOP) { g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); } if (! isSelected || tabPlacement != SwingConstants.LEFT) { g.setColor(darkShadow); g.drawLine(x + w, y, x + w, y + h); g.setColor(shadow); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); } if (! isSelected || tabPlacement != SwingConstants.RIGHT) { g.setColor(lightHighlight); g.drawLine(x, y, x, y + h); } if (! isSelected || tabPlacement != SwingConstants.BOTTOM) { g.setColor(lightHighlight); g.drawLine(x, y, x + w, y); } g.setColor(saved); }
if (! isSelected || tabPlacement != SwingConstants.RIGHT) {
g.drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); g.setColor(darkShadow); g.drawLine(x + w - 1, y, x + w - 1, y + h - 3); g.drawLine(x + w - 1, y + h - 2, x + w - 3, y + h); g.drawLine(x + 2, y + h, x + w - 4, y + h);
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Color saved = g.getColor(); if (! isSelected || tabPlacement != SwingConstants.TOP) { g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); } if (! isSelected || tabPlacement != SwingConstants.LEFT) { g.setColor(darkShadow); g.drawLine(x + w, y, x + w, y + h); g.setColor(shadow); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); } if (! isSelected || tabPlacement != SwingConstants.RIGHT) { g.setColor(lightHighlight); g.drawLine(x, y, x, y + h); } if (! isSelected || tabPlacement != SwingConstants.BOTTOM) { g.setColor(lightHighlight); g.drawLine(x, y, x + w, y); } g.setColor(saved); }
g.drawLine(x, y, x, y + h); }
g.drawLine(x, y, x, y + h - 3);
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Color saved = g.getColor(); if (! isSelected || tabPlacement != SwingConstants.TOP) { g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); } if (! isSelected || tabPlacement != SwingConstants.LEFT) { g.setColor(darkShadow); g.drawLine(x + w, y, x + w, y + h); g.setColor(shadow); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); } if (! isSelected || tabPlacement != SwingConstants.RIGHT) { g.setColor(lightHighlight); g.drawLine(x, y, x, y + h); } if (! isSelected || tabPlacement != SwingConstants.BOTTOM) { g.setColor(lightHighlight); g.drawLine(x, y, x + w, y); } g.setColor(saved); }
if (! isSelected || tabPlacement != SwingConstants.BOTTOM) {
g.drawLine(x, y + h - 2, x + 1, y + h - 1); break; case SwingConstants.RIGHT:
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Color saved = g.getColor(); if (! isSelected || tabPlacement != SwingConstants.TOP) { g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); } if (! isSelected || tabPlacement != SwingConstants.LEFT) { g.setColor(darkShadow); g.drawLine(x + w, y, x + w, y + h); g.setColor(shadow); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); } if (! isSelected || tabPlacement != SwingConstants.RIGHT) { g.setColor(lightHighlight); g.drawLine(x, y, x, y + h); } if (! isSelected || tabPlacement != SwingConstants.BOTTOM) { g.setColor(lightHighlight); g.drawLine(x, y, x + w, y); } g.setColor(saved); }
g.drawLine(x, y, x + w, y);
g.drawLine(x, y, x + w - 3, y); g.setColor(darkShadow); g.drawLine(x + w - 2, y + 1, x + w - 1, y + 2); g.drawLine(x + w - 1, y + 3, x + w - 1, y + h - 3); g.drawLine(x + w - 2, y + h - 2, x + w - 3, y + h - 1); g.drawLine(x, y + h - 1, x + w - 4, y + h - 1); g.setColor(shadow); g.drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); g.drawLine(x, y + h - 2, x + w - 3, y + h - 2); break;
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Color saved = g.getColor(); if (! isSelected || tabPlacement != SwingConstants.TOP) { g.setColor(shadow); g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); g.setColor(darkShadow); g.drawLine(x, y + h, x + w, y + h); } if (! isSelected || tabPlacement != SwingConstants.LEFT) { g.setColor(darkShadow); g.drawLine(x + w, y, x + w, y + h); g.setColor(shadow); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); } if (! isSelected || tabPlacement != SwingConstants.RIGHT) { g.setColor(lightHighlight); g.drawLine(x, y, x, y + h); } if (! isSelected || tabPlacement != SwingConstants.BOTTOM) { g.setColor(lightHighlight); g.drawLine(x, y, x + w, y); } g.setColor(saved); }
default:
protected static void rotateInsets(Insets topInsets, Insets targetInsets, int targetPlacement) { // Sun's version will happily throw an NPE if params are null, // so I won't check it either. switch (targetPlacement) { case SwingConstants.TOP: targetInsets.top = topInsets.top; targetInsets.left = topInsets.left; targetInsets.right = topInsets.right; targetInsets.bottom = topInsets.bottom; break; case SwingConstants.LEFT: targetInsets.left = topInsets.top; targetInsets.top = topInsets.left; targetInsets.right = topInsets.bottom; targetInsets.bottom = topInsets.right; break; case SwingConstants.BOTTOM: targetInsets.top = topInsets.bottom; targetInsets.bottom = topInsets.top; targetInsets.left = topInsets.left; targetInsets.right = topInsets.right; break; case SwingConstants.RIGHT: targetInsets.top = topInsets.left; targetInsets.left = topInsets.bottom; targetInsets.bottom = topInsets.right; targetInsets.right = topInsets.top; break; } }
}
protected void selectAdjacentRunTab(int tabPlacement, int tabIndex, int offset) { int x = rects[tabIndex].x + rects[tabIndex].width / 2; int y = rects[tabIndex].y + rects[tabIndex].height / 2; switch (tabPlacement) { case SwingConstants.TOP: case SwingConstants.BOTTOM: y += offset; break; case SwingConstants.RIGHT: case SwingConstants.LEFT: x += offset; break; } int index = tabForCoordinate(tabPane, x, y); if (index != -1) tabPane.setSelectedIndex(index); }
tabPane.setSelectedIndex(getNextTabIndex(current));
current = getNextTabIndex(current); if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) scrollTab(current, tabPane.getTabPlacement()); tabPane.setSelectedIndex(current);
protected void selectNextTab(int current) { tabPane.setSelectedIndex(getNextTabIndex(current)); }
tabPane.setSelectedIndex(getNextTabIndexInRun(tabPane.getTabCount(), current));
current = getNextTabIndexInRun(tabPane.getTabCount(), current); if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) scrollTab(current, tabPane.getTabPlacement()); tabPane.setSelectedIndex(current);
protected void selectNextTabInRun(int current) { tabPane.setSelectedIndex(getNextTabIndexInRun(tabPane.getTabCount(), current)); }
tabPane.setSelectedIndex(getPreviousTabIndex(current));
current = getPreviousTabIndex(current); if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) scrollTab(current, tabPane.getTabPlacement()); tabPane.setSelectedIndex(current);
protected void selectPreviousTab(int current) { tabPane.setSelectedIndex(getPreviousTabIndex(current)); }
tabPane.setSelectedIndex(getPreviousTabIndexInRun(tabPane.getTabCount(), current));
current = getPreviousTabIndexInRun(tabPane.getTabCount(), current); if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) scrollTab(current, tabPane.getTabPlacement()); tabPane.setSelectedIndex(current);
protected void selectPreviousTabInRun(int current) { tabPane.setSelectedIndex(getPreviousTabIndexInRun(tabPane.getTabCount(), current)); }
int index = -1;
int index = tabPane.getSelectedIndex();
public int tabForCoordinate(JTabbedPane pane, int x, int y) { if (! tabPane.isValid()) tabPane.validate(); int tabCount = tabPane.getTabCount(); int index = -1; for (int i = 0; i < tabCount; ++i) { if (rects[i].contains(x, y)) { index = i; break; } } // FIXME: Handle scrollable tab layout. return index; }
if (incrButton != null) tabPane.remove(incrButton); if (decrButton != null) tabPane.remove(decrButton); if (viewport != null) tabPane.remove(viewport);
protected void uninstallComponents() { // Nothing to be done. }
LookAndFeel.installColorsAndFont(tabPane, "TabbedPane.background", "TabbedPane.foreground", "TabbedPane.font");
selectedColor = null;
protected void uninstallDefaults() { calcRect = null; tabAreaRect = null; contentRect = null; tabRuns = null; contentBorderInsets = null; tabAreaInsets = null; selectedTabPadInsets = null; tabInsets = null; focus = null; darkShadow = null; shadow = null; lightHighlight = null; highlight = null; // Install UI colors and fonts. LookAndFeel.installColorsAndFont(tabPane, "TabbedPane.background", "TabbedPane.foreground", "TabbedPane.font"); }
throws NotImplementedException
protected void uninstallKeyboardActions() throws NotImplementedException { // FIXME: Implement. }
SwingUtilities.replaceUIActionMap(tabPane, null); SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_FOCUSED, null); SwingUtilities .replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
protected void uninstallKeyboardActions() throws NotImplementedException { // FIXME: Implement. }
if (incrButton != null) incrButton.removeMouseListener(mouseListener); if (decrButton != null) decrButton.removeMouseListener(mouseListener); if (panel != null) { panel.removeMouseListener(mouseListener); panel.removeFocusListener(focusListener); }
protected void uninstallListeners() { tabPane.removeFocusListener(focusListener); tabPane.removePropertyChangeListener(propertyChangeListener); tabPane.removeChangeListener(tabChangeListener); tabPane.removeMouseListener(mouseListener); focusListener = null; propertyChangeListener = null; tabChangeListener = null; mouseListener = null; }
if (sPrettyXDFOutput) {
if (Specification.getInstance().isPrettyXDFOutput()) {
private void nestedToXDF(OutputStream outputstream, String indent, int which, int stop) { String delimiter = getDelimiter(); String repeatable = getRepeatable(); String recordTerminator = getRecordTerminator(); if (which > stop) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + classXDFNodeName); if (delimiter !=null) writeOut(outputstream, " delimiter =\"" + delimiter + "\""); writeOut(outputstream, " repeatable=\"" + repeatable + "\""); if (recordTerminator !=null) writeOut(outputstream, " recordTerminator=\"" + recordTerminator + "\"/>"); } else { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + UntaggedInstructionNodeName + " axisIdRef=\""); writeOut(outputstream, ((AxisInterface) parentArray.getAxisList().get(which)).getAxisId() + "\">"); which++; nestedToXDF(outputstream, indent + sPrettyXDFOutputIndentation, which, stop); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + UntaggedInstructionNodeName + ">"); } }
nestedToXDF(outputstream, indent + sPrettyXDFOutputIndentation, which, stop);
nestedToXDF(outputstream, indent + Specification.getInstance().getPrettyXDFOutputIndentation(), which, stop);
private void nestedToXDF(OutputStream outputstream, String indent, int which, int stop) { String delimiter = getDelimiter(); String repeatable = getRepeatable(); String recordTerminator = getRecordTerminator(); if (which > stop) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + classXDFNodeName); if (delimiter !=null) writeOut(outputstream, " delimiter =\"" + delimiter + "\""); writeOut(outputstream, " repeatable=\"" + repeatable + "\""); if (recordTerminator !=null) writeOut(outputstream, " recordTerminator=\"" + recordTerminator + "\"/>"); } else { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + UntaggedInstructionNodeName + " axisIdRef=\""); writeOut(outputstream, ((AxisInterface) parentArray.getAxisList().get(which)).getAxisId() + "\">"); which++; nestedToXDF(outputstream, indent + sPrettyXDFOutputIndentation, which, stop); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + UntaggedInstructionNodeName + ">"); } }
sel.clear();
setSelectionInterval(index0, index1);
public void addSelectionInterval(int index0, int index1) { int lo = Math.min(index0, index1); int hi = Math.max(index0, index1); oldSel = sel.clone(); if (selectionMode == SINGLE_SELECTION) sel.clear(); // COMPAT: Like Sun (but not like IBM), we allow calls to // addSelectionInterval when selectionMode is // SINGLE_SELECTION_INTERVAL iff the interval being added // is adjacent to an already selected interval if (selectionMode == SINGLE_INTERVAL_SELECTION) if (!(isSelectedIndex(index0) || isSelectedIndex(index1) || isSelectedIndex(Math.max(lo-1,0)) || isSelectedIndex(Math.min(hi+1,sel.size())))) sel.clear(); if (selectionMode == SINGLE_SELECTION) index0 = index1; // We have to update the anchorSelectionIndex and leadSelectionIndex // variables // The next if statements breaks down to "if this selection is adjacent // to the previous selection and going in the same direction" if ((isSelectedIndex(leadSelectionIndex)) && ((index0 - 1 == leadSelectionIndex && (index1 >= index0) && (leadSelectionIndex >= anchorSelectionIndex)) || (index0 + 1 == leadSelectionIndex && (index1 <= index0) && (leadSelectionIndex <= anchorSelectionIndex))) && (anchorSelectionIndex != -1 || leadSelectionIndex != -1)) { // setting setLeadCalledFromAdd to true tells setLeadSelectionIndex // not to update oldSel setLeadCalledFromAdd = true; setLeadSelectionIndex(index1); setLeadCalledFromAdd = false; } else { leadSelectionIndex = index1; anchorSelectionIndex = index0; sel.set(lo, hi+1); if (sel.equals(oldSel) == false) fireValueChanged(lo, hi, valueIsAdjusting); } }
if (selectionMode == SINGLE_SELECTION) index0 = index1;
public void addSelectionInterval(int index0, int index1) { int lo = Math.min(index0, index1); int hi = Math.max(index0, index1); oldSel = sel.clone(); if (selectionMode == SINGLE_SELECTION) sel.clear(); // COMPAT: Like Sun (but not like IBM), we allow calls to // addSelectionInterval when selectionMode is // SINGLE_SELECTION_INTERVAL iff the interval being added // is adjacent to an already selected interval if (selectionMode == SINGLE_INTERVAL_SELECTION) if (!(isSelectedIndex(index0) || isSelectedIndex(index1) || isSelectedIndex(Math.max(lo-1,0)) || isSelectedIndex(Math.min(hi+1,sel.size())))) sel.clear(); if (selectionMode == SINGLE_SELECTION) index0 = index1; // We have to update the anchorSelectionIndex and leadSelectionIndex // variables // The next if statements breaks down to "if this selection is adjacent // to the previous selection and going in the same direction" if ((isSelectedIndex(leadSelectionIndex)) && ((index0 - 1 == leadSelectionIndex && (index1 >= index0) && (leadSelectionIndex >= anchorSelectionIndex)) || (index0 + 1 == leadSelectionIndex && (index1 <= index0) && (leadSelectionIndex <= anchorSelectionIndex))) && (anchorSelectionIndex != -1 || leadSelectionIndex != -1)) { // setting setLeadCalledFromAdd to true tells setLeadSelectionIndex // not to update oldSel setLeadCalledFromAdd = true; setLeadSelectionIndex(index1); setLeadCalledFromAdd = false; } else { leadSelectionIndex = index1; anchorSelectionIndex = index0; sel.set(lo, hi+1); if (sel.equals(oldSel) == false) fireValueChanged(lo, hi, valueIsAdjusting); } }
if (selectionMode == SINGLE_SELECTION) setSelectionInterval (leadIndex, leadIndex);
public void setLeadSelectionIndex(int leadIndex) { int oldLeadIndex = leadSelectionIndex; if (oldLeadIndex == -1) oldLeadIndex = leadIndex; if (setLeadCalledFromAdd == false) oldSel = sel.clone(); leadSelectionIndex = leadIndex; if (anchorSelectionIndex == -1) return; int R1 = Math.min(anchorSelectionIndex, oldLeadIndex); int R2 = Math.max(anchorSelectionIndex, oldLeadIndex); int S1 = Math.min(anchorSelectionIndex, leadIndex); int S2 = Math.max(anchorSelectionIndex, leadIndex); int lo = Math.min(R1, S1); int hi = Math.max(R2, S2); if (isSelectedIndex(anchorSelectionIndex)) { sel.clear(R1, R2+1); sel.set(S1, S2+1); } else { sel.set(R1, R2+1); sel.clear(S1, S2+1); } int beg = sel.nextSetBit(0), end = -1; for(int i=beg; i >= 0; i=sel.nextSetBit(i+1)) end = i; if (sel.equals(oldSel) == false) fireValueChanged(beg, end, valueIsAdjusting); }
if ((r && isRollover()) || (!r && !isRollover()))
if (r == isRollover())
public void setRollover(boolean r) { // if this call does not represent a CHANGE in state, then return if ((r && isRollover()) || (!r && !isRollover())) return; // cannot set ROLLOVER property unless button is enabled if (!isEnabled()) return; // make the change if (r) stateMask = stateMask | ROLLOVER; else stateMask = stateMask & (~ROLLOVER); // notify interested ChangeListeners fireStateChanged(); }
null, ItemEvent.SELECTED));
this, ItemEvent.SELECTED));
public void setSelected(boolean s) { // if this call does not represent a CHANGE in state, then return if ((s && isSelected()) || (!s && !isSelected())) return; // make the change if (s) stateMask = stateMask | SELECTED; else stateMask = stateMask & (~SELECTED); // notify interested ChangeListeners fireStateChanged(); // fire ItemStateChanged events if (s) { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.SELECTED)); if (group != null) group.setSelected(this, true); } else { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.DESELECTED)); if (group != null) group.setSelected(this, false); } }
null, ItemEvent.DESELECTED));
this, ItemEvent.DESELECTED));
public void setSelected(boolean s) { // if this call does not represent a CHANGE in state, then return if ((s && isSelected()) || (!s && !isSelected())) return; // make the change if (s) stateMask = stateMask | SELECTED; else stateMask = stateMask & (~SELECTED); // notify interested ChangeListeners fireStateChanged(); // fire ItemStateChanged events if (s) { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.SELECTED)); if (group != null) group.setSelected(this, true); } else { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.DESELECTED)); if (group != null) group.setSelected(this, false); } }
protected DSSKey(BigInteger p, BigInteger q, BigInteger g)
protected DSSKey(int defaultFormat, BigInteger p, BigInteger q, BigInteger g)
protected DSSKey(BigInteger p, BigInteger q, BigInteger g) { super(); this.p = p; this.q = q; this.g = g; }
this.defaultFormat = defaultFormat <= 0 ? Registry.RAW_ENCODING_ID : defaultFormat;
protected DSSKey(BigInteger p, BigInteger q, BigInteger g) { super(); this.p = p; this.q = q; this.g = g; }
if (c.isOpaque() && UIManager.get("MenuBar.gradient") != null)
int height = c.getHeight(); if (c.isOpaque() && UIManager.get("MenuBar.gradient") != null && c.getBackground() instanceof UIResource && height > 2)
public void update(Graphics g, JComponent c) { if (c.isOpaque() && UIManager.get("MenuBar.gradient") != null) { MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(), SwingConstants.VERTICAL, "MenuBar.gradient"); paint(g, c); } else super.update(g, c); }
MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(),
MetalUtils.paintGradient(g, 0, 0, c.getWidth(), height - 2,
public void update(Graphics g, JComponent c) { if (c.isOpaque() && UIManager.get("MenuBar.gradient") != null) { MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(), SwingConstants.VERTICAL, "MenuBar.gradient"); paint(g, c); } else super.update(g, c); }
if (_instance == null) { initialize(); _instance = this; }
System.setProperty("python.cachedir", System.getProperty("user.home") + File.separator + ".tn5250j" + File.separator); if (_instance == null) { initialize(); _instance = this; }
public GlobalConfigure() { if (_instance == null) { // initialize the settings information initialize(); // set our instance to this one. _instance = this; } }
if (noWhiteSpaceList.length() > 0) Log.errorln("Got non-whitespace character data for algorithm valueList. Ignoring."); return;
if (noWhiteSpaceList.length() > 0) { Log.errorln("Got non-whitespace character data for valueList with size attribute! Ignoring."); return; } else { Log.warnln("Got size attribute set on delimited valueList. Ignoring attribute."); }
public void action (SaxDocumentHandler handler, char buf [], int offset, int len) { // IF we get here, we have the delmited case for populating // a value list. // 1. set up information we need // our string that we will parse String valueListString = new String (buf, offset, len); ValueList thisValueList = CurrentValueList; // safety check if (!thisValueList.getIsDelimitedCase() ) { String noWhiteSpaceList = valueListString.trim(); if (noWhiteSpaceList.length() > 0) Log.errorln("Got non-whitespace character data for algorithm valueList. Ignoring."); return; } // 2. reconsitute information we need String parentNodeName = thisValueList.getParentNodeName(); // 3. add these values to the lookup table, if the original valueList had an ID String valueListId = thisValueList.getValueListId(); if (valueListId != null) { // a warning check, just in case if (ValueListObj.containsKey(valueListId)) Log.warnln("More than one valueList node with valueListId=\""+valueListId+"\", using latest node." ); // add the valueList array into the list of valueList objects ValueListObj.put(valueListId, thisValueList); } // 4. If there is a reference object, clone it to get // the new valueList String valueListIdRef = thisValueList.getValueListIdRef(); if (valueListIdRef != null) { if (ValueListObj.containsKey(valueListIdRef)) { // Just a simple clone since we have stored the ArrayList rather than the // ValueList object (which actually doesnt exist. :P ValueList refValueListObj = (ValueList) ValueListObj.get(valueListIdRef); try { thisValueList = (ValueList) refValueListObj.clone(); } catch (java.lang.CloneNotSupportedException e) { Log.errorln("Weird error, cannot clone valueList object. Aborting read."); System.exit(-1); }// This is missing. Should allow override. // later note to self: Huh?? /* // override attrs with those in passed list // strValueList.setAttributes(attrs); // give the clone a unique Id and remove IdRef // strValueList.setValueListId(findUniqueIdName(ValueListObj,strValueList.getValueListId())); // strValueList.setValueListIdRef(null); // add this into the list of valueList objects // ValueListObj.put(strValueList.getValueListId(), strValueList);*/ } else { Log.warnln("Error: Reader got an valueList with ValueListIdRef=\""+valueListIdRef+"\" but no previous valueList has that id! Ignoring add valueList request."); return; } } // 5. split up string into Value Objects based on declared delimiter ArrayList myValueList = splitStringIntoValueObjects( valueListString, thisValueList); // 6. determine where these values go and then insert them ValueListDelimitedList newValueListObj = new ValueListDelimitedList (myValueList, thisValueList.getDelimiter(), thisValueList.getNoData(), thisValueList.getInfinite(), thisValueList.getInfiniteNegative(), thisValueList.getNotANumber(), thisValueList.getOverflow(), thisValueList.getUnderflow() ); if( parentNodeName.equals(XDFNodeName.AXIS) ) { // get the last axis List axisList = (List) CurrentArray.getAxes(); Axis lastAxisObject = (Axis) axisList.get(axisList.size()-1); lastAxisObject.addAxisValueList(newValueListObj); } else if( parentNodeName.equals(XDFNodeName.PARAMETER) ) { LastParameterObject.addValueList( newValueListObj); } else { Log.errorln("Error: weird parent node "+parentNodeName+" for "+XDFNodeName.VALUELIST+", Ignoring."); } // now add valueObjects to groups Iterator iter = myValueList.iterator(); while (iter.hasNext()) { Value newvalue = (Value) iter.next(); // add this object to all open value groups Iterator groupIter = CurrentValueGroupList.iterator(); while (groupIter.hasNext()) { ValueGroup nextValueGroupObj = (ValueGroup) groupIter.next(); newvalue.addToGroup(nextValueGroupObj); } } CurrentValueList.setIsDelimitedCase(true); // notify that we did the list }
CurrentValueList.init(attribListToHashtable(attrs));
Hashtable attribs = attribListToHashtable(attrs); CurrentValueList.init(attribs);
public Object action (SaxDocumentHandler handler, Attributes attrs) { // 1. re-init CurrentValueList = new ValueList(); // 2. populate ValueListparameters from attribute list CurrentValueList.init(attribListToHashtable(attrs)); // 3. populate ValueListparameters w/ parent name String parentNodeName = getParentNodeName(XDFNodeName.VALUEGROUP); CurrentValueList.setParentNodeName(parentNodeName); // 4. set this parameter to false to indicate the future is not // yet determined for this :) CurrentValueList.setIsDelimitedCase(false); return (Object) null; }
CurrentValueList.setIsDelimitedCase(false);
if (attribs.containsKey("size")) CurrentValueList.setIsDelimitedCase(false); else CurrentValueList.setIsDelimitedCase(true);
public Object action (SaxDocumentHandler handler, Attributes attrs) { // 1. re-init CurrentValueList = new ValueList(); // 2. populate ValueListparameters from attribute list CurrentValueList.init(attribListToHashtable(attrs)); // 3. populate ValueListparameters w/ parent name String parentNodeName = getParentNodeName(XDFNodeName.VALUEGROUP); CurrentValueList.setParentNodeName(parentNodeName); // 4. set this parameter to false to indicate the future is not // yet determined for this :) CurrentValueList.setIsDelimitedCase(false); return (Object) null; }
int myValue = convertBytesToInteger (bytes_to_add, endian, data, bytes_added); CurrentArray.setData(location, myValue);
switch (bytes_to_add) { case 1: { short val = convert1byteToShort (data, bytes_added); CurrentArray.setData(location, val); break; } case 2: { short val = convert2bytesToShort (endian, data, bytes_added); CurrentArray.setData(location, val); break; } case 3: { int val = convert3bytesToInt (endian, data, bytes_added); CurrentArray.setData(location, val); break; } case 4: { int val = convert4bytesToInt (endian, data, bytes_added); CurrentArray.setData(location, val); break; } case 8: { 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); }
private void addByteDataToCurrentArray (Locator location, byte[] data, int amount, String endian) throws SetDataException { ArrayList commandList = (ArrayList) ((FormattedXMLDataIOStyle) CurrentArray.getXMLDataIOStyle()).getFormatCommands(); int nrofIOCmd = commandList.size(); int bytes_added = 0; 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(); 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+"]"); addDataToCurrentArray(location, thisData.trim(), currentDataFormat, IntRadix[CurrentDataFormatIndex]); } 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+"]"); addDataToCurrentArray(location, thisData, currentDataFormat, IntRadix[CurrentDataFormatIndex]); } 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) {// Integer myValue = convert2bytesToInteger (endian, data, bytes_added);// Log.errorln("Got Href Data Integer:["+myValue.toString()+ "]["+bytes_added+"]["+bytes_to_add+"]"); // int numOfBytes = ((BinaryIntegerDataFormat) currentDataFormat).numOfBytes(); int myValue = convertBytesToInteger (bytes_to_add, endian, data, bytes_added); CurrentArray.setData(location, myValue); } // 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++; } }
*/
private void addDataToCurrentArray ( Locator dataLocator, String thisString, DataFormat CurrentDataFormat, int intRadix ) {// this stuff slows down the parser too much to leave commented in.// uncomment as neededLog.info("Add Data:["+thisString+"] (");List axes = dataLocator.getIterationOrder();Iterator liter = axes.iterator();while (liter.hasNext()) { AxisInterface axis = (AxisInterface) liter.next(); Log.info(dataLocator.getAxisIndex(axis)+ " ["+axis.getAxisId()+"],");}Log.infoln(") ["+CurrentDataFormat+"]"); // Note that we dont treat binary data at all here try { if ( CurrentDataFormat instanceof StringDataFormat) { CurrentArray.setData(dataLocator, thisString); } else if ( CurrentDataFormat instanceof FloatDataFormat || CurrentDataFormat instanceof BinaryFloatDataFormat) { Double number = new Double (thisString); CurrentArray.setData(dataLocator, number.doubleValue()); } else if ( CurrentDataFormat instanceof IntegerDataFormat || CurrentDataFormat instanceof BinaryIntegerDataFormat) { // Integer number = new Integer (thisString); if (intRadix == 16) // peal off leading "0x" thisString = thisString.substring(2); int thisInt = 0; // *sigh* parseInt doesnt understand leading "+" signs. We need // to trap those errors an deal with them appropriately try { thisInt = Integer.parseInt(thisString, intRadix); } catch (NumberFormatException e) { if (thisString.startsWith("+")) { thisInt = Integer.parseInt(thisString.substring(1), intRadix); } else { throw e; } } CurrentArray.setData(dataLocator, thisInt); } else { Log.warnln("Unknown data format, unable to setData:["+thisString+"], ignoring request"); } } catch (SetDataException e) { // bizarre error. Cant add data (out of memory??) :P Log.errorln("Unable to setData:["+thisString+"], ignoring request"); Log.printStackTrace(e); } }
return convert1byteToInteger (bb, sbyte);
return convert1byteToInt (bb, sbyte);
private int convertBytesToInteger (int numOfBytes, String endianStyle, byte[] bb, int sbyte) { // is it better to use a dispatch table here? switch (numOfBytes) { case 1: // 8-bit return convert1byteToInteger (bb, sbyte); case 2: // 16-bit return convert2bytesToInteger (endianStyle, bb, sbyte); case 3: // 24-bit (unusual) return convert3bytesToInteger (endianStyle, bb, sbyte); case 4: // 32-bit return convert4bytesToInteger (endianStyle, bb, sbyte); // This will most likely break the Java Integer. Lets not pretend // that we support it yet. Will have to contemplate BigInteger implementation for this. /* case 8: // 64-bit return convert8bytesToLong (endianStyle, bb, sbyte); break; */ default: Log.errorln("XDF Can't handle binary integers of byte size:"+numOfBytes+". Aborting!"); System.exit(-1); return -1; } }
return convert2bytesToInteger (endianStyle, bb, sbyte);
return convert2bytesToInt (endianStyle, bb, sbyte);
private int convertBytesToInteger (int numOfBytes, String endianStyle, byte[] bb, int sbyte) { // is it better to use a dispatch table here? switch (numOfBytes) { case 1: // 8-bit return convert1byteToInteger (bb, sbyte); case 2: // 16-bit return convert2bytesToInteger (endianStyle, bb, sbyte); case 3: // 24-bit (unusual) return convert3bytesToInteger (endianStyle, bb, sbyte); case 4: // 32-bit return convert4bytesToInteger (endianStyle, bb, sbyte); // This will most likely break the Java Integer. Lets not pretend // that we support it yet. Will have to contemplate BigInteger implementation for this. /* case 8: // 64-bit return convert8bytesToLong (endianStyle, bb, sbyte); break; */ default: Log.errorln("XDF Can't handle binary integers of byte size:"+numOfBytes+". Aborting!"); System.exit(-1); return -1; } }
return convert3bytesToInteger (endianStyle, bb, sbyte);
return convert3bytesToInt (endianStyle, bb, sbyte);
private int convertBytesToInteger (int numOfBytes, String endianStyle, byte[] bb, int sbyte) { // is it better to use a dispatch table here? switch (numOfBytes) { case 1: // 8-bit return convert1byteToInteger (bb, sbyte); case 2: // 16-bit return convert2bytesToInteger (endianStyle, bb, sbyte); case 3: // 24-bit (unusual) return convert3bytesToInteger (endianStyle, bb, sbyte); case 4: // 32-bit return convert4bytesToInteger (endianStyle, bb, sbyte); // This will most likely break the Java Integer. Lets not pretend // that we support it yet. Will have to contemplate BigInteger implementation for this. /* case 8: // 64-bit return convert8bytesToLong (endianStyle, bb, sbyte); break; */ default: Log.errorln("XDF Can't handle binary integers of byte size:"+numOfBytes+". Aborting!"); System.exit(-1); return -1; } }
return convert4bytesToInteger (endianStyle, bb, sbyte);
return convert4bytesToInt (endianStyle, bb, sbyte);
private int convertBytesToInteger (int numOfBytes, String endianStyle, byte[] bb, int sbyte) { // is it better to use a dispatch table here? switch (numOfBytes) { case 1: // 8-bit return convert1byteToInteger (bb, sbyte); case 2: // 16-bit return convert2bytesToInteger (endianStyle, bb, sbyte); case 3: // 24-bit (unusual) return convert3bytesToInteger (endianStyle, bb, sbyte); case 4: // 32-bit return convert4bytesToInteger (endianStyle, bb, sbyte); // This will most likely break the Java Integer. Lets not pretend // that we support it yet. Will have to contemplate BigInteger implementation for this. /* case 8: // 64-bit return convert8bytesToLong (endianStyle, bb, sbyte); break; */ default: Log.errorln("XDF Can't handle binary integers of byte size:"+numOfBytes+". Aborting!"); System.exit(-1); return -1; } }
boolean niceOutput = sPrettyXDFOutput;
boolean niceOutput = Specification.getInstance().isPrettyXDFOutput();
public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String strIndent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { boolean niceOutput = sPrettyXDFOutput; String indent = ""; indent = indent + strIndent; String nodeName = getClassXDFNodeName(); //open node if (niceOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + nodeName ); String href = getHref(); if (href !=null) writeOut(outputstream, " href = \"" + href + "\""); Number checksum = getChecksum(); if (checksum !=null) writeOut(outputstream, " checksum = \"" + checksum.toString() + "\""); writeOut(outputstream, ">"); //end of opening code //write out just the data XMLDataIOStyle readObj = parentArray.getXMLDataIOStyle(); OutputStream dataOutputStream; if (href !=null) { //write out to another file, try { dataOutputStream = new FileOutputStream(getHref()); } catch (IOException e) { //oops, sth. is wrong, writ out to the passed in OutputStream dataOutputStream = outputstream; } } else { // no *href* attribute specified, write out to the passed in OutputStream dataOutputStream = outputstream; } Locator currentLocator = parentArray.createLocator(); AxisInterface fastestAxis = (AxisInterface) parentArray.getAxisList().get(0); //stores the NoDataValues for the parentArray, //used in writing out when NoDataException is caught String NoDataValues[] = new String[fastestAxis.getLength()]; if (parentArray.hasFieldAxis()) { DataFormat[] dataFormatList = parentArray.getDataFormatList(); for (int i = 0; i < NoDataValues.length; i++) { DataFormat d = dataFormatList[i]; if (d != null && d.getNoDataValue() != null) NoDataValues[i]=d.getNoDataValue().toString(); } } else { DataFormat d = parentArray.getDataFormat(); for (int i = 0; i < NoDataValues.length; i++) { if (d!=null && d.getNoDataValue() != null) NoDataValues[i] = d.getNoDataValue().toString(); } } if (readObj instanceof TaggedXMLDataIOStyle) { String[] tagOrder = ((TaggedXMLDataIOStyle)readObj).getAxisTags(); int stop = tagOrder.length; String[] tags = new String[stop]; for (int i = stop-1; i >= 0 ; i--) { tags[stop-i-1] = tagOrder[i]; // System.out.println(tagOrder.get(i)); } int[] axes = getMaxDataIndex(); stop =axes.length; int[] axisLength = new int[stop]; for (int i = 0; i < stop; i++) { axisLength[i] =axes[stop - 1 - i]; } writeTaggedData(dataOutputStream, currentLocator, indent, axisLength, tags, 0, fastestAxis, NoDataValues); } //done dealing with with TaggedXMLDataIOSytle else { if (readObj instanceof DelimitedXMLDataIOStyle) { writeDelimitedData( dataOutputStream, currentLocator, (DelimitedXMLDataIOStyle) readObj, fastestAxis, NoDataValues ); } else { writeFormattedData(dataOutputStream, currentLocator, (FormattedXMLDataIOStyle) readObj, fastestAxis, NoDataValues); } } //close the data section appropriately if (niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + nodeName + ">"); if (niceOutput) writeOut(outputstream, Constants.NEW_LINE); }
protected void writeDelimitedData(OutputStream outputstream,
private void writeDelimitedData(OutputStream outputstream,
protected void writeDelimitedData(OutputStream outputstream, Locator locator, DelimitedXMLDataIOStyle readObj, AxisInterface fastestAxis, String[] noDataValues) { String delimiter = readObj.getDelimiter(); String recordTerminator = readObj.getRecordTerminator(); int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; writeOut(outputstream, "<![CDATA["); do { dataNum ++; try { writeOut(outputstream, getStringData(locator)); } catch (NoDataException e) { //double check, a bug here, "yes" is already printed String noData = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noData == null) { readObj.setRepeatable("no"); } else { writeOut(outputstream, noData); } } //write out delimiter anyway writeOut(outputstream, delimiter); if (dataNum == fastestAxisLength) { writeOut(outputstream, recordTerminator); dataNum = 0; } } while (locator.next()); writeOut(outputstream, "]]>"); }
protected void writeFormattedData(OutputStream outputstream ,
private void writeFormattedData(OutputStream outputstream ,
protected void writeFormattedData(OutputStream outputstream , Locator locator, FormattedXMLDataIOStyle readObj, AxisInterface fastestAxis, String[] noDataValues) { writeOut(outputstream, "<![CDATA["); List commands = readObj.getCommands(); synchronized (data) { //double check on sync hasMoreData = locator.hasNext(); while (hasMoreData) recursiveWriteFormattedData(outputstream, locator, commands, fastestAxis, noDataValues); writeOut(outputstream, "]]>"); } }
if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation;
if (Specification.getInstance().isPrettyXDFOutput()) { indent += Specification.getInstance().getPrettyXDFOutputIndentation();
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + sPrettyXDFOutputIndentation); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
if (sPrettyXDFOutput) {
if (Specification.getInstance().isPrettyXDFOutput()) {
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + sPrettyXDFOutputIndentation); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
writeOut(outputstream, indent + sPrettyXDFOutputIndentation);
writeOut(outputstream, indent + Specification.getInstance().getPrettyXDFOutputIndentation());
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + sPrettyXDFOutputIndentation); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
public synchronized void add(String item) {
add(String item) {
public synchronized void add(String item) { if (item == null) throw new NullPointerException("item must be non-null"); pItems.addElement(item); int i = pItems.size() - 1; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, i); } if (i == 0) select(0); }
if (i == 0) select(0); }
}
public synchronized void add(String item) { if (item == null) throw new NullPointerException("item must be non-null"); pItems.addElement(item); int i = pItems.size() - 1; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, i); } if (i == 0) select(0); }
public synchronized void addItem(String item) {
addItem(String item) {
public synchronized void addItem(String item) { add(item); }
public synchronized void addItemListener(ItemListener listener) {
addItemListener(ItemListener listener) {
public synchronized void addItemListener(ItemListener listener) { item_listeners = AWTEventMulticaster.add(item_listeners, listener); }
public void addNotify() {
addNotify() {
public void addNotify() { if (peer == null) peer = getToolkit().createChoice(this); super.addNotify(); }
public int countItems() { return (pItems.size()); }
countItems() { return(pItems.size()); }
public int countItems() { return (pItems.size()); }
public String getItem(int index) { return ((String) pItems.elementAt(index)); }
getItem(int index) { return((String)pItems.elementAt(index)); }
public String getItem(int index) { return ((String) pItems.elementAt(index)); }
public int getItemCount() { return (pItems.size()); }
getItemCount() { return countItems (); }
public int getItemCount() { return (pItems.size()); }
public int getSelectedIndex() { return (selectedIndex); }
getSelectedIndex() { return(selectedIndex); }
public int getSelectedIndex() { return (selectedIndex); }
public synchronized String getSelectedItem() { return (selectedIndex == -1 ? null : ((String) pItems.elementAt(selectedIndex))); }
getSelectedItem() { return (selectedIndex == -1 ? null : ((String)pItems.elementAt(selectedIndex))); }
public synchronized String getSelectedItem() { return (selectedIndex == -1 ? null : ((String) pItems.elementAt(selectedIndex))); }
public synchronized Object[] getSelectedObjects() {
getSelectedObjects() {
public synchronized Object[] getSelectedObjects() { if (selectedIndex == -1) return null; Object[] objs = new Object[1]; objs[0] = pItems.elementAt(selectedIndex); return (objs); }
public synchronized void insert(String item, int index) {
insert(String item, int index) {
public synchronized void insert(String item, int index) { if (index < 0) throw new IllegalArgumentException("index may not be less then 0"); if (index > getItemCount()) index = getItemCount(); pItems.insertElementAt(item, index); if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, index); } if (getItemCount() == 1 || selectedIndex >= index) select(0); }
if (getItemCount() == 1 || selectedIndex >= index) select(0); }
}
public synchronized void insert(String item, int index) { if (index < 0) throw new IllegalArgumentException("index may not be less then 0"); if (index > getItemCount()) index = getItemCount(); pItems.insertElementAt(item, index); if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, index); } if (getItemCount() == 1 || selectedIndex >= index) select(0); }
protected String paramString() {
paramString() {
protected String paramString() { return ("selectedIndex=" + selectedIndex + "," + super.paramString()); }
public synchronized void remove(String item) {
remove(String item) {
public synchronized void remove(String item) { int index = pItems.indexOf(item); if (index == -1) throw new IllegalArgumentException("item \"" + item + "\" not found in Choice"); remove(index); }
public synchronized void removeAll() { int count = getItemCount();
removeAll() { if (getItemCount() <= 0) return;
public synchronized void removeAll() { int count = getItemCount(); for (int i = 0; i < count; i++) { // Always remove 0. remove(0); } }
for (int i = 0; i < count; i++) { remove(0); }
pItems.removeAllElements (); if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.removeAll ();
public synchronized void removeAll() { int count = getItemCount(); for (int i = 0; i < count; i++) { // Always remove 0. remove(0); } }
selectedIndex = -1; }
public synchronized void removeAll() { int count = getItemCount(); for (int i = 0; i < count; i++) { // Always remove 0. remove(0); } }
public synchronized void select(int index) {
select(int index) {
public synchronized void select(int index) { if ((index < 0) || (index > getItemCount())) throw new IllegalArgumentException("Bad index: " + index); this.selectedIndex = index; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.select(index); } }
cp.select(index); }
cp.select (index);
public synchronized void select(int index) { if ((index < 0) || (index > getItemCount())) throw new IllegalArgumentException("Bad index: " + index); this.selectedIndex = index; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.select(index); } }
}
public synchronized void select(int index) { if ((index < 0) || (index > getItemCount())) throw new IllegalArgumentException("Bad index: " + index); this.selectedIndex = index; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.select(index); } }
JRootPane root = SwingUtilities.getRootPane(this); if (root != null && root.getDefaultButton() == this) root.setDefaultButton(null); super.removeNotify();
public void removeNotify() { }
return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28;
if ((year & 3) != 0) return 28; if (year < 1582) return 29; return ((year % 100) != 0 || (year % 400) == 0) ? 29 : 28;
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return 30 + (month & 1); }
else if (month < Calendar.AUGUST) return 31 - (month & 1);
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return 30 + (month & 1); }
return 30 + (month & 1);
return monthArr[month];
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return 30 + (month & 1); }
throw new IllegalArgumentException("month out of range");
throw new IllegalArgumentException("month out of range:" + month);
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range"); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) { // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) { // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; } else { // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; } } return rawOffset + daylightSavings; }
{
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range"); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) { // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) { // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; } else { // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; } } return rawOffset + daylightSavings; }
}
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range"); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) { // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) { // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; } else { // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; } } return rawOffset + daylightSavings; }
return getScrollableUnitIncrement(visibleRect, orientation, direction);
int block; if (orientation == SwingConstants.VERTICAL) block = visibleRect.height; else block = visibleRect.width; return block;
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { return getScrollableUnitIncrement(visibleRect, orientation, direction); }
int delta;
int delta = 0;
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else delta = direction * rowHeight == 0 ? 20 : rowHeight; return delta; }
int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y;
int row = getClosestRowForLocation(0, visibleRect.y); if (row != -1) { Rectangle b = getRowBounds(row); if (b.y != visibleRect.y) { if (direction < 0) delta = Math.max(0, visibleRect.y - b.y); else delta = b.y + b.height - visibleRect.height;
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else delta = direction * rowHeight == 0 ? 20 : rowHeight; return delta; }
delta = direction * rowHeight == 0 ? 20 : rowHeight;
{ if (direction < 0) { if (row != 0) { b = getRowBounds(row - 1); delta = b.height; } } else delta = b.height; } } } else delta = 4;
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else delta = direction * rowHeight == 0 ? 20 : rowHeight; return delta; }
if (selectionModel != null)
public void setSelectionModel(TreeSelectionModel model) { if (selectionModel == model) return; if (selectionModel != null) selectionModel.removeTreeSelectionListener(selectionRedirector); TreeSelectionModel oldValue = selectionModel; selectionModel = model; if (selectionModel != null) selectionModel.addTreeSelectionListener(selectionRedirector); firePropertyChange(SELECTION_MODEL_PROPERTY, oldValue, model); revalidate(); repaint(); }
private LongItem(int kind, int offsetToFP, Register lsb, Register msb, long val) { super(kind, offsetToFP, lsb, msb); this.value = val; }
LongItem(ItemFactory factory) { super(factory); }
private LongItem(int kind, int offsetToFP, Register lsb, Register msb, long val) { super(kind, offsetToFP, lsb, msb); this.value = val; }
return createConst(getValue()); }
return factory.createLConst(getValue()); }
protected DoubleWordItem cloneConstant() { return createConst(getValue()); }
inhibitedRectangle = null;
private void clearLayout() { locationRectangle = null; }
inhibitedRectangle = new Rectangle(10, 0, 25* this.columnWidth, this.rowHeight);
private void doLayout() { if (locationRectangle == null) { Rectangle bounds = this.getBounds(); int x,y,w,h; // Location rectangle w = 6 * this.columnWidth; locationRectangle = new Rectangle(bounds.width - w, 0, w, this.rowHeight); } }
addDirtyRectangle(inhibitedRectangle);
public void onOIAChanged(ScreenOIA oia, int change) { switch (change) { case OIA_CHANGED_BELL: ringAudibleBell(); break; case OIA_CHANGED_CLEAR_SCREEN: break; case OIA_CHANGED_INPUTINHIBITED: break; case OIA_CHANGED_INSERT_MODE: break; case OIA_CHANGED_KEYBOARD_LOCKED: setKeyboardLocked(oia.isKeyBoardLocked()); break; case OIA_CHANGED_KEYS_BUFFERED: break; case OIA_CHANGED_MESSAGELIGHT: break; case OIA_CHANGED_SCRIPT: break; default: // Do nothing } }
paintInhibited(g, clip);
public void paintComponent(Graphics g) { doLayout(); Rectangle clip = g.getClipBounds(); paintRuler(g, clip); paintLocation(g, clip); }
set.removeAttributes(set);
protected void createInputAttributes(Element element, MutableAttributeSet set) { // FIXME: Filter out component, icon and element name attributes. set.addAttributes(element.getAttributes()); }
throw new IOException ("No entry for " + entry_name + " exists.");
throw new FileNotFoundException("No entry for " + entry_name + " exists.");
public synchronized void connect() throws IOException { // Call is ignored if already connected. if (connected) return; jar_url = getJarFileURL(); jar_file = JarFileCache.get (jar_url, useCaches); String entry_name = getEntryName(); if (entry_name != null && !entry_name.equals ("")) { jar_entry = (JarEntry) jar_file.getEntry (entry_name); if(jar_entry == null) throw new IOException ("No entry for " + entry_name + " exists."); } connected = true; }
if (jar_entry == null) throw new IOException (jar_url + " couldn't be found.");
public InputStream getInputStream() throws IOException { if (!connected) connect(); if (! doInput) throw new ProtocolException("Can't open InputStream if doInput is false"); if (jar_entry == null) throw new IOException (jar_url + " couldn't be found."); return jar_file.getInputStream (jar_entry); }
return new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(),
JButton button = new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(),
protected JButton createArrowButton() { return new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(), new CellRendererPane(), listBox); }
button.setMargin(new Insets(0, 1, 1, 3)); return button;
protected JButton createArrowButton() { return new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(), new CellRendererPane(), listBox); }
arrowButton.setText(comboBox.getSelectedItem().toString());
String text = ""; Object selected = comboBox.getSelectedItem(); if (selected != null) text = selected.toString(); arrowButton.setText(text);
protected void editablePropertyChanged(PropertyChangeEvent e) { if (arrowButton instanceof MetalComboBoxButton) { MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; b.setIconOnly(comboBox.isEditable()); } if (comboBox.isEditable()) { arrowButton.setText(null); if (editor != null) editor.setVisible(true); } else { arrowButton.setText(comboBox.getSelectedItem().toString()); if (editor != null) editor.setVisible(true); } }
Dimension result = super.getMinimumSize(c); result.height = result.height + 9; return result;
MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; Icon icon = b.getComboIcon(); Insets insets = b.getInsets(); Dimension d = getDisplaySize(); int insetsH = insets.top + insets.bottom; int insetsW = insets.left + insets.right; int iconWidth = icon.getIconWidth() + 6; return new Dimension(d.width + insetsW + iconWidth, d.height + insetsH);
public Dimension getMinimumSize(JComponent c) { // FIXME: this needs work Dimension result = super.getMinimumSize(c); result.height = result.height + 9; return result; }
public void propertyChange(PropertyChangeEvent event) { String name = event.getPropertyName();
String name = event.getPropertyName();
protected PropertyChangeListener createActionPropertyChangeListener(Action action) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { // Update properties "action" and "horizontalAlignment". String name = event.getPropertyName(); if (name.equals("enabled")) { boolean enabled = ((Boolean) event.getNewValue()).booleanValue(); JTextField.this.setEnabled(enabled); } else if (name.equals(Action.SHORT_DESCRIPTION)) { JTextField.this.setToolTipText((String) event.getNewValue()); } } }; }
Class.forName(ObjectCreator.toHelperName(type.id()));
ObjectCreator.forName(ObjectCreator.toHelperName(type.id()));
void findHelper() { if (helper != null || helper_NA) return; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(type.id())); helper = (BoxedValueHelper) helperClass.newInstance(); } catch (Exception ex) { helper_NA = true; } }
public void send() throws Exception, AddressException, MessagingException {
public boolean send() throws Exception, AddressException, MessagingException {
public void send() throws Exception, AddressException, MessagingException {// try { if(!loadConfig(configFile)) return; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg);// }// catch (SendFailedException sfe) {// System.out.println("Send Failed Exception " + sfe.toString());// JOptionPane.showMessageDialog(parent,// LangTool.getString("em.confirmationMessage") +// " " + tot.getText(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_ERROR);////// }// catch (Exception mex) {// System.out.println(mex.toString());// } }
try {
public void send() throws Exception, AddressException, MessagingException {// try { if(!loadConfig(configFile)) return; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg);// }// catch (SendFailedException sfe) {// System.out.println("Send Failed Exception " + sfe.toString());// JOptionPane.showMessageDialog(parent,// LangTool.getString("em.confirmationMessage") +// " " + tot.getText(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_ERROR);////// }// catch (Exception mex) {// System.out.println(mex.toString());// } }
return;
return false;
public void send() throws Exception, AddressException, MessagingException {// try { if(!loadConfig(configFile)) return; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg);// }// catch (SendFailedException sfe) {// System.out.println("Send Failed Exception " + sfe.toString());// JOptionPane.showMessageDialog(parent,// LangTool.getString("em.confirmationMessage") +// " " + tot.getText(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_ERROR);////// }// catch (Exception mex) {// System.out.println(mex.toString());// } }
return true; } catch (SendFailedException sfe) { showFailedException(sfe); } return false;
public void send() throws Exception, AddressException, MessagingException {// try { if(!loadConfig(configFile)) return; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg);// }// catch (SendFailedException sfe) {// System.out.println("Send Failed Exception " + sfe.toString());// JOptionPane.showMessageDialog(parent,// LangTool.getString("em.confirmationMessage") +// " " + tot.getText(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_ERROR);////// }// catch (Exception mex) {// System.out.println(mex.toString());// } }
throw new BAD_OPERATION();
BAD_OPERATION bad = new BAD_OPERATION(); bad.initCause(ex); bad.minor = Minor.Any; throw bad;
public static NotEmpty extract(Any a) { try { return ((NotEmptyHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { throw new BAD_OPERATION(); } }
if (obj!=null) { if (memberObjHash.add(obj)) return obj; else return null; }
if (memberObjHash.add(obj)) return obj;
public Object addMemberObject (Object obj) { if (obj!=null) { if (memberObjHash.add(obj)) return obj; else return null; } else return null; }
if (obj!=null) { if (memberObjHash.contains(obj)) { return true; } else return false;
if (memberObjHash.contains(obj)) { return true;
public boolean hasMemberObj (Object obj) { if (obj!=null) { if (memberObjHash.contains(obj)) { return true; } else return false; } return false; }