bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
protected void initComponentDefaults(UIDefaults defaults) { Object[] uiDefaults; Color highLight = new Color(249, 247, 246); Color light = new Color(239, 235, 231); Color shadow = new Color(139, 136, 134); Color darkShadow = new Color(16, 16, 16); uiDefaults = new Object[] { "AbstractUndoableEdit.undoText", "Undo", "AbstractUndoableEdit.redoText", "Redo", "Button.background", new ColorUIResource(Color.LIGHT_GRAY), "Button.border", new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { return BasicBorders.getButtonBorder(); } }, "Button.darkShadow", new ColorUIResource(Color.BLACK), "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "Button.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Button.foreground", new ColorUIResource(Color.BLACK), "Button.highlight", new ColorUIResource(Color.WHITE), "Button.light", new ColorUIResource(Color.LIGHT_GRAY), "Button.margin", new InsetsUIResource(2, 2, 2, 2), "Button.shadow", new ColorUIResource(Color.GRAY), "Button.textIconGap", new Integer(4), "Button.textShiftOffset", new Integer(0), "CheckBox.background", new ColorUIResource(new Color(204, 204, 204)), "CheckBox.border", new BorderUIResource.CompoundBorderUIResource(null, null), "CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "CheckBox.font", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBox.foreground", new ColorUIResource(darkShadow), "CheckBox.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getCheckBoxIcon(); } }, "CheckBox.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getMenuItemCheckIcon(); } }, "CheckBox.margin",new InsetsUIResource(2, 2, 2, 2), "CheckBox.textIconGap", new Integer(4), "CheckBox.textShiftOffset", new Integer(0), "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBoxMenuItem.acceleratorForeground", new ColorUIResource(new Color(16, 16, 16)), "CheckBoxMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "CheckBoxMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "CheckBoxMenuItem.background", new ColorUIResource(light), "CheckBoxMenuItem.border", new BasicBorders.MarginBorder(), "CheckBoxMenuItem.borderPainted", Boolean.FALSE, "CheckBoxMenuItem.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getCheckBoxMenuItemIcon(); } }, "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBoxMenuItem.foreground", new ColorUIResource(darkShadow), "CheckBoxMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "CheckBoxMenuItem.selectionBackground", new ColorUIResource(Color.black), "CheckBoxMenuItem.selectionForeground", new ColorUIResource(Color.white), "ColorChooser.background", new ColorUIResource(light), "ColorChooser.cancelText", "Cancel", "ColorChooser.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ColorChooser.foreground", new ColorUIResource(darkShadow), "ColorChooser.hsbBlueText", "B", "ColorChooser.hsbBrightnessText", "B", "ColorChooser.hsbGreenText", "G", "ColorChooser.hsbHueText", "H", "ColorChooser.hsbNameText", "HSB", "ColorChooser.hsbRedText", "R", "ColorChooser.hsbSaturationText", "S", "ColorChooser.okText", "OK", "ColorChooser.previewText", "Preview", "ColorChooser.resetText", "Reset", "ColorChooser.rgbBlueMnemonic", new Integer(66), "ColorChooser.rgbBlueText", "Blue", "ColorChooser.rgbGreenMnemonic", new Integer(71), "ColorChooser.rgbGreenText", "Green", "ColorChooser.rgbNameText", "RGB", "ColorChooser.rgbRedMnemonic", new Integer(82), "ColorChooser.rgbRedText", "Red", "ColorChooser.sampleText", "Sample Text Sample Text", "ColorChooser.swatchesDefaultRecentColor", new ColorUIResource(light), "ColorChooser.swatchesNameText", "Swatches", "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10), "ColorChooser.swatchesRecentText", "Recent:", "ColorChooser.swatchesSwatchSize", new Dimension(10, 10), "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "hidePopup", "PAGE_UP", "pageUpPassThrough", "PAGE_DOWN", "pageDownPassThrough", "HOME", "homePassThrough", "END", "endPassThrough" }), "ComboBox.background", new ColorUIResource(light), "ComboBox.buttonBackground", new ColorUIResource(light), "ComboBox.buttonDarkShadow", new ColorUIResource(shadow), "ComboBox.buttonHighlight", new ColorUIResource(highLight), "ComboBox.buttonShadow", new ColorUIResource(shadow), "ComboBox.disabledBackground", new ColorUIResource(light), "ComboBox.disabledForeground", new ColorUIResource(Color.gray), "ComboBox.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ComboBox.foreground", new ColorUIResource(Color.black), "ComboBox.selectionBackground", new ColorUIResource(Color.black), "ComboBox.selectionForeground", new ColorUIResource(Color.white), "Desktop.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "KP_LEFT", "left", "KP_RIGHT", "right", "ctrl F5", "restore", "LEFT", "left", "ctrl alt F6", "selectNextFrame", "UP", "up", "ctrl F6", "selectNextFrame", "RIGHT", "right", "DOWN", "down", "ctrl F7", "move", "ctrl F8", "resize", "ESCAPE", "escape", "ctrl TAB", "selectNextFrame", "ctrl F9", "minimize", "KP_UP", "up", "ctrl F4", "close", "KP_DOWN", "down", "ctrl F10", "maximize", "ctrl alt shift F6","selectPreviousFrame" }), "DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null, null), "EditorPane.background", new ColorUIResource(Color.white), "EditorPane.border", new BasicBorders.MarginBorder(), "EditorPane.caretBlinkRate", new Integer(500), "EditorPane.caretForeground", new ColorUIResource(Color.black), "EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "EditorPane.foreground", new ColorUIResource(Color.black), "EditorPane.inactiveForeground", new ColorUIResource(Color.gray), "EditorPane.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "EditorPane.margin", new InsetsUIResource(3, 3, 3, 3), "EditorPane.selectionBackground", new ColorUIResource(Color.black), "EditorPane.selectionForeground", new ColorUIResource(Color.white), "FileChooser.acceptAllFileFilterText", "All Files (*.*)", "FileChooser.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancelSelection" }), "FileChooser.cancelButtonMnemonic", new Integer(67), "FileChooser.cancelButtonText", "Cancel", "FileChooser.cancelButtonToolTipText", "Abort file chooser dialog", // XXX Don't use gif// "FileChooser.detailsViewIcon", new IconUIResource(new ImageIcon("icons/DetailsView.gif")), "FileChooser.directoryDescriptionText", "Directory", "FileChooser.fileDescriptionText", "Generic File", "FileChooser.helpButtonMnemonic", new Integer(72), "FileChooser.helpButtonText", "Help", "FileChooser.helpButtonToolTipText", "FileChooser help", // XXX Don't use gif// "FileChooser.homeFolderIcon", new IconUIResource(new ImageIcon("icons/HomeFolder.gif")), // XXX Don't use gif// "FileChooser.listViewIcon", new IconUIResource(new ImageIcon("icons/ListView.gif")), "FileChooser.newFolderErrorSeparator", ":", "FileChooser.newFolderErrorText", "Error creating new folder", // XXX Don't use gif// "FileChooser.newFolderIcon", new IconUIResource(new ImageIcon("icons/NewFolder.gif")), "FileChooser.openButtonMnemonic", new Integer(79), "FileChooser.openButtonText", "Open", "FileChooser.openButtonToolTipText", "Open selected file", "FileChooser.saveButtonMnemonic", new Integer(83), "FileChooser.saveButtonText", "Save", "FileChooser.saveButtonToolTipText", "Save selected file", // XXX Don't use gif// "FileChooser.upFolderIcon", new IconUIResource(new ImageIcon("icons/UpFolder.gif")), "FileChooser.updateButtonMnemonic", new Integer(85), "FileChooser.updateButtonText", "Update", "FileChooser.updateButtonToolTipText", "Update directory listing", // XXX Don't use gif// "FileView.computerIcon", new IconUIResource(new ImageIcon("icons/Computer.gif")), // XXX Don't use gif// "FileView.directoryIcon", new IconUIResource(new ImageIcon("icons/Directory.gif")), // XXX Don't use gif// "FileView.fileIcon", new IconUIResource(new ImageIcon("icons/File.gif")), // XXX Don't use gif// "FileView.floppyDriveIcon", new IconUIResource(new ImageIcon("icons/Floppy.gif")), // XXX Don't use gif// "FileView.hardDriveIcon", new IconUIResource(new ImageIcon("icons/HardDrive.gif")), "FocusManagerClassName", "TODO", "FormattedTextField.background", new ColorUIResource(light), "FormattedTextField.caretForeground", new ColorUIResource(Color.black), "FormattedTextField.foreground", new ColorUIResource(Color.black), "FormattedTextField.inactiveBackground", new ColorUIResource(light), "FormattedTextField.inactiveForeground", new ColorUIResource(Color.gray), "FormattedTextField.selectionBackground", new ColorUIResource(Color.black), "FormattedTextField.selectionForeground", new ColorUIResource(Color.white), "FormView.resetButtonText", "Reset", "FormView.submitButtonText", "Submit Query", "InternalFrame.activeTitleBackground", new ColorUIResource(0, 0, 128), "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white), "InternalFrame.border", new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { Color lineColor = new Color(238, 238, 238); Border inner = BorderFactory.createLineBorder(lineColor, 1); Color shadowInner = new Color(184, 207, 229); Color shadowOuter = new Color(122, 138, 153); Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Color.WHITE, shadowOuter, shadowInner); Border border = new BorderUIResource.CompoundBorderUIResource(outer, inner); return border; } }, "InternalFrame.borderColor", new ColorUIResource(light), "InternalFrame.borderDarkShadow", new ColorUIResource(Color.BLACK), "InternalFrame.borderHighlight", new ColorUIResource(Color.WHITE), "InternalFrame.borderLight", new ColorUIResource(Color.LIGHT_GRAY), "InternalFrame.borderShadow", new ColorUIResource(Color.GRAY), "InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(), // FIXME: Set a nice icon for InternalFrames here. "InternalFrame.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return new IconUIResource(BasicIconFactory.createEmptyFrameIcon()); } }, "InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.gray), "InternalFrame.inactiveTitleForeground", new ColorUIResource(Color.lightGray), "InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.titleFont", new FontUIResource("Dialog", Font.BOLD, 12), "InternalFrame.windowBindings", new Object[] { "shift ESCAPE", "showSystemMenu", "ctrl SPACE", "showSystemMenu", "ESCAPE", "showSystemMenu" }, "Label.background", new ColorUIResource(light), "Label.disabledForeground", new ColorUIResource(Color.white), "Label.disabledShadow", new ColorUIResource(shadow), "Label.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Label.foreground", new ColorUIResource(darkShadow), "List.background", new ColorUIResource(light), "List.border", new BasicBorders.MarginBorder(), "List.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "ctrl \\", "clearSelection", "PAGE_DOWN", "scrollDown", "shift PAGE_DOWN","scrollDownExtendSelection", "END", "selectLastRow", "HOME", "selectFirstRow", "shift END", "selectLastRowExtendSelection", "shift HOME", "selectFirstRowExtendSelection", "UP", "selectPreviousRow", "ctrl /", "selectAll", "ctrl A", "selectAll", "DOWN", "selectNextRow", "shift UP", "selectPreviousRowExtendSelection", "ctrl SPACE", "selectNextRowExtendSelection", "shift DOWN", "selectNextRowExtendSelection", "KP_UP", "selectPreviousRow", "shift PAGE_UP","scrollUpExtendSelection", "KP_DOWN", "selectNextRow" }), "List.foreground", new ColorUIResource(darkShadow), "List.selectionBackground", new ColorUIResource(Color.black), "List.selectionForeground", new ColorUIResource(Color.white), "List.focusCellHighlightBorder", new BorderUIResource. LineBorderUIResource(new ColorUIResource(Color.yellow)), "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "Menu.acceleratorForeground", new ColorUIResource(darkShadow), "Menu.acceleratorSelectionForeground", new ColorUIResource(Color.white), "Menu.arrowIcon", BasicIconFactory.getMenuArrowIcon(), "Menu.background", new ColorUIResource(light), "Menu.border", new BasicBorders.MarginBorder(), "Menu.borderPainted", Boolean.FALSE, "Menu.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "Menu.consumesTabs", Boolean.TRUE, "Menu.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Menu.foreground", new ColorUIResource(darkShadow), "Menu.margin", new InsetsUIResource(2, 2, 2, 2), "Menu.selectedWindowInputMapBindings", new Object[] { "ESCAPE", "cancel", "DOWN", "selectNext", "KP_DOWN", "selectNext", "UP", "selectPrevious", "KP_UP", "selectPrevious", "LEFT", "selectParent", "KP_LEFT", "selectParent", "RIGHT", "selectChild", "KP_RIGHT", "selectChild", "ENTER", "return", "SPACE", "return" }, "Menu.selectionBackground", new ColorUIResource(Color.black), "Menu.selectionForeground", new ColorUIResource(Color.white), "MenuBar.background", new ColorUIResource(light), "MenuBar.border", new BasicBorders.MenuBarBorder(null, null), "MenuBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuBar.foreground", new ColorUIResource(darkShadow), "MenuBar.highlight", new ColorUIResource(highLight), "MenuBar.shadow", new ColorUIResource(shadow), "MenuBar.windowBindings", new Object[] { "F10", "takeFocus" }, "MenuItem.acceleratorDelimiter", "-", "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuItem.acceleratorForeground", new ColorUIResource(darkShadow), "MenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "MenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "MenuItem.background", new ColorUIResource(light), "MenuItem.border", new BasicBorders.MarginBorder(), "MenuItem.borderPainted", Boolean.FALSE, "MenuItem.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "MenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuItem.foreground", new ColorUIResource(darkShadow), "MenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "MenuItem.selectionBackground", new ColorUIResource(Color.black), "MenuItem.selectionForeground", new ColorUIResource(Color.white), "OptionPane.background", new ColorUIResource(light), "OptionPane.border", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.buttonAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.cancelButtonText", "Cancel", // XXX Don't use gif// "OptionPane.errorIcon",// new IconUIResource(new ImageIcon("icons/Error.gif")), "OptionPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "OptionPane.foreground", new ColorUIResource(darkShadow), // XXX Don't use gif// "OptionPane.informationIcon",// new IconUIResource(new ImageIcon("icons/Inform.gif")), "OptionPane.messageAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.messageForeground", new ColorUIResource(darkShadow), "OptionPane.minimumSize", new DimensionUIResource(262, 90), "OptionPane.noButtonText", "No", "OptionPane.okButtonText", "OK", // XXX Don't use gif// "OptionPane.questionIcon",// new IconUIResource(new ImageIcon("icons/Question.gif")), // XXX Don't use gif// "OptionPane.warningIcon",// new IconUIResource(new ImageIcon("icons/Warn.gif")), "OptionPane.windowBindings", new Object[] { "ESCAPE", "close" }, "OptionPane.yesButtonText", "Yes", "Panel.background", new ColorUIResource(light), "Panel.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Panel.foreground", new ColorUIResource(Color.black), "PasswordField.background", new ColorUIResource(light), "PasswordField.border", new BasicBorders.FieldBorder(null, null, null, null), "PasswordField.caretBlinkRate", new Integer(500), "PasswordField.caretForeground", new ColorUIResource(Color.black), "PasswordField.font", new FontUIResource("Dialog", Font.PLAIN, 12), "PasswordField.foreground", new ColorUIResource(Color.black), "PasswordField.inactiveBackground", new ColorUIResource(light), "PasswordField.inactiveForeground", new ColorUIResource(Color.gray), "PasswordField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept")}, "PasswordField.margin", new InsetsUIResource(0, 0, 0, 0), "PasswordField.selectionBackground", new ColorUIResource(Color.black), "PasswordField.selectionForeground", new ColorUIResource(Color.white), "PopupMenu.background", new ColorUIResource(light), "PopupMenu.border", new BorderUIResource.BevelBorderUIResource(0), "PopupMenu.font", new FontUIResource("Dialog", Font.PLAIN, 12), "PopupMenu.foreground", new ColorUIResource(darkShadow), "ProgressBar.background", new ColorUIResource(light), "ProgressBar.border", new BorderUIResource.LineBorderUIResource(Color.darkGray), "ProgressBar.cellLength", new Integer(1), "ProgressBar.cellSpacing", new Integer(0), "ProgressBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ProgressBar.foreground", new ColorUIResource(Color.black), "ProgressBar.selectionBackground", new ColorUIResource(Color.black), "ProgressBar.selectionForeground", new ColorUIResource(light), "ProgressBar.repaintInterval", new Integer(250), "ProgressBar.cycleTime", new Integer(6000), "RadioButton.background", new ColorUIResource(light), "RadioButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), "RadioButton.darkShadow", new ColorUIResource(shadow), "RadioButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "RadioButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButton.foreground", new ColorUIResource(darkShadow), "RadioButton.highlight", new ColorUIResource(highLight), "RadioButton.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getRadioButtonIcon(); } }, "RadioButton.light", new ColorUIResource(highLight), "RadioButton.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButton.shadow", new ColorUIResource(shadow), "RadioButton.textIconGap", new Integer(4), "RadioButton.textShiftOffset", new Integer(0), "RadioButtonMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButtonMenuItem.acceleratorForeground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "RadioButtonMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "RadioButtonMenuItem.background", new ColorUIResource(light), "RadioButtonMenuItem.border", new BasicBorders.MarginBorder(), "RadioButtonMenuItem.borderPainted", Boolean.FALSE, "RadioButtonMenuItem.checkIcon", BasicIconFactory.getRadioButtonMenuItemIcon(), "RadioButtonMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButtonMenuItem.foreground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButtonMenuItem.selectionBackground", new ColorUIResource(Color.black), "RadioButtonMenuItem.selectionForeground", new ColorUIResource(Color.white), "RootPane.defaultButtonWindowKeyBindings", new Object[] { "ENTER", "press", "released ENTER", "release", "ctrl ENTER", "press", "ctrl released ENTER", "release" }, "ScrollBar.background", new ColorUIResource(224, 224, 224), "ScrollBar.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "negativeBlockIncrement", "PAGE_DOWN", "positiveBlockIncrement", "END", "maxScroll", "HOME", "minScroll", "LEFT", "positiveUnitIncrement", "KP_UP", "negativeUnitIncrement", "KP_DOWN", "positiveUnitIncrement", "UP", "negativeUnitIncrement", "RIGHT", "negativeUnitIncrement", "KP_LEFT", "positiveUnitIncrement", "DOWN", "positiveUnitIncrement", "KP_RIGHT", "negativeUnitIncrement" }), "ScrollBar.foreground", new ColorUIResource(light), "ScrollBar.maximumThumbSize", new DimensionUIResource(4096, 4096), "ScrollBar.minimumThumbSize", new DimensionUIResource(8, 8), "ScrollBar.thumb", new ColorUIResource(light), "ScrollBar.thumbDarkShadow", new ColorUIResource(shadow), "ScrollBar.thumbHighlight", new ColorUIResource(highLight), "ScrollBar.thumbShadow", new ColorUIResource(shadow), "ScrollBar.track", new ColorUIResource(light), "ScrollBar.trackHighlight", new ColorUIResource(shadow), "ScrollBar.width", new Integer(16), "ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "KP_LEFT", "unitScrollLeft", "ctrl PAGE_DOWN","scrollRight", "PAGE_DOWN", "scrollDown", "KP_RIGHT", "unitScrollRight", "LEFT", "unitScrollLeft", "ctrl END", "scrollEnd", "UP", "unitScrollUp", "RIGHT", "unitScrollRight", "DOWN", "unitScrollDown", "ctrl HOME", "scrollHome", "ctrl PAGE_UP", "scrollLeft", "KP_UP", "unitScrollUp", "KP_DOWN", "unitScrollDown" }), "ScrollPane.background", new ColorUIResource(light), "ScrollPane.border", new BorderUIResource.EtchedBorderUIResource(), "ScrollPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ScrollPane.foreground", new ColorUIResource(darkShadow), "Separator.background", new ColorUIResource(highLight), "Separator.foreground", new ColorUIResource(shadow), "Separator.highlight", new ColorUIResource(highLight), "Separator.shadow", new ColorUIResource(shadow), "Slider.background", new ColorUIResource(light), "Slider.focus", new ColorUIResource(shadow), "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "positiveBlockIncrement", "PAGE_DOWN", "negativeBlockIncrement", "END", "maxScroll", "HOME", "minScroll", "LEFT", "negativeUnitIncrement", "KP_UP", "positiveUnitIncrement", "KP_DOWN", "negativeUnitIncrement", "UP", "positiveUnitIncrement", "RIGHT", "positiveUnitIncrement", "KP_LEFT", "negativeUnitIncrement", "DOWN", "negativeUnitIncrement", "KP_RIGHT", "positiveUnitIncrement" }), "Slider.focusInsets", new InsetsUIResource(2, 2, 2, 2), "Slider.foreground", new ColorUIResource(light), "Slider.highlight", new ColorUIResource(highLight), "Slider.shadow", new ColorUIResource(shadow), "Slider.thumbHeight", new Integer(20), "Slider.thumbWidth", new Integer(11), "Slider.tickHeight", new Integer(12), "Spinner.background", new ColorUIResource(light), "Spinner.foreground", new ColorUIResource(light), "SplitPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "F6", "toggleFocus", "F8", "startResize", "END", "selectMax", "HOME", "selectMin", "LEFT", "negativeIncremnent", "KP_UP", "negativeIncrement", "KP_DOWN", "positiveIncrement", "UP", "negativeIncrement", "RIGHT", "positiveIncrement", "KP_LEFT", "negativeIncrement", "DOWN", "positiveIncrement", "KP_RIGHT", "positiveIncrement" }), "SplitPane.background", new ColorUIResource(light), "SplitPane.border", new BasicBorders.SplitPaneBorder(null, null), "SplitPane.darkShadow", new ColorUIResource(shadow), "SplitPane.dividerSize", new Integer(10), "SplitPane.highlight", new ColorUIResource(highLight), "SplitPane.shadow", new ColorUIResource(shadow), "TabbedPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ctrl PAGE_DOWN","navigatePageDown", "ctrl PAGE_UP", "navigatePageUp", "ctrl UP", "requestFocus", "ctrl KP_UP", "requestFocus" }), "TabbedPane.background", new ColorUIResource(light), "TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3), "TabbedPane.darkShadow", new ColorUIResource(shadow), "TabbedPane.focus", new ColorUIResource(darkShadow), "TabbedPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "LEFT", "navigateLeft", "KP_UP", "navigateUp", "ctrl DOWN", "requestFocusForVisibleComponent", "UP", "navigateUp", "KP_DOWN", "navigateDown", "RIGHT", "navigateRight", "KP_LEFT", "navigateLeft", "ctrl KP_DOWN", "requestFocusForVisibleComponent", "KP_RIGHT", "navigateRight", "DOWN", "navigateDown" }), "TabbedPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TabbedPane.foreground", new ColorUIResource(darkShadow), "TabbedPane.highlight", new ColorUIResource(highLight), "TabbedPane.light", new ColorUIResource(highLight), "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1), "TabbedPane.shadow", new ColorUIResource(shadow), "TabbedPane.tabbedPaneTabAreaInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabInsets", new InsetsUIResource(1, 4, 1, 4), "TabbedPane.tabbedPaneContentBorderInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabPadInsets", new InsetsUIResource(1, 1, 1, 1), "TabbedPane.tabRunOverlay", new Integer(2), "TabbedPane.textIconGap", new Integer(4), "Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "shift PAGE_DOWN","scrollDownExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "END", "selectLastColumn", "shift END", "selectLastColumnExtendSelection", "HOME", "selectFirstColumn", "ctrl END", "selectLastRow", "ctrl shift END","selectLastRowExtendSelection", "LEFT", "selectPreviousColumn", "shift HOME", "selectFirstColumnExtendSelection", "UP", "selectPreviousRow", "RIGHT", "selectNextColumn", "ctrl HOME", "selectFirstRow", "shift LEFT", "selectPreviousColumnExtendSelection", "DOWN", "selectNextRow", "ctrl shift HOME","selectFirstRowExtendSelection", "shift UP", "selectPreviousRowExtendSelection", "F2", "startEditing", "shift RIGHT", "selectNextColumnExtendSelection", "TAB", "selectNextColumnCell", "shift DOWN", "selectNextRowExtendSelection", "ENTER", "selectNextRowCell", "KP_UP", "selectPreviousRow", "KP_DOWN", "selectNextRow", "KP_LEFT", "selectPreviousColumn", "KP_RIGHT", "selectNextColumn", "shift TAB", "selectPreviousColumnCell", "ctrl A", "selectAll", "shift ENTER", "selectPreviousRowCell", "shift KP_DOWN", "selectNextRowExtendSelection", "shift KP_LEFT", "selectPreviousColumnExtendSelection", "ESCAPE", "cancel", "ctrl shift PAGE_UP", "scrollLeftExtendSelection", "shift KP_RIGHT", "selectNextColumnExtendSelection", "ctrl PAGE_UP", "scrollLeftChangeSelection", "shift PAGE_UP", "scrollUpExtendSelection", "ctrl shift PAGE_DOWN", "scrollRightExtendSelection", "ctrl PAGE_DOWN", "scrollRightChangeSelection", "PAGE_UP", "scrollUpChangeSelection", "ctrl shift LEFT", "selectPreviousColumnExtendSelection", "shift KP_UP", "selectPreviousRowExtendSelection", "ctrl shift UP", "selectPreviousRowExtendSelection", "ctrl shift RIGHT", "selectNextColumnExtendSelection", "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", "ctrl shift DOWN", "selectNextRowExtendSelection", "ctrl BACK_SLASH", "clearSelection", "ctrl shift KP_UP", "selectPreviousRowExtendSelection", "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", "ctrl SLASH", "selectAll", "ctrl shift KP_DOWN", "selectNextRowExtendSelection", }), "Table.background", new ColorUIResource(light), "Table.focusCellBackground", new ColorUIResource(light), "Table.focusCellForeground", new ColorUIResource(darkShadow), "Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource( new ColorUIResource(255, 255, 0)), "Table.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Table.foreground", new ColorUIResource(darkShadow), "Table.gridColor", new ColorUIResource(Color.gray), "Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0), "Table.selectionBackground", new ColorUIResource(Color.black), "Table.selectionForeground", new ColorUIResource(Color.white), "TableHeader.background", new ColorUIResource(light), "TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0), "TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TableHeader.foreground", new ColorUIResource(darkShadow), "TextArea.background", new ColorUIResource(light), "TextArea.border", new BasicBorders.MarginBorder(), "TextArea.caretBlinkRate", new Integer(500), "TextArea.caretForeground", new ColorUIResource(Color.black), "TextArea.font", new FontUIResource("Monospaced", Font.PLAIN, 12), "TextArea.foreground", new ColorUIResource(Color.black), "TextArea.inactiveForeground", new ColorUIResource(Color.gray), "TextArea.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "TextArea.margin", new InsetsUIResource(0, 0, 0, 0), "TextArea.selectionBackground", new ColorUIResource(Color.black), "TextArea.selectionForeground", new ColorUIResource(Color.white), "TextField.background", new ColorUIResource(light), "TextField.border", new BasicBorders.FieldBorder(null, null, null, null), "TextField.caretBlinkRate", new Integer(500), "TextField.caretForeground", new ColorUIResource(Color.black), "TextField.darkShadow", new ColorUIResource(shadow), "TextField.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "TextField.foreground", new ColorUIResource(Color.black), "TextField.highlight", new ColorUIResource(highLight), "TextField.inactiveBackground", new ColorUIResource(Color.LIGHT_GRAY), "TextField.inactiveForeground", new ColorUIResource(Color.GRAY), "TextField.light", new ColorUIResource(highLight), "TextField.highlight", new ColorUIResource(light), "TextField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_DOWN_MASK), "selection-backward"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_DOWN_MASK), "selection-forward"), }, "TextField.margin", new InsetsUIResource(0, 0, 0, 0), "TextField.selectionBackground", new ColorUIResource(Color.black), "TextField.selectionForeground", new ColorUIResource(Color.white), "TextPane.background", new ColorUIResource(Color.white), "TextPane.border", new BasicBorders.MarginBorder(), "TextPane.caretBlinkRate", new Integer(500), "TextPane.caretForeground", new ColorUIResource(Color.black), "TextPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "TextPane.foreground", new ColorUIResource(Color.black), "TextPane.inactiveForeground", new ColorUIResource(Color.gray), "TextPane.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "TextPane.margin", new InsetsUIResource(3, 3, 3, 3), "TextPane.selectionBackground", new ColorUIResource(Color.black), "TextPane.selectionForeground", new ColorUIResource(Color.white), "TitledBorder.border", new BorderUIResource.EtchedBorderUIResource(), "TitledBorder.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TitledBorder.titleColor", new ColorUIResource(darkShadow), "ToggleButton.background", new ColorUIResource(light), "ToggleButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), "ToggleButton.darkShadow", new ColorUIResource(shadow), "ToggleButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "ToggleButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToggleButton.foreground", new ColorUIResource(darkShadow), "ToggleButton.highlight", new ColorUIResource(highLight), "ToggleButton.light", new ColorUIResource(light), "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), "ToggleButton.shadow", new ColorUIResource(shadow), "ToggleButton.textIconGap", new Integer(4), "ToggleButton.textShiftOffset", new Integer(0), "ToolBar.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "UP", "navigateUp", "KP_UP", "navigateUp", "DOWN", "navigateDown", "KP_DOWN", "navigateDown", "LEFT", "navigateLeft", "KP_LEFT", "navigateLeft", "RIGHT", "navigateRight", "KP_RIGHT", "navigateRight" }), "ToolBar.background", new ColorUIResource(light), "ToolBar.border", new BorderUIResource.EtchedBorderUIResource(), "ToolBar.darkShadow", new ColorUIResource(shadow), "ToolBar.dockingBackground", new ColorUIResource(light), "ToolBar.dockingForeground", new ColorUIResource(Color.red), "ToolBar.floatingBackground", new ColorUIResource(light), "ToolBar.floatingForeground", new ColorUIResource(Color.darkGray), "ToolBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToolBar.foreground", new ColorUIResource(darkShadow), "ToolBar.highlight", new ColorUIResource(highLight), "ToolBar.light", new ColorUIResource(highLight), "ToolBar.separatorSize", new DimensionUIResource(20, 20), "ToolBar.shadow", new ColorUIResource(shadow), "ToolTip.background", new ColorUIResource(light), "ToolTip.border", new BorderUIResource.LineBorderUIResource(Color.lightGray), "ToolTip.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ToolTip.foreground", new ColorUIResource(darkShadow), "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancel" }), "Tree.background", new ColorUIResource(light), "Tree.changeSelectionWithFocus", Boolean.TRUE,// "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")),// "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")), "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE, "Tree.editorBorder", new BorderUIResource.LineBorderUIResource(Color.lightGray), "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "shift PAGE_DOWN", "scrollDownExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "END", "selectLast", "ctrl KP_UP", "selectPreviousChangeLead", "shift END", "selectLastExtendSelection", "HOME", "selectFirst", "ctrl END", "selectLastChangeLead", "ctrl SLASH", "selectAll", "LEFT", "selectParent", "shift HOME", "selectFirstExtendSelection", "UP", "selectPrevious", "ctrl KP_DOWN", "selectNextChangeLead", "RIGHT", "selectChild", "ctrl HOME", "selectFirstChangeLead", "DOWN", "selectNext", "ctrl KP_LEFT", "scrollLeft", "shift UP", "selectPreviousExtendSelection", "F2", "startEditing", "ctrl LEFT", "scrollLeft", "ctrl KP_RIGHT","scrollRight", "ctrl UP", "selectPreviousChangeLead", "shift DOWN", "selectNextExtendSelection", "ENTER", "toggle", "KP_UP", "selectPrevious", "KP_DOWN", "selectNext", "ctrl RIGHT", "scrollRight", "KP_LEFT", "selectParent", "KP_RIGHT", "selectChild", "ctrl DOWN", "selectNextChangeLead", "ctrl A", "selectAll", "shift KP_UP", "selectPreviousExtendSelection", "shift KP_DOWN","selectNextExtendSelection", "ctrl SPACE", "toggleSelectionPreserveAnchor", "ctrl shift PAGE_UP", "scrollUpExtendSelection", "ctrl BACK_SLASH", "clearSelection", "shift SPACE", "extendSelection", "ctrl PAGE_UP", "scrollUpChangeLead", "shift PAGE_UP","scrollUpExtendSelection", "SPACE", "toggleSelectionPreserveAnchor", "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", "PAGE_UP", "scrollUpChangeSelection", "ctrl PAGE_DOWN", "scrollDownChangeLead" }), "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)), "Tree.foreground", new ColorUIResource(Color.black), "Tree.hash", new ColorUIResource(new Color(128, 128, 128)), "Tree.leftChildIndent", new Integer(7), "Tree.rightChildIndent", new Integer(13), "Tree.rowHeight", new Integer(20), // FIXME "Tree.scrollsOnExpand", Boolean.TRUE, "Tree.selectionBackground", new ColorUIResource(Color.black), "Tree.nonSelectionBackground", new ColorUIResource(new Color(239, 235, 231)), "Tree.selectionBorderColor", new ColorUIResource(Color.black), "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(Color.black), "Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)), "Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)), "Tree.textForeground", new ColorUIResource(Color.black), "Viewport.background", new ColorUIResource(light), "Viewport.foreground", new ColorUIResource(Color.black), "Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12) }; defaults.putDefaults(uiDefaults); }
|
protected void initComponentDefaults(UIDefaults defaults) { Object[] uiDefaults; Color highLight = new Color(249, 247, 246); Color light = new Color(239, 235, 231); Color shadow = new Color(139, 136, 134); Color darkShadow = new Color(16, 16, 16); uiDefaults = new Object[] { "AbstractUndoableEdit.undoText", "Undo", "AbstractUndoableEdit.redoText", "Redo", "Button.background", new ColorUIResource(Color.LIGHT_GRAY), "Button.border", new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { return BasicBorders.getButtonBorder(); } }, "Button.darkShadow", new ColorUIResource(Color.BLACK), "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "Button.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Button.foreground", new ColorUIResource(Color.BLACK), "Button.highlight", new ColorUIResource(Color.WHITE), "Button.light", new ColorUIResource(Color.LIGHT_GRAY), "Button.margin", new InsetsUIResource(2, 2, 2, 2), "Button.shadow", new ColorUIResource(Color.GRAY), "Button.textIconGap", new Integer(4), "Button.textShiftOffset", new Integer(0), "CheckBox.background", new ColorUIResource(new Color(204, 204, 204)), "CheckBox.border", new BorderUIResource.CompoundBorderUIResource(null, null), "CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "CheckBox.font", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBox.foreground", new ColorUIResource(darkShadow), "CheckBox.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getCheckBoxIcon(); } }, "CheckBox.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getMenuItemCheckIcon(); } }, "CheckBox.margin",new InsetsUIResource(2, 2, 2, 2), "CheckBox.textIconGap", new Integer(4), "CheckBox.textShiftOffset", new Integer(0), "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBoxMenuItem.acceleratorForeground", new ColorUIResource(new Color(16, 16, 16)), "CheckBoxMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "CheckBoxMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "CheckBoxMenuItem.background", new ColorUIResource(light), "CheckBoxMenuItem.border", new BasicBorders.MarginBorder(), "CheckBoxMenuItem.borderPainted", Boolean.FALSE, "CheckBoxMenuItem.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getCheckBoxMenuItemIcon(); } }, "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBoxMenuItem.foreground", new ColorUIResource(darkShadow), "CheckBoxMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "CheckBoxMenuItem.selectionBackground", new ColorUIResource(Color.black), "CheckBoxMenuItem.selectionForeground", new ColorUIResource(Color.white), "ColorChooser.background", new ColorUIResource(light), "ColorChooser.cancelText", "Cancel", "ColorChooser.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ColorChooser.foreground", new ColorUIResource(darkShadow), "ColorChooser.hsbBlueText", "B", "ColorChooser.hsbBrightnessText", "B", "ColorChooser.hsbGreenText", "G", "ColorChooser.hsbHueText", "H", "ColorChooser.hsbNameText", "HSB", "ColorChooser.hsbRedText", "R", "ColorChooser.hsbSaturationText", "S", "ColorChooser.okText", "OK", "ColorChooser.previewText", "Preview", "ColorChooser.resetText", "Reset", "ColorChooser.rgbBlueMnemonic", new Integer(66), "ColorChooser.rgbBlueText", "Blue", "ColorChooser.rgbGreenMnemonic", new Integer(71), "ColorChooser.rgbGreenText", "Green", "ColorChooser.rgbNameText", "RGB", "ColorChooser.rgbRedMnemonic", new Integer(82), "ColorChooser.rgbRedText", "Red", "ColorChooser.sampleText", "Sample Text Sample Text", "ColorChooser.swatchesDefaultRecentColor", new ColorUIResource(light), "ColorChooser.swatchesNameText", "Swatches", "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10), "ColorChooser.swatchesRecentText", "Recent:", "ColorChooser.swatchesSwatchSize", new Dimension(10, 10), "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "hidePopup", "PAGE_UP", "pageUpPassThrough", "PAGE_DOWN", "pageDownPassThrough", "HOME", "homePassThrough", "END", "endPassThrough" }), "ComboBox.background", new ColorUIResource(light), "ComboBox.buttonBackground", new ColorUIResource(light), "ComboBox.buttonDarkShadow", new ColorUIResource(shadow), "ComboBox.buttonHighlight", new ColorUIResource(highLight), "ComboBox.buttonShadow", new ColorUIResource(shadow), "ComboBox.disabledBackground", new ColorUIResource(light), "ComboBox.disabledForeground", new ColorUIResource(Color.gray), "ComboBox.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ComboBox.foreground", new ColorUIResource(Color.black), "ComboBox.selectionBackground", new ColorUIResource(Color.black), "ComboBox.selectionForeground", new ColorUIResource(Color.white), "Desktop.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "KP_LEFT", "left", "KP_RIGHT", "right", "ctrl F5", "restore", "LEFT", "left", "ctrl alt F6", "selectNextFrame", "UP", "up", "ctrl F6", "selectNextFrame", "RIGHT", "right", "DOWN", "down", "ctrl F7", "move", "ctrl F8", "resize", "ESCAPE", "escape", "ctrl TAB", "selectNextFrame", "ctrl F9", "minimize", "KP_UP", "up", "ctrl F4", "close", "KP_DOWN", "down", "ctrl F10", "maximize", "ctrl alt shift F6","selectPreviousFrame" }), "DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null, null), "EditorPane.background", new ColorUIResource(Color.white), "EditorPane.border", new BasicBorders.MarginBorder(), "EditorPane.caretBlinkRate", new Integer(500), "EditorPane.caretForeground", new ColorUIResource(Color.black), "EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "EditorPane.foreground", new ColorUIResource(Color.black), "EditorPane.inactiveForeground", new ColorUIResource(Color.gray), "EditorPane.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "EditorPane.margin", new InsetsUIResource(3, 3, 3, 3), "EditorPane.selectionBackground", new ColorUIResource(Color.black), "EditorPane.selectionForeground", new ColorUIResource(Color.white), "FileChooser.acceptAllFileFilterText", "All Files (*.*)", "FileChooser.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancelSelection" }), "FileChooser.cancelButtonMnemonic", new Integer(67), "FileChooser.cancelButtonText", "Cancel", "FileChooser.cancelButtonToolTipText", "Abort file chooser dialog", // XXX Don't use gif// "FileChooser.detailsViewIcon", new IconUIResource(new ImageIcon("icons/DetailsView.gif")), "FileChooser.directoryDescriptionText", "Directory", "FileChooser.fileDescriptionText", "Generic File", "FileChooser.helpButtonMnemonic", new Integer(72), "FileChooser.helpButtonText", "Help", "FileChooser.helpButtonToolTipText", "FileChooser help", // XXX Don't use gif// "FileChooser.homeFolderIcon", new IconUIResource(new ImageIcon("icons/HomeFolder.gif")), // XXX Don't use gif// "FileChooser.listViewIcon", new IconUIResource(new ImageIcon("icons/ListView.gif")), "FileChooser.newFolderErrorSeparator", ":", "FileChooser.newFolderErrorText", "Error creating new folder", // XXX Don't use gif// "FileChooser.newFolderIcon", new IconUIResource(new ImageIcon("icons/NewFolder.gif")), "FileChooser.openButtonMnemonic", new Integer(79), "FileChooser.openButtonText", "Open", "FileChooser.openButtonToolTipText", "Open selected file", "FileChooser.saveButtonMnemonic", new Integer(83), "FileChooser.saveButtonText", "Save", "FileChooser.saveButtonToolTipText", "Save selected file", // XXX Don't use gif// "FileChooser.upFolderIcon", new IconUIResource(new ImageIcon("icons/UpFolder.gif")), "FileChooser.updateButtonMnemonic", new Integer(85), "FileChooser.updateButtonText", "Update", "FileChooser.updateButtonToolTipText", "Update directory listing", // XXX Don't use gif// "FileView.computerIcon", new IconUIResource(new ImageIcon("icons/Computer.gif")), // XXX Don't use gif// "FileView.directoryIcon", new IconUIResource(new ImageIcon("icons/Directory.gif")), // XXX Don't use gif// "FileView.fileIcon", new IconUIResource(new ImageIcon("icons/File.gif")), // XXX Don't use gif// "FileView.floppyDriveIcon", new IconUIResource(new ImageIcon("icons/Floppy.gif")), // XXX Don't use gif// "FileView.hardDriveIcon", new IconUIResource(new ImageIcon("icons/HardDrive.gif")), "FocusManagerClassName", "TODO", "FormattedTextField.background", new ColorUIResource(light), "FormattedTextField.caretForeground", new ColorUIResource(Color.black), "FormattedTextField.foreground", new ColorUIResource(Color.black), "FormattedTextField.inactiveBackground", new ColorUIResource(light), "FormattedTextField.inactiveForeground", new ColorUIResource(Color.gray), "FormattedTextField.selectionBackground", new ColorUIResource(Color.black), "FormattedTextField.selectionForeground", new ColorUIResource(Color.white), "FormView.resetButtonText", "Reset", "FormView.submitButtonText", "Submit Query", "InternalFrame.activeTitleBackground", new ColorUIResource(0, 0, 128), "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white), "InternalFrame.border", new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { Color lineColor = new Color(238, 238, 238); Border inner = BorderFactory.createLineBorder(lineColor, 1); Color shadowInner = new Color(184, 207, 229); Color shadowOuter = new Color(122, 138, 153); Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Color.WHITE, shadowOuter, shadowInner); Border border = new BorderUIResource.CompoundBorderUIResource(outer, inner); return border; } }, "InternalFrame.borderColor", new ColorUIResource(light), "InternalFrame.borderDarkShadow", new ColorUIResource(Color.BLACK), "InternalFrame.borderHighlight", new ColorUIResource(Color.WHITE), "InternalFrame.borderLight", new ColorUIResource(Color.LIGHT_GRAY), "InternalFrame.borderShadow", new ColorUIResource(Color.GRAY), "InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(), // FIXME: Set a nice icon for InternalFrames here. "InternalFrame.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return new IconUIResource(BasicIconFactory.createEmptyFrameIcon()); } }, "InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.gray), "InternalFrame.inactiveTitleForeground", new ColorUIResource(Color.lightGray), "InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.titleFont", new FontUIResource("Dialog", Font.BOLD, 12), "InternalFrame.windowBindings", new Object[] { "shift ESCAPE", "showSystemMenu", "ctrl SPACE", "showSystemMenu", "ESCAPE", "showSystemMenu" }, "Label.background", new ColorUIResource(light), "Label.disabledForeground", new ColorUIResource(Color.white), "Label.disabledShadow", new ColorUIResource(shadow), "Label.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Label.foreground", new ColorUIResource(darkShadow), "List.background", new ColorUIResource(light), "List.border", new BasicBorders.MarginBorder(), "List.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "ctrl \\", "clearSelection", "PAGE_DOWN", "scrollDown", "shift PAGE_DOWN","scrollDownExtendSelection", "END", "selectLastRow", "HOME", "selectFirstRow", "shift END", "selectLastRowExtendSelection", "shift HOME", "selectFirstRowExtendSelection", "UP", "selectPreviousRow", "ctrl /", "selectAll", "ctrl A", "selectAll", "DOWN", "selectNextRow", "shift UP", "selectPreviousRowExtendSelection", "ctrl SPACE", "selectNextRowExtendSelection", "shift DOWN", "selectNextRowExtendSelection", "KP_UP", "selectPreviousRow", "shift PAGE_UP","scrollUpExtendSelection", "KP_DOWN", "selectNextRow" }), "List.foreground", new ColorUIResource(darkShadow), "List.selectionBackground", new ColorUIResource(Color.black), "List.selectionForeground", new ColorUIResource(Color.white), "List.focusCellHighlightBorder", new BorderUIResource. LineBorderUIResource(new ColorUIResource(Color.yellow)), "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "Menu.acceleratorForeground", new ColorUIResource(darkShadow), "Menu.acceleratorSelectionForeground", new ColorUIResource(Color.white), "Menu.arrowIcon", BasicIconFactory.getMenuArrowIcon(), "Menu.background", new ColorUIResource(light), "Menu.border", new BasicBorders.MarginBorder(), "Menu.borderPainted", Boolean.FALSE, "Menu.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "Menu.consumesTabs", Boolean.TRUE, "Menu.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Menu.foreground", new ColorUIResource(darkShadow), "Menu.margin", new InsetsUIResource(2, 2, 2, 2), "Menu.selectedWindowInputMapBindings", new Object[] { "ESCAPE", "cancel", "DOWN", "selectNext", "KP_DOWN", "selectNext", "UP", "selectPrevious", "KP_UP", "selectPrevious", "LEFT", "selectParent", "KP_LEFT", "selectParent", "RIGHT", "selectChild", "KP_RIGHT", "selectChild", "ENTER", "return", "SPACE", "return" }, "Menu.selectionBackground", new ColorUIResource(Color.black), "Menu.selectionForeground", new ColorUIResource(Color.white), "MenuBar.background", new ColorUIResource(light), "MenuBar.border", new BasicBorders.MenuBarBorder(null, null), "MenuBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuBar.foreground", new ColorUIResource(darkShadow), "MenuBar.highlight", new ColorUIResource(highLight), "MenuBar.shadow", new ColorUIResource(shadow), "MenuBar.windowBindings", new Object[] { "F10", "takeFocus" }, "MenuItem.acceleratorDelimiter", "-", "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuItem.acceleratorForeground", new ColorUIResource(darkShadow), "MenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "MenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "MenuItem.background", new ColorUIResource(light), "MenuItem.border", new BasicBorders.MarginBorder(), "MenuItem.borderPainted", Boolean.FALSE, "MenuItem.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "MenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuItem.foreground", new ColorUIResource(darkShadow), "MenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "MenuItem.selectionBackground", new ColorUIResource(Color.black), "MenuItem.selectionForeground", new ColorUIResource(Color.white), "OptionPane.background", new ColorUIResource(light), "OptionPane.border", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.buttonAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.cancelButtonText", "Cancel", // XXX Don't use gif// "OptionPane.errorIcon",// new IconUIResource(new ImageIcon("icons/Error.gif")), "OptionPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "OptionPane.foreground", new ColorUIResource(darkShadow), // XXX Don't use gif// "OptionPane.informationIcon",// new IconUIResource(new ImageIcon("icons/Inform.gif")), "OptionPane.messageAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.messageForeground", new ColorUIResource(darkShadow), "OptionPane.minimumSize", new DimensionUIResource(262, 90), "OptionPane.noButtonText", "No", "OptionPane.okButtonText", "OK", // XXX Don't use gif// "OptionPane.questionIcon",// new IconUIResource(new ImageIcon("icons/Question.gif")), // XXX Don't use gif// "OptionPane.warningIcon",// new IconUIResource(new ImageIcon("icons/Warn.gif")), "OptionPane.windowBindings", new Object[] { "ESCAPE", "close" }, "OptionPane.yesButtonText", "Yes", "Panel.background", new ColorUIResource(light), "Panel.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Panel.foreground", new ColorUIResource(Color.black), "PasswordField.background", new ColorUIResource(light), "PasswordField.border", new BasicBorders.FieldBorder(null, null, null, null), "PasswordField.caretBlinkRate", new Integer(500), "PasswordField.caretForeground", new ColorUIResource(Color.black), "PasswordField.font", new FontUIResource("Dialog", Font.PLAIN, 12), "PasswordField.foreground", new ColorUIResource(Color.black), "PasswordField.inactiveBackground", new ColorUIResource(light), "PasswordField.inactiveForeground", new ColorUIResource(Color.gray), "PasswordField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept")}, "PasswordField.margin", new InsetsUIResource(0, 0, 0, 0), "PasswordField.selectionBackground", new ColorUIResource(Color.black), "PasswordField.selectionForeground", new ColorUIResource(Color.white), "PopupMenu.background", new ColorUIResource(light), "PopupMenu.border", new BorderUIResource.BevelBorderUIResource(0), "PopupMenu.font", new FontUIResource("Dialog", Font.PLAIN, 12), "PopupMenu.foreground", new ColorUIResource(darkShadow), "ProgressBar.background", new ColorUIResource(light), "ProgressBar.border", new BorderUIResource.LineBorderUIResource(Color.darkGray), "ProgressBar.cellLength", new Integer(1), "ProgressBar.cellSpacing", new Integer(0), "ProgressBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ProgressBar.foreground", new ColorUIResource(Color.black), "ProgressBar.selectionBackground", new ColorUIResource(Color.black), "ProgressBar.selectionForeground", new ColorUIResource(light), "ProgressBar.repaintInterval", new Integer(250), "ProgressBar.cycleTime", new Integer(6000), "RadioButton.background", new ColorUIResource(light), "RadioButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), "RadioButton.darkShadow", new ColorUIResource(shadow), "RadioButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "RadioButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButton.foreground", new ColorUIResource(darkShadow), "RadioButton.highlight", new ColorUIResource(highLight), "RadioButton.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getRadioButtonIcon(); } }, "RadioButton.light", new ColorUIResource(highLight), "RadioButton.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButton.shadow", new ColorUIResource(shadow), "RadioButton.textIconGap", new Integer(4), "RadioButton.textShiftOffset", new Integer(0), "RadioButtonMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButtonMenuItem.acceleratorForeground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "RadioButtonMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "RadioButtonMenuItem.background", new ColorUIResource(light), "RadioButtonMenuItem.border", new BasicBorders.MarginBorder(), "RadioButtonMenuItem.borderPainted", Boolean.FALSE, "RadioButtonMenuItem.checkIcon", BasicIconFactory.getRadioButtonMenuItemIcon(), "RadioButtonMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButtonMenuItem.foreground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButtonMenuItem.selectionBackground", new ColorUIResource(Color.black), "RadioButtonMenuItem.selectionForeground", new ColorUIResource(Color.white), "RootPane.defaultButtonWindowKeyBindings", new Object[] { "ENTER", "press", "released ENTER", "release", "ctrl ENTER", "press", "ctrl released ENTER", "release" }, "ScrollBar.background", new ColorUIResource(224, 224, 224), "ScrollBar.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "negativeBlockIncrement", "PAGE_DOWN", "positiveBlockIncrement", "END", "maxScroll", "HOME", "minScroll", "LEFT", "positiveUnitIncrement", "KP_UP", "negativeUnitIncrement", "KP_DOWN", "positiveUnitIncrement", "UP", "negativeUnitIncrement", "RIGHT", "negativeUnitIncrement", "KP_LEFT", "positiveUnitIncrement", "DOWN", "positiveUnitIncrement", "KP_RIGHT", "negativeUnitIncrement" }), "ScrollBar.foreground", new ColorUIResource(light), "ScrollBar.maximumThumbSize", new DimensionUIResource(4096, 4096), "ScrollBar.minimumThumbSize", new DimensionUIResource(8, 8), "ScrollBar.thumb", new ColorUIResource(light), "ScrollBar.thumbDarkShadow", new ColorUIResource(shadow), "ScrollBar.thumbHighlight", new ColorUIResource(highLight), "ScrollBar.thumbShadow", new ColorUIResource(shadow), "ScrollBar.track", new ColorUIResource(light), "ScrollBar.trackHighlight", new ColorUIResource(shadow), "ScrollBar.width", new Integer(16), "ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "KP_LEFT", "unitScrollLeft", "ctrl PAGE_DOWN","scrollRight", "PAGE_DOWN", "scrollDown", "KP_RIGHT", "unitScrollRight", "LEFT", "unitScrollLeft", "ctrl END", "scrollEnd", "UP", "unitScrollUp", "RIGHT", "unitScrollRight", "DOWN", "unitScrollDown", "ctrl HOME", "scrollHome", "ctrl PAGE_UP", "scrollLeft", "KP_UP", "unitScrollUp", "KP_DOWN", "unitScrollDown" }), "ScrollPane.background", new ColorUIResource(light), "ScrollPane.border", new BorderUIResource.EtchedBorderUIResource(), "ScrollPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ScrollPane.foreground", new ColorUIResource(darkShadow), "Separator.background", new ColorUIResource(highLight), "Separator.foreground", new ColorUIResource(shadow), "Separator.highlight", new ColorUIResource(highLight), "Separator.shadow", new ColorUIResource(shadow), "Slider.background", new ColorUIResource(light), "Slider.focus", new ColorUIResource(shadow), "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "positiveBlockIncrement", "PAGE_DOWN", "negativeBlockIncrement", "END", "maxScroll", "HOME", "minScroll", "LEFT", "negativeUnitIncrement", "KP_UP", "positiveUnitIncrement", "KP_DOWN", "negativeUnitIncrement", "UP", "positiveUnitIncrement", "RIGHT", "positiveUnitIncrement", "KP_LEFT", "negativeUnitIncrement", "DOWN", "negativeUnitIncrement", "KP_RIGHT", "positiveUnitIncrement" }), "Slider.focusInsets", new InsetsUIResource(2, 2, 2, 2), "Slider.foreground", new ColorUIResource(light), "Slider.highlight", new ColorUIResource(highLight), "Slider.shadow", new ColorUIResource(shadow), "Slider.thumbHeight", new Integer(20), "Slider.thumbWidth", new Integer(11), "Slider.tickHeight", new Integer(12), "Spinner.background", new ColorUIResource(light), "Spinner.foreground", new ColorUIResource(light), "SplitPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "F6", "toggleFocus", "F8", "startResize", "END", "selectMax", "HOME", "selectMin", "LEFT", "negativeIncremnent", "KP_UP", "negativeIncrement", "KP_DOWN", "positiveIncrement", "UP", "negativeIncrement", "RIGHT", "positiveIncrement", "KP_LEFT", "negativeIncrement", "DOWN", "positiveIncrement", "KP_RIGHT", "positiveIncrement" }), "SplitPane.background", new ColorUIResource(light), "SplitPane.border", new BasicBorders.SplitPaneBorder(null, null), "SplitPane.darkShadow", new ColorUIResource(shadow), "SplitPane.dividerSize", new Integer(10), "SplitPane.highlight", new ColorUIResource(highLight), "SplitPane.shadow", new ColorUIResource(shadow), "TabbedPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ctrl PAGE_DOWN","navigatePageDown", "ctrl PAGE_UP", "navigatePageUp", "ctrl UP", "requestFocus", "ctrl KP_UP", "requestFocus" }), "TabbedPane.background", new ColorUIResource(light), "TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3), "TabbedPane.darkShadow", new ColorUIResource(shadow), "TabbedPane.focus", new ColorUIResource(darkShadow), "TabbedPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "LEFT", "navigateLeft", "KP_UP", "navigateUp", "ctrl DOWN", "requestFocusForVisibleComponent", "UP", "navigateUp", "KP_DOWN", "navigateDown", "RIGHT", "navigateRight", "KP_LEFT", "navigateLeft", "ctrl KP_DOWN", "requestFocusForVisibleComponent", "KP_RIGHT", "navigateRight", "DOWN", "navigateDown" }), "TabbedPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TabbedPane.foreground", new ColorUIResource(darkShadow), "TabbedPane.highlight", new ColorUIResource(highLight), "TabbedPane.light", new ColorUIResource(highLight), "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1), "TabbedPane.shadow", new ColorUIResource(shadow), "TabbedPane.tabbedPaneTabAreaInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabInsets", new InsetsUIResource(1, 4, 1, 4), "TabbedPane.tabbedPaneContentBorderInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabPadInsets", new InsetsUIResource(1, 1, 1, 1), "TabbedPane.tabRunOverlay", new Integer(2), "TabbedPane.textIconGap", new Integer(4), "Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "shift PAGE_DOWN","scrollDownExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "END", "selectLastColumn", "shift END", "selectLastColumnExtendSelection", "HOME", "selectFirstColumn", "ctrl END", "selectLastRow", "ctrl shift END","selectLastRowExtendSelection", "LEFT", "selectPreviousColumn", "shift HOME", "selectFirstColumnExtendSelection", "UP", "selectPreviousRow", "RIGHT", "selectNextColumn", "ctrl HOME", "selectFirstRow", "shift LEFT", "selectPreviousColumnExtendSelection", "DOWN", "selectNextRow", "ctrl shift HOME","selectFirstRowExtendSelection", "shift UP", "selectPreviousRowExtendSelection", "F2", "startEditing", "shift RIGHT", "selectNextColumnExtendSelection", "TAB", "selectNextColumnCell", "shift DOWN", "selectNextRowExtendSelection", "ENTER", "selectNextRowCell", "KP_UP", "selectPreviousRow", "KP_DOWN", "selectNextRow", "KP_LEFT", "selectPreviousColumn", "KP_RIGHT", "selectNextColumn", "shift TAB", "selectPreviousColumnCell", "ctrl A", "selectAll", "shift ENTER", "selectPreviousRowCell", "shift KP_DOWN", "selectNextRowExtendSelection", "shift KP_LEFT", "selectPreviousColumnExtendSelection", "ESCAPE", "cancel", "ctrl shift PAGE_UP", "scrollLeftExtendSelection", "shift KP_RIGHT", "selectNextColumnExtendSelection", "ctrl PAGE_UP", "scrollLeftChangeSelection", "shift PAGE_UP", "scrollUpExtendSelection", "ctrl shift PAGE_DOWN", "scrollRightExtendSelection", "ctrl PAGE_DOWN", "scrollRightChangeSelection", "PAGE_UP", "scrollUpChangeSelection", "ctrl shift LEFT", "selectPreviousColumnExtendSelection", "shift KP_UP", "selectPreviousRowExtendSelection", "ctrl shift UP", "selectPreviousRowExtendSelection", "ctrl shift RIGHT", "selectNextColumnExtendSelection", "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", "ctrl shift DOWN", "selectNextRowExtendSelection", "ctrl BACK_SLASH", "clearSelection", "ctrl shift KP_UP", "selectPreviousRowExtendSelection", "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", "ctrl SLASH", "selectAll", "ctrl shift KP_DOWN", "selectNextRowExtendSelection", }), "Table.background", new ColorUIResource(light), "Table.focusCellBackground", new ColorUIResource(light), "Table.focusCellForeground", new ColorUIResource(darkShadow), "Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource( new ColorUIResource(255, 255, 0)), "Table.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Table.foreground", new ColorUIResource(darkShadow), "Table.gridColor", new ColorUIResource(Color.gray), "Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0), "Table.selectionBackground", new ColorUIResource(Color.black), "Table.selectionForeground", new ColorUIResource(Color.white), "TableHeader.background", new ColorUIResource(light), "TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0), "TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TableHeader.foreground", new ColorUIResource(darkShadow), "TextArea.background", new ColorUIResource(light), "TextArea.border", new BasicBorders.MarginBorder(), "TextArea.caretBlinkRate", new Integer(500), "TextArea.caretForeground", new ColorUIResource(Color.black), "TextArea.font", new FontUIResource("Monospaced", Font.PLAIN, 12), "TextArea.foreground", new ColorUIResource(Color.black), "TextArea.inactiveForeground", new ColorUIResource(Color.gray), "TextArea.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "TextArea.margin", new InsetsUIResource(0, 0, 0, 0), "TextArea.selectionBackground", new ColorUIResource(Color.black), "TextArea.selectionForeground", new ColorUIResource(Color.white), "TextField.background", new ColorUIResource(light), "TextField.border", new BasicBorders.FieldBorder(null, null, null, null), "TextField.caretBlinkRate", new Integer(500), "TextField.caretForeground", new ColorUIResource(Color.black), "TextField.darkShadow", new ColorUIResource(shadow), "TextField.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "TextField.foreground", new ColorUIResource(Color.black), "TextField.highlight", new ColorUIResource(highLight), "TextField.inactiveBackground", new ColorUIResource(Color.LIGHT_GRAY), "TextField.inactiveForeground", new ColorUIResource(Color.GRAY), "TextField.light", new ColorUIResource(highLight), "TextField.highlight", new ColorUIResource(light), "TextField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_DOWN_MASK), "selection-backward"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_DOWN_MASK), "selection-forward"), }, "TextField.margin", new InsetsUIResource(0, 0, 0, 0), "TextField.selectionBackground", new ColorUIResource(Color.black), "TextField.selectionForeground", new ColorUIResource(Color.white), "TextPane.background", new ColorUIResource(Color.white), "TextPane.border", new BasicBorders.MarginBorder(), "TextPane.caretBlinkRate", new Integer(500), "TextPane.caretForeground", new ColorUIResource(Color.black), "TextPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "TextPane.foreground", new ColorUIResource(Color.black), "TextPane.inactiveForeground", new ColorUIResource(Color.gray), "TextPane.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "TextPane.margin", new InsetsUIResource(3, 3, 3, 3), "TextPane.selectionBackground", new ColorUIResource(Color.black), "TextPane.selectionForeground", new ColorUIResource(Color.white), "TitledBorder.border", new BorderUIResource.EtchedBorderUIResource(), "TitledBorder.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TitledBorder.titleColor", new ColorUIResource(darkShadow), "ToggleButton.background", new ColorUIResource(light), "ToggleButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), "ToggleButton.darkShadow", new ColorUIResource(shadow), "ToggleButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "ToggleButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToggleButton.foreground", new ColorUIResource(darkShadow), "ToggleButton.highlight", new ColorUIResource(highLight), "ToggleButton.light", new ColorUIResource(light), "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), "ToggleButton.shadow", new ColorUIResource(shadow), "ToggleButton.textIconGap", new Integer(4), "ToggleButton.textShiftOffset", new Integer(0), "ToolBar.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "UP", "navigateUp", "KP_UP", "navigateUp", "DOWN", "navigateDown", "KP_DOWN", "navigateDown", "LEFT", "navigateLeft", "KP_LEFT", "navigateLeft", "RIGHT", "navigateRight", "KP_RIGHT", "navigateRight" }), "ToolBar.background", new ColorUIResource(light), "ToolBar.border", new BorderUIResource.EtchedBorderUIResource(), "ToolBar.darkShadow", new ColorUIResource(shadow), "ToolBar.dockingBackground", new ColorUIResource(light), "ToolBar.dockingForeground", new ColorUIResource(Color.red), "ToolBar.floatingBackground", new ColorUIResource(light), "ToolBar.floatingForeground", new ColorUIResource(Color.darkGray), "ToolBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToolBar.foreground", new ColorUIResource(darkShadow), "ToolBar.highlight", new ColorUIResource(highLight), "ToolBar.light", new ColorUIResource(highLight), "ToolBar.separatorSize", new DimensionUIResource(20, 20), "ToolBar.shadow", new ColorUIResource(shadow), "ToolTip.background", new ColorUIResource(light), "ToolTip.border", new BorderUIResource.LineBorderUIResource(Color.lightGray), "ToolTip.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ToolTip.foreground", new ColorUIResource(darkShadow), "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancel" }), "Tree.background", new ColorUIResource(light), "Tree.changeSelectionWithFocus", Boolean.TRUE,// "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")),// "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")), "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE, "Tree.editorBorder", new BorderUIResource.LineBorderUIResource(Color.lightGray), "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "shift PAGE_DOWN", "scrollDownExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "END", "selectLast", "ctrl KP_UP", "selectPreviousChangeLead", "shift END", "selectLastExtendSelection", "HOME", "selectFirst", "ctrl END", "selectLastChangeLead", "ctrl SLASH", "selectAll", "LEFT", "selectParent", "shift HOME", "selectFirstExtendSelection", "UP", "selectPrevious", "ctrl KP_DOWN", "selectNextChangeLead", "RIGHT", "selectChild", "ctrl HOME", "selectFirstChangeLead", "DOWN", "selectNext", "ctrl KP_LEFT", "scrollLeft", "shift UP", "selectPreviousExtendSelection", "F2", "startEditing", "ctrl LEFT", "scrollLeft", "ctrl KP_RIGHT","scrollRight", "ctrl UP", "selectPreviousChangeLead", "shift DOWN", "selectNextExtendSelection", "ENTER", "toggle", "KP_UP", "selectPrevious", "KP_DOWN", "selectNext", "ctrl RIGHT", "scrollRight", "KP_LEFT", "selectParent", "KP_RIGHT", "selectChild", "ctrl DOWN", "selectNextChangeLead", "ctrl A", "selectAll", "shift KP_UP", "selectPreviousExtendSelection", "shift KP_DOWN","selectNextExtendSelection", "ctrl SPACE", "toggleSelectionPreserveAnchor", "ctrl shift PAGE_UP", "scrollUpExtendSelection", "ctrl BACK_SLASH", "clearSelection", "shift SPACE", "extendSelection", "ctrl PAGE_UP", "scrollUpChangeLead", "shift PAGE_UP","scrollUpExtendSelection", "SPACE", "toggleSelectionPreserveAnchor", "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", "PAGE_UP", "scrollUpChangeSelection", "ctrl PAGE_DOWN", "scrollDownChangeLead" }), "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)), "Tree.foreground", new ColorUIResource(Color.black), "Tree.hash", new ColorUIResource(new Color(128, 128, 128)), "Tree.leftChildIndent", new Integer(7), "Tree.rightChildIndent", new Integer(13), "Tree.rowHeight", new Integer(20), // FIXME "Tree.scrollsOnExpand", Boolean.TRUE, "Tree.selectionBackground", new ColorUIResource(Color.black), "Tree.nonSelectionBackground", new ColorUIResource(new Color(255, 255, 255)), "Tree.selectionBorderColor", new ColorUIResource(Color.black), "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(Color.black), "Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)), "Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)), "Tree.textForeground", new ColorUIResource(Color.black), "Viewport.background", new ColorUIResource(light), "Viewport.foreground", new ColorUIResource(Color.black), "Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12) }; defaults.putDefaults(uiDefaults); }
| 7,046
|
protected void initComponentDefaults(UIDefaults defaults) { Object[] uiDefaults; Color highLight = new Color(249, 247, 246); Color light = new Color(239, 235, 231); Color shadow = new Color(139, 136, 134); Color darkShadow = new Color(16, 16, 16); uiDefaults = new Object[] { "AbstractUndoableEdit.undoText", "Undo", "AbstractUndoableEdit.redoText", "Redo", "Button.background", new ColorUIResource(Color.LIGHT_GRAY), "Button.border", new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { return BasicBorders.getButtonBorder(); } }, "Button.darkShadow", new ColorUIResource(Color.BLACK), "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "Button.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Button.foreground", new ColorUIResource(Color.BLACK), "Button.highlight", new ColorUIResource(Color.WHITE), "Button.light", new ColorUIResource(Color.LIGHT_GRAY), "Button.margin", new InsetsUIResource(2, 2, 2, 2), "Button.shadow", new ColorUIResource(Color.GRAY), "Button.textIconGap", new Integer(4), "Button.textShiftOffset", new Integer(0), "CheckBox.background", new ColorUIResource(new Color(204, 204, 204)), "CheckBox.border", new BorderUIResource.CompoundBorderUIResource(null, null), "CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "CheckBox.font", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBox.foreground", new ColorUIResource(darkShadow), "CheckBox.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getCheckBoxIcon(); } }, "CheckBox.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getMenuItemCheckIcon(); } }, "CheckBox.margin",new InsetsUIResource(2, 2, 2, 2), "CheckBox.textIconGap", new Integer(4), "CheckBox.textShiftOffset", new Integer(0), "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBoxMenuItem.acceleratorForeground", new ColorUIResource(new Color(16, 16, 16)), "CheckBoxMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "CheckBoxMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "CheckBoxMenuItem.background", new ColorUIResource(light), "CheckBoxMenuItem.border", new BasicBorders.MarginBorder(), "CheckBoxMenuItem.borderPainted", Boolean.FALSE, "CheckBoxMenuItem.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getCheckBoxMenuItemIcon(); } }, "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBoxMenuItem.foreground", new ColorUIResource(darkShadow), "CheckBoxMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "CheckBoxMenuItem.selectionBackground", new ColorUIResource(Color.black), "CheckBoxMenuItem.selectionForeground", new ColorUIResource(Color.white), "ColorChooser.background", new ColorUIResource(light), "ColorChooser.cancelText", "Cancel", "ColorChooser.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ColorChooser.foreground", new ColorUIResource(darkShadow), "ColorChooser.hsbBlueText", "B", "ColorChooser.hsbBrightnessText", "B", "ColorChooser.hsbGreenText", "G", "ColorChooser.hsbHueText", "H", "ColorChooser.hsbNameText", "HSB", "ColorChooser.hsbRedText", "R", "ColorChooser.hsbSaturationText", "S", "ColorChooser.okText", "OK", "ColorChooser.previewText", "Preview", "ColorChooser.resetText", "Reset", "ColorChooser.rgbBlueMnemonic", new Integer(66), "ColorChooser.rgbBlueText", "Blue", "ColorChooser.rgbGreenMnemonic", new Integer(71), "ColorChooser.rgbGreenText", "Green", "ColorChooser.rgbNameText", "RGB", "ColorChooser.rgbRedMnemonic", new Integer(82), "ColorChooser.rgbRedText", "Red", "ColorChooser.sampleText", "Sample Text Sample Text", "ColorChooser.swatchesDefaultRecentColor", new ColorUIResource(light), "ColorChooser.swatchesNameText", "Swatches", "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10), "ColorChooser.swatchesRecentText", "Recent:", "ColorChooser.swatchesSwatchSize", new Dimension(10, 10), "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "hidePopup", "PAGE_UP", "pageUpPassThrough", "PAGE_DOWN", "pageDownPassThrough", "HOME", "homePassThrough", "END", "endPassThrough" }), "ComboBox.background", new ColorUIResource(light), "ComboBox.buttonBackground", new ColorUIResource(light), "ComboBox.buttonDarkShadow", new ColorUIResource(shadow), "ComboBox.buttonHighlight", new ColorUIResource(highLight), "ComboBox.buttonShadow", new ColorUIResource(shadow), "ComboBox.disabledBackground", new ColorUIResource(light), "ComboBox.disabledForeground", new ColorUIResource(Color.gray), "ComboBox.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ComboBox.foreground", new ColorUIResource(Color.black), "ComboBox.selectionBackground", new ColorUIResource(Color.black), "ComboBox.selectionForeground", new ColorUIResource(Color.white), "Desktop.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "KP_LEFT", "left", "KP_RIGHT", "right", "ctrl F5", "restore", "LEFT", "left", "ctrl alt F6", "selectNextFrame", "UP", "up", "ctrl F6", "selectNextFrame", "RIGHT", "right", "DOWN", "down", "ctrl F7", "move", "ctrl F8", "resize", "ESCAPE", "escape", "ctrl TAB", "selectNextFrame", "ctrl F9", "minimize", "KP_UP", "up", "ctrl F4", "close", "KP_DOWN", "down", "ctrl F10", "maximize", "ctrl alt shift F6","selectPreviousFrame" }), "DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null, null), "EditorPane.background", new ColorUIResource(Color.white), "EditorPane.border", new BasicBorders.MarginBorder(), "EditorPane.caretBlinkRate", new Integer(500), "EditorPane.caretForeground", new ColorUIResource(Color.black), "EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "EditorPane.foreground", new ColorUIResource(Color.black), "EditorPane.inactiveForeground", new ColorUIResource(Color.gray), "EditorPane.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "EditorPane.margin", new InsetsUIResource(3, 3, 3, 3), "EditorPane.selectionBackground", new ColorUIResource(Color.black), "EditorPane.selectionForeground", new ColorUIResource(Color.white), "FileChooser.acceptAllFileFilterText", "All Files (*.*)", "FileChooser.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancelSelection" }), "FileChooser.cancelButtonMnemonic", new Integer(67), "FileChooser.cancelButtonText", "Cancel", "FileChooser.cancelButtonToolTipText", "Abort file chooser dialog", // XXX Don't use gif// "FileChooser.detailsViewIcon", new IconUIResource(new ImageIcon("icons/DetailsView.gif")), "FileChooser.directoryDescriptionText", "Directory", "FileChooser.fileDescriptionText", "Generic File", "FileChooser.helpButtonMnemonic", new Integer(72), "FileChooser.helpButtonText", "Help", "FileChooser.helpButtonToolTipText", "FileChooser help", // XXX Don't use gif// "FileChooser.homeFolderIcon", new IconUIResource(new ImageIcon("icons/HomeFolder.gif")), // XXX Don't use gif// "FileChooser.listViewIcon", new IconUIResource(new ImageIcon("icons/ListView.gif")), "FileChooser.newFolderErrorSeparator", ":", "FileChooser.newFolderErrorText", "Error creating new folder", // XXX Don't use gif// "FileChooser.newFolderIcon", new IconUIResource(new ImageIcon("icons/NewFolder.gif")), "FileChooser.openButtonMnemonic", new Integer(79), "FileChooser.openButtonText", "Open", "FileChooser.openButtonToolTipText", "Open selected file", "FileChooser.saveButtonMnemonic", new Integer(83), "FileChooser.saveButtonText", "Save", "FileChooser.saveButtonToolTipText", "Save selected file", // XXX Don't use gif// "FileChooser.upFolderIcon", new IconUIResource(new ImageIcon("icons/UpFolder.gif")), "FileChooser.updateButtonMnemonic", new Integer(85), "FileChooser.updateButtonText", "Update", "FileChooser.updateButtonToolTipText", "Update directory listing", // XXX Don't use gif// "FileView.computerIcon", new IconUIResource(new ImageIcon("icons/Computer.gif")), // XXX Don't use gif// "FileView.directoryIcon", new IconUIResource(new ImageIcon("icons/Directory.gif")), // XXX Don't use gif// "FileView.fileIcon", new IconUIResource(new ImageIcon("icons/File.gif")), // XXX Don't use gif// "FileView.floppyDriveIcon", new IconUIResource(new ImageIcon("icons/Floppy.gif")), // XXX Don't use gif// "FileView.hardDriveIcon", new IconUIResource(new ImageIcon("icons/HardDrive.gif")), "FocusManagerClassName", "TODO", "FormattedTextField.background", new ColorUIResource(light), "FormattedTextField.caretForeground", new ColorUIResource(Color.black), "FormattedTextField.foreground", new ColorUIResource(Color.black), "FormattedTextField.inactiveBackground", new ColorUIResource(light), "FormattedTextField.inactiveForeground", new ColorUIResource(Color.gray), "FormattedTextField.selectionBackground", new ColorUIResource(Color.black), "FormattedTextField.selectionForeground", new ColorUIResource(Color.white), "FormView.resetButtonText", "Reset", "FormView.submitButtonText", "Submit Query", "InternalFrame.activeTitleBackground", new ColorUIResource(0, 0, 128), "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white), "InternalFrame.border", new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { Color lineColor = new Color(238, 238, 238); Border inner = BorderFactory.createLineBorder(lineColor, 1); Color shadowInner = new Color(184, 207, 229); Color shadowOuter = new Color(122, 138, 153); Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Color.WHITE, shadowOuter, shadowInner); Border border = new BorderUIResource.CompoundBorderUIResource(outer, inner); return border; } }, "InternalFrame.borderColor", new ColorUIResource(light), "InternalFrame.borderDarkShadow", new ColorUIResource(Color.BLACK), "InternalFrame.borderHighlight", new ColorUIResource(Color.WHITE), "InternalFrame.borderLight", new ColorUIResource(Color.LIGHT_GRAY), "InternalFrame.borderShadow", new ColorUIResource(Color.GRAY), "InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(), // FIXME: Set a nice icon for InternalFrames here. "InternalFrame.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return new IconUIResource(BasicIconFactory.createEmptyFrameIcon()); } }, "InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.gray), "InternalFrame.inactiveTitleForeground", new ColorUIResource(Color.lightGray), "InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.titleFont", new FontUIResource("Dialog", Font.BOLD, 12), "InternalFrame.windowBindings", new Object[] { "shift ESCAPE", "showSystemMenu", "ctrl SPACE", "showSystemMenu", "ESCAPE", "showSystemMenu" }, "Label.background", new ColorUIResource(light), "Label.disabledForeground", new ColorUIResource(Color.white), "Label.disabledShadow", new ColorUIResource(shadow), "Label.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Label.foreground", new ColorUIResource(darkShadow), "List.background", new ColorUIResource(light), "List.border", new BasicBorders.MarginBorder(), "List.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "ctrl \\", "clearSelection", "PAGE_DOWN", "scrollDown", "shift PAGE_DOWN","scrollDownExtendSelection", "END", "selectLastRow", "HOME", "selectFirstRow", "shift END", "selectLastRowExtendSelection", "shift HOME", "selectFirstRowExtendSelection", "UP", "selectPreviousRow", "ctrl /", "selectAll", "ctrl A", "selectAll", "DOWN", "selectNextRow", "shift UP", "selectPreviousRowExtendSelection", "ctrl SPACE", "selectNextRowExtendSelection", "shift DOWN", "selectNextRowExtendSelection", "KP_UP", "selectPreviousRow", "shift PAGE_UP","scrollUpExtendSelection", "KP_DOWN", "selectNextRow" }), "List.foreground", new ColorUIResource(darkShadow), "List.selectionBackground", new ColorUIResource(Color.black), "List.selectionForeground", new ColorUIResource(Color.white), "List.focusCellHighlightBorder", new BorderUIResource. LineBorderUIResource(new ColorUIResource(Color.yellow)), "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "Menu.acceleratorForeground", new ColorUIResource(darkShadow), "Menu.acceleratorSelectionForeground", new ColorUIResource(Color.white), "Menu.arrowIcon", BasicIconFactory.getMenuArrowIcon(), "Menu.background", new ColorUIResource(light), "Menu.border", new BasicBorders.MarginBorder(), "Menu.borderPainted", Boolean.FALSE, "Menu.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "Menu.consumesTabs", Boolean.TRUE, "Menu.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Menu.foreground", new ColorUIResource(darkShadow), "Menu.margin", new InsetsUIResource(2, 2, 2, 2), "Menu.selectedWindowInputMapBindings", new Object[] { "ESCAPE", "cancel", "DOWN", "selectNext", "KP_DOWN", "selectNext", "UP", "selectPrevious", "KP_UP", "selectPrevious", "LEFT", "selectParent", "KP_LEFT", "selectParent", "RIGHT", "selectChild", "KP_RIGHT", "selectChild", "ENTER", "return", "SPACE", "return" }, "Menu.selectionBackground", new ColorUIResource(Color.black), "Menu.selectionForeground", new ColorUIResource(Color.white), "MenuBar.background", new ColorUIResource(light), "MenuBar.border", new BasicBorders.MenuBarBorder(null, null), "MenuBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuBar.foreground", new ColorUIResource(darkShadow), "MenuBar.highlight", new ColorUIResource(highLight), "MenuBar.shadow", new ColorUIResource(shadow), "MenuBar.windowBindings", new Object[] { "F10", "takeFocus" }, "MenuItem.acceleratorDelimiter", "-", "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuItem.acceleratorForeground", new ColorUIResource(darkShadow), "MenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "MenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "MenuItem.background", new ColorUIResource(light), "MenuItem.border", new BasicBorders.MarginBorder(), "MenuItem.borderPainted", Boolean.FALSE, "MenuItem.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "MenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuItem.foreground", new ColorUIResource(darkShadow), "MenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "MenuItem.selectionBackground", new ColorUIResource(Color.black), "MenuItem.selectionForeground", new ColorUIResource(Color.white), "OptionPane.background", new ColorUIResource(light), "OptionPane.border", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.buttonAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.cancelButtonText", "Cancel", // XXX Don't use gif// "OptionPane.errorIcon",// new IconUIResource(new ImageIcon("icons/Error.gif")), "OptionPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "OptionPane.foreground", new ColorUIResource(darkShadow), // XXX Don't use gif// "OptionPane.informationIcon",// new IconUIResource(new ImageIcon("icons/Inform.gif")), "OptionPane.messageAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.messageForeground", new ColorUIResource(darkShadow), "OptionPane.minimumSize", new DimensionUIResource(262, 90), "OptionPane.noButtonText", "No", "OptionPane.okButtonText", "OK", // XXX Don't use gif// "OptionPane.questionIcon",// new IconUIResource(new ImageIcon("icons/Question.gif")), // XXX Don't use gif// "OptionPane.warningIcon",// new IconUIResource(new ImageIcon("icons/Warn.gif")), "OptionPane.windowBindings", new Object[] { "ESCAPE", "close" }, "OptionPane.yesButtonText", "Yes", "Panel.background", new ColorUIResource(light), "Panel.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Panel.foreground", new ColorUIResource(Color.black), "PasswordField.background", new ColorUIResource(light), "PasswordField.border", new BasicBorders.FieldBorder(null, null, null, null), "PasswordField.caretBlinkRate", new Integer(500), "PasswordField.caretForeground", new ColorUIResource(Color.black), "PasswordField.font", new FontUIResource("Dialog", Font.PLAIN, 12), "PasswordField.foreground", new ColorUIResource(Color.black), "PasswordField.inactiveBackground", new ColorUIResource(light), "PasswordField.inactiveForeground", new ColorUIResource(Color.gray), "PasswordField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept")}, "PasswordField.margin", new InsetsUIResource(0, 0, 0, 0), "PasswordField.selectionBackground", new ColorUIResource(Color.black), "PasswordField.selectionForeground", new ColorUIResource(Color.white), "PopupMenu.background", new ColorUIResource(light), "PopupMenu.border", new BorderUIResource.BevelBorderUIResource(0), "PopupMenu.font", new FontUIResource("Dialog", Font.PLAIN, 12), "PopupMenu.foreground", new ColorUIResource(darkShadow), "ProgressBar.background", new ColorUIResource(light), "ProgressBar.border", new BorderUIResource.LineBorderUIResource(Color.darkGray), "ProgressBar.cellLength", new Integer(1), "ProgressBar.cellSpacing", new Integer(0), "ProgressBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ProgressBar.foreground", new ColorUIResource(Color.black), "ProgressBar.selectionBackground", new ColorUIResource(Color.black), "ProgressBar.selectionForeground", new ColorUIResource(light), "ProgressBar.repaintInterval", new Integer(250), "ProgressBar.cycleTime", new Integer(6000), "RadioButton.background", new ColorUIResource(light), "RadioButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), "RadioButton.darkShadow", new ColorUIResource(shadow), "RadioButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "RadioButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButton.foreground", new ColorUIResource(darkShadow), "RadioButton.highlight", new ColorUIResource(highLight), "RadioButton.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getRadioButtonIcon(); } }, "RadioButton.light", new ColorUIResource(highLight), "RadioButton.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButton.shadow", new ColorUIResource(shadow), "RadioButton.textIconGap", new Integer(4), "RadioButton.textShiftOffset", new Integer(0), "RadioButtonMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButtonMenuItem.acceleratorForeground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "RadioButtonMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "RadioButtonMenuItem.background", new ColorUIResource(light), "RadioButtonMenuItem.border", new BasicBorders.MarginBorder(), "RadioButtonMenuItem.borderPainted", Boolean.FALSE, "RadioButtonMenuItem.checkIcon", BasicIconFactory.getRadioButtonMenuItemIcon(), "RadioButtonMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButtonMenuItem.foreground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButtonMenuItem.selectionBackground", new ColorUIResource(Color.black), "RadioButtonMenuItem.selectionForeground", new ColorUIResource(Color.white), "RootPane.defaultButtonWindowKeyBindings", new Object[] { "ENTER", "press", "released ENTER", "release", "ctrl ENTER", "press", "ctrl released ENTER", "release" }, "ScrollBar.background", new ColorUIResource(224, 224, 224), "ScrollBar.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "negativeBlockIncrement", "PAGE_DOWN", "positiveBlockIncrement", "END", "maxScroll", "HOME", "minScroll", "LEFT", "positiveUnitIncrement", "KP_UP", "negativeUnitIncrement", "KP_DOWN", "positiveUnitIncrement", "UP", "negativeUnitIncrement", "RIGHT", "negativeUnitIncrement", "KP_LEFT", "positiveUnitIncrement", "DOWN", "positiveUnitIncrement", "KP_RIGHT", "negativeUnitIncrement" }), "ScrollBar.foreground", new ColorUIResource(light), "ScrollBar.maximumThumbSize", new DimensionUIResource(4096, 4096), "ScrollBar.minimumThumbSize", new DimensionUIResource(8, 8), "ScrollBar.thumb", new ColorUIResource(light), "ScrollBar.thumbDarkShadow", new ColorUIResource(shadow), "ScrollBar.thumbHighlight", new ColorUIResource(highLight), "ScrollBar.thumbShadow", new ColorUIResource(shadow), "ScrollBar.track", new ColorUIResource(light), "ScrollBar.trackHighlight", new ColorUIResource(shadow), "ScrollBar.width", new Integer(16), "ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "KP_LEFT", "unitScrollLeft", "ctrl PAGE_DOWN","scrollRight", "PAGE_DOWN", "scrollDown", "KP_RIGHT", "unitScrollRight", "LEFT", "unitScrollLeft", "ctrl END", "scrollEnd", "UP", "unitScrollUp", "RIGHT", "unitScrollRight", "DOWN", "unitScrollDown", "ctrl HOME", "scrollHome", "ctrl PAGE_UP", "scrollLeft", "KP_UP", "unitScrollUp", "KP_DOWN", "unitScrollDown" }), "ScrollPane.background", new ColorUIResource(light), "ScrollPane.border", new BorderUIResource.EtchedBorderUIResource(), "ScrollPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ScrollPane.foreground", new ColorUIResource(darkShadow), "Separator.background", new ColorUIResource(highLight), "Separator.foreground", new ColorUIResource(shadow), "Separator.highlight", new ColorUIResource(highLight), "Separator.shadow", new ColorUIResource(shadow), "Slider.background", new ColorUIResource(light), "Slider.focus", new ColorUIResource(shadow), "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "positiveBlockIncrement", "PAGE_DOWN", "negativeBlockIncrement", "END", "maxScroll", "HOME", "minScroll", "LEFT", "negativeUnitIncrement", "KP_UP", "positiveUnitIncrement", "KP_DOWN", "negativeUnitIncrement", "UP", "positiveUnitIncrement", "RIGHT", "positiveUnitIncrement", "KP_LEFT", "negativeUnitIncrement", "DOWN", "negativeUnitIncrement", "KP_RIGHT", "positiveUnitIncrement" }), "Slider.focusInsets", new InsetsUIResource(2, 2, 2, 2), "Slider.foreground", new ColorUIResource(light), "Slider.highlight", new ColorUIResource(highLight), "Slider.shadow", new ColorUIResource(shadow), "Slider.thumbHeight", new Integer(20), "Slider.thumbWidth", new Integer(11), "Slider.tickHeight", new Integer(12), "Spinner.background", new ColorUIResource(light), "Spinner.foreground", new ColorUIResource(light), "SplitPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "F6", "toggleFocus", "F8", "startResize", "END", "selectMax", "HOME", "selectMin", "LEFT", "negativeIncremnent", "KP_UP", "negativeIncrement", "KP_DOWN", "positiveIncrement", "UP", "negativeIncrement", "RIGHT", "positiveIncrement", "KP_LEFT", "negativeIncrement", "DOWN", "positiveIncrement", "KP_RIGHT", "positiveIncrement" }), "SplitPane.background", new ColorUIResource(light), "SplitPane.border", new BasicBorders.SplitPaneBorder(null, null), "SplitPane.darkShadow", new ColorUIResource(shadow), "SplitPane.dividerSize", new Integer(10), "SplitPane.highlight", new ColorUIResource(highLight), "SplitPane.shadow", new ColorUIResource(shadow), "TabbedPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ctrl PAGE_DOWN","navigatePageDown", "ctrl PAGE_UP", "navigatePageUp", "ctrl UP", "requestFocus", "ctrl KP_UP", "requestFocus" }), "TabbedPane.background", new ColorUIResource(light), "TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3), "TabbedPane.darkShadow", new ColorUIResource(shadow), "TabbedPane.focus", new ColorUIResource(darkShadow), "TabbedPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "LEFT", "navigateLeft", "KP_UP", "navigateUp", "ctrl DOWN", "requestFocusForVisibleComponent", "UP", "navigateUp", "KP_DOWN", "navigateDown", "RIGHT", "navigateRight", "KP_LEFT", "navigateLeft", "ctrl KP_DOWN", "requestFocusForVisibleComponent", "KP_RIGHT", "navigateRight", "DOWN", "navigateDown" }), "TabbedPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TabbedPane.foreground", new ColorUIResource(darkShadow), "TabbedPane.highlight", new ColorUIResource(highLight), "TabbedPane.light", new ColorUIResource(highLight), "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1), "TabbedPane.shadow", new ColorUIResource(shadow), "TabbedPane.tabbedPaneTabAreaInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabInsets", new InsetsUIResource(1, 4, 1, 4), "TabbedPane.tabbedPaneContentBorderInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabPadInsets", new InsetsUIResource(1, 1, 1, 1), "TabbedPane.tabRunOverlay", new Integer(2), "TabbedPane.textIconGap", new Integer(4), "Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "shift PAGE_DOWN","scrollDownExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "END", "selectLastColumn", "shift END", "selectLastColumnExtendSelection", "HOME", "selectFirstColumn", "ctrl END", "selectLastRow", "ctrl shift END","selectLastRowExtendSelection", "LEFT", "selectPreviousColumn", "shift HOME", "selectFirstColumnExtendSelection", "UP", "selectPreviousRow", "RIGHT", "selectNextColumn", "ctrl HOME", "selectFirstRow", "shift LEFT", "selectPreviousColumnExtendSelection", "DOWN", "selectNextRow", "ctrl shift HOME","selectFirstRowExtendSelection", "shift UP", "selectPreviousRowExtendSelection", "F2", "startEditing", "shift RIGHT", "selectNextColumnExtendSelection", "TAB", "selectNextColumnCell", "shift DOWN", "selectNextRowExtendSelection", "ENTER", "selectNextRowCell", "KP_UP", "selectPreviousRow", "KP_DOWN", "selectNextRow", "KP_LEFT", "selectPreviousColumn", "KP_RIGHT", "selectNextColumn", "shift TAB", "selectPreviousColumnCell", "ctrl A", "selectAll", "shift ENTER", "selectPreviousRowCell", "shift KP_DOWN", "selectNextRowExtendSelection", "shift KP_LEFT", "selectPreviousColumnExtendSelection", "ESCAPE", "cancel", "ctrl shift PAGE_UP", "scrollLeftExtendSelection", "shift KP_RIGHT", "selectNextColumnExtendSelection", "ctrl PAGE_UP", "scrollLeftChangeSelection", "shift PAGE_UP", "scrollUpExtendSelection", "ctrl shift PAGE_DOWN", "scrollRightExtendSelection", "ctrl PAGE_DOWN", "scrollRightChangeSelection", "PAGE_UP", "scrollUpChangeSelection", "ctrl shift LEFT", "selectPreviousColumnExtendSelection", "shift KP_UP", "selectPreviousRowExtendSelection", "ctrl shift UP", "selectPreviousRowExtendSelection", "ctrl shift RIGHT", "selectNextColumnExtendSelection", "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", "ctrl shift DOWN", "selectNextRowExtendSelection", "ctrl BACK_SLASH", "clearSelection", "ctrl shift KP_UP", "selectPreviousRowExtendSelection", "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", "ctrl SLASH", "selectAll", "ctrl shift KP_DOWN", "selectNextRowExtendSelection", }), "Table.background", new ColorUIResource(light), "Table.focusCellBackground", new ColorUIResource(light), "Table.focusCellForeground", new ColorUIResource(darkShadow), "Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource( new ColorUIResource(255, 255, 0)), "Table.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Table.foreground", new ColorUIResource(darkShadow), "Table.gridColor", new ColorUIResource(Color.gray), "Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0), "Table.selectionBackground", new ColorUIResource(Color.black), "Table.selectionForeground", new ColorUIResource(Color.white), "TableHeader.background", new ColorUIResource(light), "TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0), "TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TableHeader.foreground", new ColorUIResource(darkShadow), "TextArea.background", new ColorUIResource(light), "TextArea.border", new BasicBorders.MarginBorder(), "TextArea.caretBlinkRate", new Integer(500), "TextArea.caretForeground", new ColorUIResource(Color.black), "TextArea.font", new FontUIResource("Monospaced", Font.PLAIN, 12), "TextArea.foreground", new ColorUIResource(Color.black), "TextArea.inactiveForeground", new ColorUIResource(Color.gray), "TextArea.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "TextArea.margin", new InsetsUIResource(0, 0, 0, 0), "TextArea.selectionBackground", new ColorUIResource(Color.black), "TextArea.selectionForeground", new ColorUIResource(Color.white), "TextField.background", new ColorUIResource(light), "TextField.border", new BasicBorders.FieldBorder(null, null, null, null), "TextField.caretBlinkRate", new Integer(500), "TextField.caretForeground", new ColorUIResource(Color.black), "TextField.darkShadow", new ColorUIResource(shadow), "TextField.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "TextField.foreground", new ColorUIResource(Color.black), "TextField.highlight", new ColorUIResource(highLight), "TextField.inactiveBackground", new ColorUIResource(Color.LIGHT_GRAY), "TextField.inactiveForeground", new ColorUIResource(Color.GRAY), "TextField.light", new ColorUIResource(highLight), "TextField.highlight", new ColorUIResource(light), "TextField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_DOWN_MASK), "selection-backward"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_DOWN_MASK), "selection-forward"), }, "TextField.margin", new InsetsUIResource(0, 0, 0, 0), "TextField.selectionBackground", new ColorUIResource(Color.black), "TextField.selectionForeground", new ColorUIResource(Color.white), "TextPane.background", new ColorUIResource(Color.white), "TextPane.border", new BasicBorders.MarginBorder(), "TextPane.caretBlinkRate", new Integer(500), "TextPane.caretForeground", new ColorUIResource(Color.black), "TextPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "TextPane.foreground", new ColorUIResource(Color.black), "TextPane.inactiveForeground", new ColorUIResource(Color.gray), "TextPane.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "TextPane.margin", new InsetsUIResource(3, 3, 3, 3), "TextPane.selectionBackground", new ColorUIResource(Color.black), "TextPane.selectionForeground", new ColorUIResource(Color.white), "TitledBorder.border", new BorderUIResource.EtchedBorderUIResource(), "TitledBorder.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TitledBorder.titleColor", new ColorUIResource(darkShadow), "ToggleButton.background", new ColorUIResource(light), "ToggleButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), "ToggleButton.darkShadow", new ColorUIResource(shadow), "ToggleButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "ToggleButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToggleButton.foreground", new ColorUIResource(darkShadow), "ToggleButton.highlight", new ColorUIResource(highLight), "ToggleButton.light", new ColorUIResource(light), "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), "ToggleButton.shadow", new ColorUIResource(shadow), "ToggleButton.textIconGap", new Integer(4), "ToggleButton.textShiftOffset", new Integer(0), "ToolBar.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "UP", "navigateUp", "KP_UP", "navigateUp", "DOWN", "navigateDown", "KP_DOWN", "navigateDown", "LEFT", "navigateLeft", "KP_LEFT", "navigateLeft", "RIGHT", "navigateRight", "KP_RIGHT", "navigateRight" }), "ToolBar.background", new ColorUIResource(light), "ToolBar.border", new BorderUIResource.EtchedBorderUIResource(), "ToolBar.darkShadow", new ColorUIResource(shadow), "ToolBar.dockingBackground", new ColorUIResource(light), "ToolBar.dockingForeground", new ColorUIResource(Color.red), "ToolBar.floatingBackground", new ColorUIResource(light), "ToolBar.floatingForeground", new ColorUIResource(Color.darkGray), "ToolBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToolBar.foreground", new ColorUIResource(darkShadow), "ToolBar.highlight", new ColorUIResource(highLight), "ToolBar.light", new ColorUIResource(highLight), "ToolBar.separatorSize", new DimensionUIResource(20, 20), "ToolBar.shadow", new ColorUIResource(shadow), "ToolTip.background", new ColorUIResource(light), "ToolTip.border", new BorderUIResource.LineBorderUIResource(Color.lightGray), "ToolTip.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ToolTip.foreground", new ColorUIResource(darkShadow), "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancel" }), "Tree.background", new ColorUIResource(light), "Tree.changeSelectionWithFocus", Boolean.TRUE,// "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")),// "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")), "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE, "Tree.editorBorder", new BorderUIResource.LineBorderUIResource(Color.lightGray), "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "shift PAGE_DOWN", "scrollDownExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "END", "selectLast", "ctrl KP_UP", "selectPreviousChangeLead", "shift END", "selectLastExtendSelection", "HOME", "selectFirst", "ctrl END", "selectLastChangeLead", "ctrl SLASH", "selectAll", "LEFT", "selectParent", "shift HOME", "selectFirstExtendSelection", "UP", "selectPrevious", "ctrl KP_DOWN", "selectNextChangeLead", "RIGHT", "selectChild", "ctrl HOME", "selectFirstChangeLead", "DOWN", "selectNext", "ctrl KP_LEFT", "scrollLeft", "shift UP", "selectPreviousExtendSelection", "F2", "startEditing", "ctrl LEFT", "scrollLeft", "ctrl KP_RIGHT","scrollRight", "ctrl UP", "selectPreviousChangeLead", "shift DOWN", "selectNextExtendSelection", "ENTER", "toggle", "KP_UP", "selectPrevious", "KP_DOWN", "selectNext", "ctrl RIGHT", "scrollRight", "KP_LEFT", "selectParent", "KP_RIGHT", "selectChild", "ctrl DOWN", "selectNextChangeLead", "ctrl A", "selectAll", "shift KP_UP", "selectPreviousExtendSelection", "shift KP_DOWN","selectNextExtendSelection", "ctrl SPACE", "toggleSelectionPreserveAnchor", "ctrl shift PAGE_UP", "scrollUpExtendSelection", "ctrl BACK_SLASH", "clearSelection", "shift SPACE", "extendSelection", "ctrl PAGE_UP", "scrollUpChangeLead", "shift PAGE_UP","scrollUpExtendSelection", "SPACE", "toggleSelectionPreserveAnchor", "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", "PAGE_UP", "scrollUpChangeSelection", "ctrl PAGE_DOWN", "scrollDownChangeLead" }), "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)), "Tree.foreground", new ColorUIResource(Color.black), "Tree.hash", new ColorUIResource(new Color(128, 128, 128)), "Tree.leftChildIndent", new Integer(7), "Tree.rightChildIndent", new Integer(13), "Tree.rowHeight", new Integer(20), // FIXME "Tree.scrollsOnExpand", Boolean.TRUE, "Tree.selectionBackground", new ColorUIResource(Color.black), "Tree.nonSelectionBackground", new ColorUIResource(new Color(239, 235, 231)), "Tree.selectionBorderColor", new ColorUIResource(Color.black), "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(Color.black), "Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)), "Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)), "Tree.textForeground", new ColorUIResource(Color.black), "Viewport.background", new ColorUIResource(light), "Viewport.foreground", new ColorUIResource(Color.black), "Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12) }; defaults.putDefaults(uiDefaults); }
|
protected void initComponentDefaults(UIDefaults defaults) { Object[] uiDefaults; Color highLight = new Color(249, 247, 246); Color light = new Color(239, 235, 231); Color shadow = new Color(139, 136, 134); Color darkShadow = new Color(16, 16, 16); uiDefaults = new Object[] { "AbstractUndoableEdit.undoText", "Undo", "AbstractUndoableEdit.redoText", "Redo", "Button.background", new ColorUIResource(Color.LIGHT_GRAY), "Button.border", new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { return BasicBorders.getButtonBorder(); } }, "Button.darkShadow", new ColorUIResource(Color.BLACK), "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "Button.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Button.foreground", new ColorUIResource(Color.BLACK), "Button.highlight", new ColorUIResource(Color.WHITE), "Button.light", new ColorUIResource(Color.LIGHT_GRAY), "Button.margin", new InsetsUIResource(2, 2, 2, 2), "Button.shadow", new ColorUIResource(Color.GRAY), "Button.textIconGap", new Integer(4), "Button.textShiftOffset", new Integer(0), "CheckBox.background", new ColorUIResource(new Color(204, 204, 204)), "CheckBox.border", new BorderUIResource.CompoundBorderUIResource(null, null), "CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "CheckBox.font", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBox.foreground", new ColorUIResource(darkShadow), "CheckBox.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getCheckBoxIcon(); } }, "CheckBox.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getMenuItemCheckIcon(); } }, "CheckBox.margin",new InsetsUIResource(2, 2, 2, 2), "CheckBox.textIconGap", new Integer(4), "CheckBox.textShiftOffset", new Integer(0), "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBoxMenuItem.acceleratorForeground", new ColorUIResource(new Color(16, 16, 16)), "CheckBoxMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "CheckBoxMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "CheckBoxMenuItem.background", new ColorUIResource(light), "CheckBoxMenuItem.border", new BasicBorders.MarginBorder(), "CheckBoxMenuItem.borderPainted", Boolean.FALSE, "CheckBoxMenuItem.checkIcon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getCheckBoxMenuItemIcon(); } }, "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "CheckBoxMenuItem.foreground", new ColorUIResource(darkShadow), "CheckBoxMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "CheckBoxMenuItem.selectionBackground", new ColorUIResource(Color.black), "CheckBoxMenuItem.selectionForeground", new ColorUIResource(Color.white), "ColorChooser.background", new ColorUIResource(light), "ColorChooser.cancelText", "Cancel", "ColorChooser.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ColorChooser.foreground", new ColorUIResource(darkShadow), "ColorChooser.hsbBlueText", "B", "ColorChooser.hsbBrightnessText", "B", "ColorChooser.hsbGreenText", "G", "ColorChooser.hsbHueText", "H", "ColorChooser.hsbNameText", "HSB", "ColorChooser.hsbRedText", "R", "ColorChooser.hsbSaturationText", "S", "ColorChooser.okText", "OK", "ColorChooser.previewText", "Preview", "ColorChooser.resetText", "Reset", "ColorChooser.rgbBlueMnemonic", new Integer(66), "ColorChooser.rgbBlueText", "Blue", "ColorChooser.rgbGreenMnemonic", new Integer(71), "ColorChooser.rgbGreenText", "Green", "ColorChooser.rgbNameText", "RGB", "ColorChooser.rgbRedMnemonic", new Integer(82), "ColorChooser.rgbRedText", "Red", "ColorChooser.sampleText", "Sample Text Sample Text", "ColorChooser.swatchesDefaultRecentColor", new ColorUIResource(light), "ColorChooser.swatchesNameText", "Swatches", "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10), "ColorChooser.swatchesRecentText", "Recent:", "ColorChooser.swatchesSwatchSize", new Dimension(10, 10), "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "hidePopup", "PAGE_UP", "pageUpPassThrough", "PAGE_DOWN", "pageDownPassThrough", "HOME", "homePassThrough", "END", "endPassThrough" }), "ComboBox.background", new ColorUIResource(light), "ComboBox.buttonBackground", new ColorUIResource(light), "ComboBox.buttonDarkShadow", new ColorUIResource(shadow), "ComboBox.buttonHighlight", new ColorUIResource(highLight), "ComboBox.buttonShadow", new ColorUIResource(shadow), "ComboBox.disabledBackground", new ColorUIResource(light), "ComboBox.disabledForeground", new ColorUIResource(Color.gray), "ComboBox.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ComboBox.foreground", new ColorUIResource(Color.black), "ComboBox.selectionBackground", new ColorUIResource(Color.black), "ComboBox.selectionForeground", new ColorUIResource(Color.white), "Desktop.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "KP_LEFT", "left", "KP_RIGHT", "right", "ctrl F5", "restore", "LEFT", "left", "ctrl alt F6", "selectNextFrame", "UP", "up", "ctrl F6", "selectNextFrame", "RIGHT", "right", "DOWN", "down", "ctrl F7", "move", "ctrl F8", "resize", "ESCAPE", "escape", "ctrl TAB", "selectNextFrame", "ctrl F9", "minimize", "KP_UP", "up", "ctrl F4", "close", "KP_DOWN", "down", "ctrl F10", "maximize", "ctrl alt shift F6","selectPreviousFrame" }), "DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null, null), "EditorPane.background", new ColorUIResource(Color.white), "EditorPane.border", new BasicBorders.MarginBorder(), "EditorPane.caretBlinkRate", new Integer(500), "EditorPane.caretForeground", new ColorUIResource(Color.black), "EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "EditorPane.foreground", new ColorUIResource(Color.black), "EditorPane.inactiveForeground", new ColorUIResource(Color.gray), "EditorPane.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "EditorPane.margin", new InsetsUIResource(3, 3, 3, 3), "EditorPane.selectionBackground", new ColorUIResource(Color.black), "EditorPane.selectionForeground", new ColorUIResource(Color.white), "FileChooser.acceptAllFileFilterText", "All Files (*.*)", "FileChooser.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancelSelection" }), "FileChooser.cancelButtonMnemonic", new Integer(67), "FileChooser.cancelButtonText", "Cancel", "FileChooser.cancelButtonToolTipText", "Abort file chooser dialog", // XXX Don't use gif// "FileChooser.detailsViewIcon", new IconUIResource(new ImageIcon("icons/DetailsView.gif")), "FileChooser.directoryDescriptionText", "Directory", "FileChooser.fileDescriptionText", "Generic File", "FileChooser.helpButtonMnemonic", new Integer(72), "FileChooser.helpButtonText", "Help", "FileChooser.helpButtonToolTipText", "FileChooser help", // XXX Don't use gif// "FileChooser.homeFolderIcon", new IconUIResource(new ImageIcon("icons/HomeFolder.gif")), // XXX Don't use gif// "FileChooser.listViewIcon", new IconUIResource(new ImageIcon("icons/ListView.gif")), "FileChooser.newFolderErrorSeparator", ":", "FileChooser.newFolderErrorText", "Error creating new folder", // XXX Don't use gif// "FileChooser.newFolderIcon", new IconUIResource(new ImageIcon("icons/NewFolder.gif")), "FileChooser.openButtonMnemonic", new Integer(79), "FileChooser.openButtonText", "Open", "FileChooser.openButtonToolTipText", "Open selected file", "FileChooser.saveButtonMnemonic", new Integer(83), "FileChooser.saveButtonText", "Save", "FileChooser.saveButtonToolTipText", "Save selected file", // XXX Don't use gif// "FileChooser.upFolderIcon", new IconUIResource(new ImageIcon("icons/UpFolder.gif")), "FileChooser.updateButtonMnemonic", new Integer(85), "FileChooser.updateButtonText", "Update", "FileChooser.updateButtonToolTipText", "Update directory listing", // XXX Don't use gif// "FileView.computerIcon", new IconUIResource(new ImageIcon("icons/Computer.gif")), // XXX Don't use gif// "FileView.directoryIcon", new IconUIResource(new ImageIcon("icons/Directory.gif")), // XXX Don't use gif// "FileView.fileIcon", new IconUIResource(new ImageIcon("icons/File.gif")), // XXX Don't use gif// "FileView.floppyDriveIcon", new IconUIResource(new ImageIcon("icons/Floppy.gif")), // XXX Don't use gif// "FileView.hardDriveIcon", new IconUIResource(new ImageIcon("icons/HardDrive.gif")), "FocusManagerClassName", "TODO", "FormattedTextField.background", new ColorUIResource(light), "FormattedTextField.caretForeground", new ColorUIResource(Color.black), "FormattedTextField.foreground", new ColorUIResource(Color.black), "FormattedTextField.inactiveBackground", new ColorUIResource(light), "FormattedTextField.inactiveForeground", new ColorUIResource(Color.gray), "FormattedTextField.selectionBackground", new ColorUIResource(Color.black), "FormattedTextField.selectionForeground", new ColorUIResource(Color.white), "FormView.resetButtonText", "Reset", "FormView.submitButtonText", "Submit Query", "InternalFrame.activeTitleBackground", new ColorUIResource(0, 0, 128), "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white), "InternalFrame.border", new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { Color lineColor = new Color(238, 238, 238); Border inner = BorderFactory.createLineBorder(lineColor, 1); Color shadowInner = new Color(184, 207, 229); Color shadowOuter = new Color(122, 138, 153); Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Color.WHITE, shadowOuter, shadowInner); Border border = new BorderUIResource.CompoundBorderUIResource(outer, inner); return border; } }, "InternalFrame.borderColor", new ColorUIResource(light), "InternalFrame.borderDarkShadow", new ColorUIResource(Color.BLACK), "InternalFrame.borderHighlight", new ColorUIResource(Color.WHITE), "InternalFrame.borderLight", new ColorUIResource(Color.LIGHT_GRAY), "InternalFrame.borderShadow", new ColorUIResource(Color.GRAY), "InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(), // FIXME: Set a nice icon for InternalFrames here. "InternalFrame.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return new IconUIResource(BasicIconFactory.createEmptyFrameIcon()); } }, "InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.gray), "InternalFrame.inactiveTitleForeground", new ColorUIResource(Color.lightGray), "InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.titleFont", new FontUIResource("Dialog", Font.BOLD, 12), "InternalFrame.windowBindings", new Object[] { "shift ESCAPE", "showSystemMenu", "ctrl SPACE", "showSystemMenu", "ESCAPE", "showSystemMenu" }, "Label.background", new ColorUIResource(light), "Label.disabledForeground", new ColorUIResource(Color.white), "Label.disabledShadow", new ColorUIResource(shadow), "Label.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Label.foreground", new ColorUIResource(darkShadow), "List.background", new ColorUIResource(light), "List.border", new BasicBorders.MarginBorder(), "List.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "ctrl \\", "clearSelection", "PAGE_DOWN", "scrollDown", "shift PAGE_DOWN","scrollDownExtendSelection", "END", "selectLastRow", "HOME", "selectFirstRow", "shift END", "selectLastRowExtendSelection", "shift HOME", "selectFirstRowExtendSelection", "UP", "selectPreviousRow", "ctrl /", "selectAll", "ctrl A", "selectAll", "DOWN", "selectNextRow", "shift UP", "selectPreviousRowExtendSelection", "ctrl SPACE", "selectNextRowExtendSelection", "shift DOWN", "selectNextRowExtendSelection", "KP_UP", "selectPreviousRow", "shift PAGE_UP","scrollUpExtendSelection", "KP_DOWN", "selectNextRow" }), "List.foreground", new ColorUIResource(darkShadow), "List.selectionBackground", new ColorUIResource(Color.black), "List.selectionForeground", new ColorUIResource(Color.white), "List.focusCellHighlightBorder", new BorderUIResource. LineBorderUIResource(new ColorUIResource(Color.yellow)), "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "Menu.acceleratorForeground", new ColorUIResource(darkShadow), "Menu.acceleratorSelectionForeground", new ColorUIResource(Color.white), "Menu.arrowIcon", BasicIconFactory.getMenuArrowIcon(), "Menu.background", new ColorUIResource(light), "Menu.border", new BasicBorders.MarginBorder(), "Menu.borderPainted", Boolean.FALSE, "Menu.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "Menu.consumesTabs", Boolean.TRUE, "Menu.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Menu.foreground", new ColorUIResource(darkShadow), "Menu.margin", new InsetsUIResource(2, 2, 2, 2), "Menu.selectedWindowInputMapBindings", new Object[] { "ESCAPE", "cancel", "DOWN", "selectNext", "KP_DOWN", "selectNext", "UP", "selectPrevious", "KP_UP", "selectPrevious", "LEFT", "selectParent", "KP_LEFT", "selectParent", "RIGHT", "selectChild", "KP_RIGHT", "selectChild", "ENTER", "return", "SPACE", "return" }, "Menu.selectionBackground", new ColorUIResource(Color.black), "Menu.selectionForeground", new ColorUIResource(Color.white), "MenuBar.background", new ColorUIResource(light), "MenuBar.border", new BasicBorders.MenuBarBorder(null, null), "MenuBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuBar.foreground", new ColorUIResource(darkShadow), "MenuBar.highlight", new ColorUIResource(highLight), "MenuBar.shadow", new ColorUIResource(shadow), "MenuBar.windowBindings", new Object[] { "F10", "takeFocus" }, "MenuItem.acceleratorDelimiter", "-", "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuItem.acceleratorForeground", new ColorUIResource(darkShadow), "MenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "MenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "MenuItem.background", new ColorUIResource(light), "MenuItem.border", new BasicBorders.MarginBorder(), "MenuItem.borderPainted", Boolean.FALSE, "MenuItem.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "MenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "MenuItem.foreground", new ColorUIResource(darkShadow), "MenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "MenuItem.selectionBackground", new ColorUIResource(Color.black), "MenuItem.selectionForeground", new ColorUIResource(Color.white), "OptionPane.background", new ColorUIResource(light), "OptionPane.border", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.buttonAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.cancelButtonText", "Cancel", // XXX Don't use gif// "OptionPane.errorIcon",// new IconUIResource(new ImageIcon("icons/Error.gif")), "OptionPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "OptionPane.foreground", new ColorUIResource(darkShadow), // XXX Don't use gif// "OptionPane.informationIcon",// new IconUIResource(new ImageIcon("icons/Inform.gif")), "OptionPane.messageAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.messageForeground", new ColorUIResource(darkShadow), "OptionPane.minimumSize", new DimensionUIResource(262, 90), "OptionPane.noButtonText", "No", "OptionPane.okButtonText", "OK", // XXX Don't use gif// "OptionPane.questionIcon",// new IconUIResource(new ImageIcon("icons/Question.gif")), // XXX Don't use gif// "OptionPane.warningIcon",// new IconUIResource(new ImageIcon("icons/Warn.gif")), "OptionPane.windowBindings", new Object[] { "ESCAPE", "close" }, "OptionPane.yesButtonText", "Yes", "Panel.background", new ColorUIResource(light), "Panel.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Panel.foreground", new ColorUIResource(Color.black), "PasswordField.background", new ColorUIResource(light), "PasswordField.border", new BasicBorders.FieldBorder(null, null, null, null), "PasswordField.caretBlinkRate", new Integer(500), "PasswordField.caretForeground", new ColorUIResource(Color.black), "PasswordField.font", new FontUIResource("Dialog", Font.PLAIN, 12), "PasswordField.foreground", new ColorUIResource(Color.black), "PasswordField.inactiveBackground", new ColorUIResource(light), "PasswordField.inactiveForeground", new ColorUIResource(Color.gray), "PasswordField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept")}, "PasswordField.margin", new InsetsUIResource(0, 0, 0, 0), "PasswordField.selectionBackground", new ColorUIResource(Color.black), "PasswordField.selectionForeground", new ColorUIResource(Color.white), "PopupMenu.background", new ColorUIResource(light), "PopupMenu.border", new BorderUIResource.BevelBorderUIResource(0), "PopupMenu.font", new FontUIResource("Dialog", Font.PLAIN, 12), "PopupMenu.foreground", new ColorUIResource(darkShadow), "ProgressBar.background", new ColorUIResource(light), "ProgressBar.border", new BorderUIResource.LineBorderUIResource(Color.darkGray), "ProgressBar.cellLength", new Integer(1), "ProgressBar.cellSpacing", new Integer(0), "ProgressBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ProgressBar.foreground", new ColorUIResource(Color.black), "ProgressBar.selectionBackground", new ColorUIResource(Color.black), "ProgressBar.selectionForeground", new ColorUIResource(light), "ProgressBar.repaintInterval", new Integer(250), "ProgressBar.cycleTime", new Integer(6000), "RadioButton.background", new ColorUIResource(light), "RadioButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), "RadioButton.darkShadow", new ColorUIResource(shadow), "RadioButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "RadioButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButton.foreground", new ColorUIResource(darkShadow), "RadioButton.highlight", new ColorUIResource(highLight), "RadioButton.icon", new UIDefaults.LazyValue() { public Object createValue(UIDefaults def) { return BasicIconFactory.getRadioButtonIcon(); } }, "RadioButton.light", new ColorUIResource(highLight), "RadioButton.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButton.shadow", new ColorUIResource(shadow), "RadioButton.textIconGap", new Integer(4), "RadioButton.textShiftOffset", new Integer(0), "RadioButtonMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButtonMenuItem.acceleratorForeground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), "RadioButtonMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), "RadioButtonMenuItem.background", new ColorUIResource(light), "RadioButtonMenuItem.border", new BasicBorders.MarginBorder(), "RadioButtonMenuItem.borderPainted", Boolean.FALSE, "RadioButtonMenuItem.checkIcon", BasicIconFactory.getRadioButtonMenuItemIcon(), "RadioButtonMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), "RadioButtonMenuItem.foreground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), "RadioButtonMenuItem.selectionBackground", new ColorUIResource(Color.black), "RadioButtonMenuItem.selectionForeground", new ColorUIResource(Color.white), "RootPane.defaultButtonWindowKeyBindings", new Object[] { "ENTER", "press", "released ENTER", "release", "ctrl ENTER", "press", "ctrl released ENTER", "release" }, "ScrollBar.background", new ColorUIResource(224, 224, 224), "ScrollBar.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "negativeBlockIncrement", "PAGE_DOWN", "positiveBlockIncrement", "END", "maxScroll", "HOME", "minScroll", "LEFT", "positiveUnitIncrement", "KP_UP", "negativeUnitIncrement", "KP_DOWN", "positiveUnitIncrement", "UP", "negativeUnitIncrement", "RIGHT", "negativeUnitIncrement", "KP_LEFT", "positiveUnitIncrement", "DOWN", "positiveUnitIncrement", "KP_RIGHT", "negativeUnitIncrement" }), "ScrollBar.foreground", new ColorUIResource(light), "ScrollBar.maximumThumbSize", new DimensionUIResource(4096, 4096), "ScrollBar.minimumThumbSize", new DimensionUIResource(8, 8), "ScrollBar.thumb", new ColorUIResource(light), "ScrollBar.thumbDarkShadow", new ColorUIResource(shadow), "ScrollBar.thumbHighlight", new ColorUIResource(highLight), "ScrollBar.thumbShadow", new ColorUIResource(shadow), "ScrollBar.track", new ColorUIResource(light), "ScrollBar.trackHighlight", new ColorUIResource(shadow), "ScrollBar.width", new Integer(16), "ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "KP_LEFT", "unitScrollLeft", "ctrl PAGE_DOWN","scrollRight", "PAGE_DOWN", "scrollDown", "KP_RIGHT", "unitScrollRight", "LEFT", "unitScrollLeft", "ctrl END", "scrollEnd", "UP", "unitScrollUp", "RIGHT", "unitScrollRight", "DOWN", "unitScrollDown", "ctrl HOME", "scrollHome", "ctrl PAGE_UP", "scrollLeft", "KP_UP", "unitScrollUp", "KP_DOWN", "unitScrollDown" }), "ScrollPane.background", new ColorUIResource(light), "ScrollPane.border", new BorderUIResource.EtchedBorderUIResource(), "ScrollPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ScrollPane.foreground", new ColorUIResource(darkShadow), "Separator.background", new ColorUIResource(highLight), "Separator.foreground", new ColorUIResource(shadow), "Separator.highlight", new ColorUIResource(highLight), "Separator.shadow", new ColorUIResource(shadow), "Slider.background", new ColorUIResource(light), "Slider.focus", new ColorUIResource(shadow), "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "positiveBlockIncrement", "PAGE_DOWN", "negativeBlockIncrement", "END", "maxScroll", "HOME", "minScroll", "LEFT", "negativeUnitIncrement", "KP_UP", "positiveUnitIncrement", "KP_DOWN", "negativeUnitIncrement", "UP", "positiveUnitIncrement", "RIGHT", "positiveUnitIncrement", "KP_LEFT", "negativeUnitIncrement", "DOWN", "negativeUnitIncrement", "KP_RIGHT", "positiveUnitIncrement" }), "Slider.focusInsets", new InsetsUIResource(2, 2, 2, 2), "Slider.foreground", new ColorUIResource(light), "Slider.highlight", new ColorUIResource(highLight), "Slider.shadow", new ColorUIResource(shadow), "Slider.thumbHeight", new Integer(20), "Slider.thumbWidth", new Integer(11), "Slider.tickHeight", new Integer(12), "Spinner.background", new ColorUIResource(light), "Spinner.foreground", new ColorUIResource(light), "SplitPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "F6", "toggleFocus", "F8", "startResize", "END", "selectMax", "HOME", "selectMin", "LEFT", "negativeIncremnent", "KP_UP", "negativeIncrement", "KP_DOWN", "positiveIncrement", "UP", "negativeIncrement", "RIGHT", "positiveIncrement", "KP_LEFT", "negativeIncrement", "DOWN", "positiveIncrement", "KP_RIGHT", "positiveIncrement" }), "SplitPane.background", new ColorUIResource(light), "SplitPane.border", new BasicBorders.SplitPaneBorder(null, null), "SplitPane.darkShadow", new ColorUIResource(shadow), "SplitPane.dividerSize", new Integer(10), "SplitPane.highlight", new ColorUIResource(highLight), "SplitPane.shadow", new ColorUIResource(shadow), "TabbedPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ctrl PAGE_DOWN","navigatePageDown", "ctrl PAGE_UP", "navigatePageUp", "ctrl UP", "requestFocus", "ctrl KP_UP", "requestFocus" }), "TabbedPane.background", new ColorUIResource(light), "TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3), "TabbedPane.darkShadow", new ColorUIResource(shadow), "TabbedPane.focus", new ColorUIResource(darkShadow), "TabbedPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "LEFT", "navigateLeft", "KP_UP", "navigateUp", "ctrl DOWN", "requestFocusForVisibleComponent", "UP", "navigateUp", "KP_DOWN", "navigateDown", "RIGHT", "navigateRight", "KP_LEFT", "navigateLeft", "ctrl KP_DOWN", "requestFocusForVisibleComponent", "KP_RIGHT", "navigateRight", "DOWN", "navigateDown" }), "TabbedPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TabbedPane.foreground", new ColorUIResource(darkShadow), "TabbedPane.highlight", new ColorUIResource(highLight), "TabbedPane.light", new ColorUIResource(highLight), "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1), "TabbedPane.shadow", new ColorUIResource(shadow), "TabbedPane.tabbedPaneTabAreaInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabInsets", new InsetsUIResource(1, 4, 1, 4), "TabbedPane.tabbedPaneContentBorderInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabPadInsets", new InsetsUIResource(1, 1, 1, 1), "TabbedPane.tabRunOverlay", new Integer(2), "TabbedPane.textIconGap", new Integer(4), "Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "shift PAGE_DOWN","scrollDownExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "END", "selectLastColumn", "shift END", "selectLastColumnExtendSelection", "HOME", "selectFirstColumn", "ctrl END", "selectLastRow", "ctrl shift END","selectLastRowExtendSelection", "LEFT", "selectPreviousColumn", "shift HOME", "selectFirstColumnExtendSelection", "UP", "selectPreviousRow", "RIGHT", "selectNextColumn", "ctrl HOME", "selectFirstRow", "shift LEFT", "selectPreviousColumnExtendSelection", "DOWN", "selectNextRow", "ctrl shift HOME","selectFirstRowExtendSelection", "shift UP", "selectPreviousRowExtendSelection", "F2", "startEditing", "shift RIGHT", "selectNextColumnExtendSelection", "TAB", "selectNextColumnCell", "shift DOWN", "selectNextRowExtendSelection", "ENTER", "selectNextRowCell", "KP_UP", "selectPreviousRow", "KP_DOWN", "selectNextRow", "KP_LEFT", "selectPreviousColumn", "KP_RIGHT", "selectNextColumn", "shift TAB", "selectPreviousColumnCell", "ctrl A", "selectAll", "shift ENTER", "selectPreviousRowCell", "shift KP_DOWN", "selectNextRowExtendSelection", "shift KP_LEFT", "selectPreviousColumnExtendSelection", "ESCAPE", "cancel", "ctrl shift PAGE_UP", "scrollLeftExtendSelection", "shift KP_RIGHT", "selectNextColumnExtendSelection", "ctrl PAGE_UP", "scrollLeftChangeSelection", "shift PAGE_UP", "scrollUpExtendSelection", "ctrl shift PAGE_DOWN", "scrollRightExtendSelection", "ctrl PAGE_DOWN", "scrollRightChangeSelection", "PAGE_UP", "scrollUpChangeSelection", "ctrl shift LEFT", "selectPreviousColumnExtendSelection", "shift KP_UP", "selectPreviousRowExtendSelection", "ctrl shift UP", "selectPreviousRowExtendSelection", "ctrl shift RIGHT", "selectNextColumnExtendSelection", "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection", "ctrl shift DOWN", "selectNextRowExtendSelection", "ctrl BACK_SLASH", "clearSelection", "ctrl shift KP_UP", "selectPreviousRowExtendSelection", "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection", "ctrl SLASH", "selectAll", "ctrl shift KP_DOWN", "selectNextRowExtendSelection", }), "Table.background", new ColorUIResource(light), "Table.focusCellBackground", new ColorUIResource(light), "Table.focusCellForeground", new ColorUIResource(darkShadow), "Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource( new ColorUIResource(255, 255, 0)), "Table.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Table.foreground", new ColorUIResource(darkShadow), "Table.gridColor", new ColorUIResource(Color.gray), "Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0), "Table.selectionBackground", new ColorUIResource(Color.black), "Table.selectionForeground", new ColorUIResource(Color.white), "TableHeader.background", new ColorUIResource(light), "TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0), "TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TableHeader.foreground", new ColorUIResource(darkShadow), "TextArea.background", new ColorUIResource(light), "TextArea.border", new BasicBorders.MarginBorder(), "TextArea.caretBlinkRate", new Integer(500), "TextArea.caretForeground", new ColorUIResource(Color.black), "TextArea.font", new FontUIResource("Monospaced", Font.PLAIN, 12), "TextArea.foreground", new ColorUIResource(Color.black), "TextArea.inactiveForeground", new ColorUIResource(Color.gray), "TextArea.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "TextArea.margin", new InsetsUIResource(0, 0, 0, 0), "TextArea.selectionBackground", new ColorUIResource(Color.black), "TextArea.selectionForeground", new ColorUIResource(Color.white), "TextField.background", new ColorUIResource(light), "TextField.border", new BasicBorders.FieldBorder(null, null, null, null), "TextField.caretBlinkRate", new Integer(500), "TextField.caretForeground", new ColorUIResource(Color.black), "TextField.darkShadow", new ColorUIResource(shadow), "TextField.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "TextField.foreground", new ColorUIResource(Color.black), "TextField.highlight", new ColorUIResource(highLight), "TextField.inactiveBackground", new ColorUIResource(Color.LIGHT_GRAY), "TextField.inactiveForeground", new ColorUIResource(Color.GRAY), "TextField.light", new ColorUIResource(highLight), "TextField.highlight", new ColorUIResource(light), "TextField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_DOWN_MASK), "selection-backward"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_DOWN_MASK), "selection-forward"), }, "TextField.margin", new InsetsUIResource(0, 0, 0, 0), "TextField.selectionBackground", new ColorUIResource(Color.black), "TextField.selectionForeground", new ColorUIResource(Color.white), "TextPane.background", new ColorUIResource(Color.white), "TextPane.border", new BasicBorders.MarginBorder(), "TextPane.caretBlinkRate", new Integer(500), "TextPane.caretForeground", new ColorUIResource(Color.black), "TextPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "TextPane.foreground", new ColorUIResource(Color.black), "TextPane.inactiveForeground", new ColorUIResource(Color.gray), "TextPane.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "caret-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "caret-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "page-up"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "page-down"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "insert-break"), new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "insert-tab") }, "TextPane.margin", new InsetsUIResource(3, 3, 3, 3), "TextPane.selectionBackground", new ColorUIResource(Color.black), "TextPane.selectionForeground", new ColorUIResource(Color.white), "TitledBorder.border", new BorderUIResource.EtchedBorderUIResource(), "TitledBorder.font", new FontUIResource("Dialog", Font.PLAIN, 12), "TitledBorder.titleColor", new ColorUIResource(darkShadow), "ToggleButton.background", new ColorUIResource(light), "ToggleButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), "ToggleButton.darkShadow", new ColorUIResource(shadow), "ToggleButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "ToggleButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToggleButton.foreground", new ColorUIResource(darkShadow), "ToggleButton.highlight", new ColorUIResource(highLight), "ToggleButton.light", new ColorUIResource(light), "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), "ToggleButton.shadow", new ColorUIResource(shadow), "ToggleButton.textIconGap", new Integer(4), "ToggleButton.textShiftOffset", new Integer(0), "ToolBar.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "UP", "navigateUp", "KP_UP", "navigateUp", "DOWN", "navigateDown", "KP_DOWN", "navigateDown", "LEFT", "navigateLeft", "KP_LEFT", "navigateLeft", "RIGHT", "navigateRight", "KP_RIGHT", "navigateRight" }), "ToolBar.background", new ColorUIResource(light), "ToolBar.border", new BorderUIResource.EtchedBorderUIResource(), "ToolBar.darkShadow", new ColorUIResource(shadow), "ToolBar.dockingBackground", new ColorUIResource(light), "ToolBar.dockingForeground", new ColorUIResource(Color.red), "ToolBar.floatingBackground", new ColorUIResource(light), "ToolBar.floatingForeground", new ColorUIResource(Color.darkGray), "ToolBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), "ToolBar.foreground", new ColorUIResource(darkShadow), "ToolBar.highlight", new ColorUIResource(highLight), "ToolBar.light", new ColorUIResource(highLight), "ToolBar.separatorSize", new DimensionUIResource(20, 20), "ToolBar.shadow", new ColorUIResource(shadow), "ToolTip.background", new ColorUIResource(light), "ToolTip.border", new BorderUIResource.LineBorderUIResource(Color.lightGray), "ToolTip.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ToolTip.foreground", new ColorUIResource(darkShadow), "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancel" }), "Tree.background", new ColorUIResource(light), "Tree.changeSelectionWithFocus", Boolean.TRUE,// "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")),// "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")), "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE, "Tree.editorBorder", new BorderUIResource.LineBorderUIResource(Color.lightGray), "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "shift PAGE_DOWN", "scrollDownExtendSelection", "PAGE_DOWN", "scrollDownChangeSelection", "END", "selectLast", "ctrl KP_UP", "selectPreviousChangeLead", "shift END", "selectLastExtendSelection", "HOME", "selectFirst", "ctrl END", "selectLastChangeLead", "ctrl SLASH", "selectAll", "LEFT", "selectParent", "shift HOME", "selectFirstExtendSelection", "UP", "selectPrevious", "ctrl KP_DOWN", "selectNextChangeLead", "RIGHT", "selectChild", "ctrl HOME", "selectFirstChangeLead", "DOWN", "selectNext", "ctrl KP_LEFT", "scrollLeft", "shift UP", "selectPreviousExtendSelection", "F2", "startEditing", "ctrl LEFT", "scrollLeft", "ctrl KP_RIGHT","scrollRight", "ctrl UP", "selectPreviousChangeLead", "shift DOWN", "selectNextExtendSelection", "ENTER", "toggle", "KP_UP", "selectPrevious", "KP_DOWN", "selectNext", "ctrl RIGHT", "scrollRight", "KP_LEFT", "selectParent", "KP_RIGHT", "selectChild", "ctrl DOWN", "selectNextChangeLead", "ctrl A", "selectAll", "shift KP_UP", "selectPreviousExtendSelection", "shift KP_DOWN","selectNextExtendSelection", "ctrl SPACE", "toggleSelectionPreserveAnchor", "ctrl shift PAGE_UP", "scrollUpExtendSelection", "ctrl BACK_SLASH", "clearSelection", "shift SPACE", "extendSelection", "ctrl PAGE_UP", "scrollUpChangeLead", "shift PAGE_UP","scrollUpExtendSelection", "SPACE", "toggleSelectionPreserveAnchor", "ctrl shift PAGE_DOWN", "scrollDownExtendSelection", "PAGE_UP", "scrollUpChangeSelection", "ctrl PAGE_DOWN", "scrollDownChangeLead" }), "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)), "Tree.foreground", new ColorUIResource(Color.black), "Tree.hash", new ColorUIResource(new Color(128, 128, 128)), "Tree.leftChildIndent", new Integer(7), "Tree.rightChildIndent", new Integer(13), "Tree.rowHeight", new Integer(20), // FIXME "Tree.scrollsOnExpand", Boolean.TRUE, "Tree.selectionBackground", new ColorUIResource(Color.black), "Tree.nonSelectionBackground", new ColorUIResource(new Color(239, 235, 231)), "Tree.selectionBorderColor", new ColorUIResource(Color.black), "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(Color.black), "Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)), "Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)), "Tree.textForeground", new ColorUIResource(Color.black), "Viewport.background", new ColorUIResource(light), "Viewport.foreground", new ColorUIResource(Color.black), "Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12) }; defaults.putDefaults(uiDefaults); }
| 7,047
|
public BasicArrowButton(int direction) { super(); setBorder(buttonBorder); setDirection(direction); }
|
public BasicArrowButton(int direction) { super(); setDirection(direction); }
| 7,048
|
public static String extract(Any an_any) { if (an_any.type().equal(type())) { an_any.type(twString); return an_any.extract_wstring(); } else throw new BAD_OPERATION("Contains not a wide string value type"); }
|
public static String extract(Any an_any) { if (an_any.type().equal(type())) { an_any.type(twString); return an_any.extract_wstring(); } else { BAD_OPERATION bad = new BAD_OPERATION("WString value type expected"); bad.minor = Minor.Any; throw bad; } }
| 7,050
|
public void write_value(OutputStream ostream, Serializable a_string) { try { ostream.write_wstring((String) a_string); } catch (ClassCastException ex) { throw new MARSHAL("String expected"); } }
|
public void write_value(OutputStream ostream, Serializable a_string) { try { ostream.write_wstring((String) a_string); } catch (ClassCastException ex) { MARSHAL m = new MARSHAL("String expected"); m.minor = Minor.ClassCast; throw m; } }
| 7,051
|
public UnresolvedOffset(int offset, int patchSize) { if ((patchSize != 4) && (patchSize != 8)) { throw new IllegalArgumentException("PatchSize: " + patchSize); } this.offset = offset; this.patchSize = patchSize; }
|
public UnresolvedOffset(int offset, int patchSize) { if ((patchSize != 1) && (patchSize != 4) && (patchSize != 8)) { throw new IllegalArgumentException("PatchSize: " + patchSize); } this.offset = offset; this.patchSize = patchSize; }
| 7,052
|
protected void fireColumnMarginChanged() { EventListener [] listeners = getListeners(TableColumnModelListener.class); for (int i = 0; i < listeners.length; ++i) ((TableColumnModelListener) listeners[i]).columnMarginChanged(changeEvent); }
|
protected void fireColumnMarginChanged() { EventListener[] listeners = getListeners(TableColumnModelListener.class); if (changeEvent == null && listeners.length > 0) changeEvent = new ChangeEvent(this); for (int i = 0; i < listeners.length; ++i) ((TableColumnModelListener) listeners[i]).columnMarginChanged(changeEvent); }
| 7,053
|
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); String delimiter = (String) CurrentValueListParameter.get("delimiter"); String repeatable = (String) CurrentValueListParameter.get("repeatable"); // 2. reconsitute information stored in CurrentValueListParameter table String parentNodeName = (String) CurrentValueListParameter.get("parentNodeName"); // 3. split up string into values based on declared delimiter // and snag the string representation of the values ArrayList strValueList = splitStringIntoStringObjects(valueListString, delimiter, repeatable, null ); // 4. add these values to the lookup table, if the original valueList had an ID String valueListId = (String) CurrentValueListParameter.get("valueListId"); 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, strValueList); } // 5. If there is a reference object, clone it to get // the new valueList String valueListIdRef = (String) CurrentValueListParameter.get("valueListIdRef"); 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 ArrayList refValueListObj = (ArrayList) ValueListObj.get(valueListIdRef); strValueList = (ArrayList) refValueListObj.clone();// This is missing. Should allow override./* // override attrs with those in passed list // strValueList.setXMLAttributes(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; } } // 6. determine where these values go and then insert them // (hurm. could have reused code here. lazy. feh. if( parentNodeName.equals(XDFNodeName.AXIS) ) { // get the last axis List axisList = (List) CurrentArray.getAxes(); Axis lastAxisObject = (Axis) axisList.get(axisList.size()-1); // now create value objects, add them to groups Iterator iter = strValueList.iterator(); while (iter.hasNext()) { String valueString = (String) iter.next(); // add the value to the axis Value newvalue = new Value(valueString); lastAxisObject.addAxisValue(newvalue); // add this object to all open value groups Iterator groupIter = CurrentValueGroupList.iterator(); while (groupIter.hasNext()) { ValueGroup nextValueGroupObj = (ValueGroup) groupIter.next(); newvalue.addToGroup(nextValueGroupObj); } } } else if( parentNodeName.equals(XDFNodeName.PARAMETER) ) { // now create value objects, add them to groups Iterator iter = strValueList.iterator(); while (iter.hasNext()) { String valueString = (String) iter.next(); // add the value to the axis Value newvalue = new Value(valueString); LastParameterObject.addValue(newvalue); // add this object to all open value groups Iterator groupIter = CurrentValueGroupList.iterator(); while (groupIter.hasNext()) { ValueGroup nextValueGroupObj = (ValueGroup) groupIter.next(); newvalue.addToGroup(nextValueGroupObj); } } } else { Log.errorln("Error: weird parent node "+parentNodeName+" for "+XDFNodeName.VALUELIST+", aborting read."); System.exit(-1); } CurrentValueListParameter.put("isDelimitedCase", "true"); // notify that we did the list }
|
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); String delimiter = (String) CurrentValueListParameter.get("delimiter"); String repeatable = (String) CurrentValueListParameter.get("repeatable"); // 2. reconsitute information stored in CurrentValueListParameter table String parentNodeName = (String) CurrentValueListParameter.get("parentNodeName"); // 3. split up string into values based on declared delimiter // and snag the string representation of the values ArrayList strValueList = splitStringIntoStringObjects(valueListString, delimiter, repeatable, null ); // 4. add these values to the lookup table, if the original valueList had an ID String valueListId = (String) CurrentValueListParameter.get("valueListId"); 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, strValueList); } // 5. If there is a reference object, clone it to get // the new valueList String valueListIdRef = (String) CurrentValueListParameter.get("valueListIdRef"); 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 ArrayList refValueListObj = (ArrayList) ValueListObj.get(valueListIdRef); strValueList = (ArrayList) refValueListObj.clone();// This is missing. Should allow override./* // override attrs with those in passed list // strValueList.setXMLAttributes(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; } } // 6. determine where these values go and then insert them // (hurm. could have reused code here. lazy. feh. if( parentNodeName.equals(XDFNodeName.AXIS) ) { // get the last axis List axisList = (List) CurrentArray.getAxes(); Axis lastAxisObject = (Axis) axisList.get(axisList.size()-1); // now create value objects, add them to groups Iterator iter = strValueList.iterator(); while (iter.hasNext()) { String valueString = (String) iter.next(); // add the value to the axis Value newvalue = createCurrentValueListValueObj(valueString); lastAxisObject.addAxisValue(newvalue); // add this object to all open value groups Iterator groupIter = CurrentValueGroupList.iterator(); while (groupIter.hasNext()) { ValueGroup nextValueGroupObj = (ValueGroup) groupIter.next(); newvalue.addToGroup(nextValueGroupObj); } } } else if( parentNodeName.equals(XDFNodeName.PARAMETER) ) { // now create value objects, add them to groups Iterator iter = strValueList.iterator(); while (iter.hasNext()) { String valueString = (String) iter.next(); // add the value to the axis Value newvalue = createCurrentValueListValueObj(valueString); LastParameterObject.addValue(newvalue); // add this object to all open value groups Iterator groupIter = CurrentValueGroupList.iterator(); while (groupIter.hasNext()) { ValueGroup nextValueGroupObj = (ValueGroup) groupIter.next(); newvalue.addToGroup(nextValueGroupObj); } } } else { Log.errorln("Error: weird parent node "+parentNodeName+" for "+XDFNodeName.VALUELIST+", aborting read."); System.exit(-1); } CurrentValueListParameter.put("isDelimitedCase", "true"); // notify that we did the list }
| 7,055
|
public void action (SaxDocumentHandler handler) { // generate valuelist values from algoritm IF we need to // (e.g. values where'nt in a delimited cdata list) // check to see if we didnt alrealy parse from a delmited string. if ( ((String) CurrentValueListParameter.get("isDelimitedCase")).equals("true") ) return; // we already did the list, leave here // 1. grab parent node name String parentNodeName = (String) CurrentValueListParameter.get("parentNodeName"); // 2. Find the list of values. If there is a reference object, clone it to get // the new values list, otherwise, determine values from attributes // (e.g. algorithm method) ArrayList values = null; String valueListIdRef = (String) CurrentValueListParameter.get("valueListIdRef"); 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 ArrayList refValueListObj = (ArrayList) ValueListObj.get(valueListIdRef); values = (ArrayList) refValueListObj.clone(); } else { Log.warnln("Error: Reader got an valueList with ValueListIdRef=\""+valueListIdRef+"\" but no previous valueList has that id! Ignoring add valueList request."); return; } } else { values = getValueListNodeValues(); } // 4. add these values to the lookup table, if the original valueList had an ID String valueListId = (String) CurrentValueListParameter.get("valueListId"); 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, values); } // 5. Populate correct parent node w/ values if(values.size() > 0 ) { // needed safety? ArrayList valueObjList = new ArrayList(); if( parentNodeName.equals(XDFNodeName.AXIS) ) { // get the last axis List axisList = (List) CurrentArray.getAxes(); Axis lastAxisObject = (Axis) axisList.get(axisList.size()-1); Iterator iter = values.iterator(); while (iter.hasNext()) { String valuePCDATA = (String) iter.next(); Value value = new Value (valuePCDATA); if(lastAxisObject.addAxisValue(value)) valueObjList.add(value); } } else if ( parentNodeName.equals(XDFNodeName.VALUEGROUP) ) { if ( LastValueGroupParentObject instanceof Parameter ) { Parameter myParamObject = (Parameter) LastValueGroupParentObject; Iterator iter = values.iterator(); while (iter.hasNext()) { String valuePCDATA = (String) iter.next(); Value value = new Value (valuePCDATA); ((Parameter) LastValueGroupParentObject).addValue(value); valueObjList.add(value); } } else if ( LastValueGroupParentObject instanceof Axis ) { // get the last axis Axis myAxisObject = (Axis) LastValueGroupParentObject; Iterator iter = values.iterator(); while (iter.hasNext()) { String valuePCDATA = (String) iter.next(); Value value = new Value (valuePCDATA); if (myAxisObject.addAxisValue(value)) valueObjList.add(value); } } else { Log.warnln("Error: unknown valueGroupParent "+LastValueGroupParentObject+ " cant treat for "+XDFNodeName.VALUELIST); return; // bail } } else if ( parentNodeName.equals(XDFNodeName.PARAMETER) ) { Iterator iter = values.iterator(); while (iter.hasNext()) { String valuePCDATA = (String) iter.next(); Value value = new Value (valuePCDATA); LastParameterObject.addValue(value); valueObjList.add(value); } } else { Log.errorln("Error: weird parent node "+parentNodeName+" for "+XDFNodeName.VALUELIST); System.exit(-1); // fatal error, shut down } }// Need to do something wi/ ValueObjList HERE?? }
|
public void action (SaxDocumentHandler handler) { // generate valuelist values from algoritm IF we need to // (e.g. values where'nt in a delimited cdata list) // check to see if we didnt alrealy parse from a delmited string. if ( ((String) CurrentValueListParameter.get("isDelimitedCase")).equals("true") ) return; // we already did the list, leave here // 1. grab parent node name String parentNodeName = (String) CurrentValueListParameter.get("parentNodeName"); // 2. Find the list of values. If there is a reference object, clone it to get // the new values list, otherwise, determine values from attributes // (e.g. algorithm method) ArrayList values = null; String valueListIdRef = (String) CurrentValueListParameter.get("valueListIdRef"); 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 ArrayList refValueListObj = (ArrayList) ValueListObj.get(valueListIdRef); values = (ArrayList) refValueListObj.clone(); } else { Log.warnln("Error: Reader got an valueList with ValueListIdRef=\""+valueListIdRef+"\" but no previous valueList has that id! Ignoring add valueList request."); return; } } else { values = getValueListNodeValues(); } // 4. add these values to the lookup table, if the original valueList had an ID String valueListId = (String) CurrentValueListParameter.get("valueListId"); 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, values); } // 5. Populate correct parent node w/ values if(values.size() > 0 ) { // needed safety? ArrayList valueObjList = new ArrayList(); if( parentNodeName.equals(XDFNodeName.AXIS) ) { // get the last axis List axisList = (List) CurrentArray.getAxes(); Axis lastAxisObject = (Axis) axisList.get(axisList.size()-1); Iterator iter = values.iterator(); while (iter.hasNext()) { String valuePCDATA = (String) iter.next(); Value value = createCurrentValueListValueObj(valuePCDATA); if(lastAxisObject.addAxisValue(value)) valueObjList.add(value); } } else if ( parentNodeName.equals(XDFNodeName.VALUEGROUP) ) { if ( LastValueGroupParentObject instanceof Parameter ) { Parameter myParamObject = (Parameter) LastValueGroupParentObject; Iterator iter = values.iterator(); while (iter.hasNext()) { String valuePCDATA = (String) iter.next(); Value value = createCurrentValueListValueObj(valuePCDATA); ((Parameter) LastValueGroupParentObject).addValue(value); valueObjList.add(value); } } else if ( LastValueGroupParentObject instanceof Axis ) { // get the last axis Axis myAxisObject = (Axis) LastValueGroupParentObject; Iterator iter = values.iterator(); while (iter.hasNext()) { String valuePCDATA = (String) iter.next(); Value value = createCurrentValueListValueObj(valuePCDATA); if (myAxisObject.addAxisValue(value)) valueObjList.add(value); } } else { Log.warnln("Error: unknown valueGroupParent "+LastValueGroupParentObject+ " cant treat for "+XDFNodeName.VALUELIST); return; // bail } } else if ( parentNodeName.equals(XDFNodeName.PARAMETER) ) { Iterator iter = values.iterator(); while (iter.hasNext()) { String valuePCDATA = (String) iter.next(); Value value = createCurrentValueListValueObj(valuePCDATA); LastParameterObject.addValue(value); valueObjList.add(value); } } else { Log.errorln("Error: weird parent node "+parentNodeName+" for "+XDFNodeName.VALUELIST); System.exit(-1); // fatal error, shut down } }// Need to do something wi/ ValueObjList HERE?? }
| 7,056
|
protected void installDefaults() { // This is the border of InternalFrames in the BasicLookAndFeel. // Note that there exist entries for various border colors in // BasicLookAndFeel's defaults, but obviously they differ // from the colors that are actually used by the JDK. UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Color lineColor = new Color(238, 238, 238); Border inner = BorderFactory.createLineBorder(lineColor, 1); Color shadowInner = new Color(184, 207, 229); Color shadowOuter = new Color(122, 138, 153); Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Color.WHITE, shadowOuter, shadowInner); Border border = new BorderUIResource.CompoundBorderUIResource(outer, inner); frame.setBorder(border); // InternalFrames are invisible by default. frame.setVisible(false); }
|
protected void installDefaults() { // This is the border of InternalFrames in the BasicLookAndFeel. // Note that there exist entries for various border colors in // BasicLookAndFeel's defaults, but obviously they differ // from the colors that are actually used by the JDK. UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Color lineColor = new Color(238, 238, 238); Border inner = BorderFactory.createLineBorder(lineColor, 1); Color shadowInner = new Color(184, 207, 229); Color shadowOuter = new Color(122, 138, 153); Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Color.WHITE, shadowOuter, shadowInner); Border border = new BorderUIResource.CompoundBorderUIResource(outer, inner); frame.setBorder(border); // InternalFrames are invisible by default. frame.setVisible(false); }
| 7,057
|
protected void installDefaults() { // This is the border of InternalFrames in the BasicLookAndFeel. // Note that there exist entries for various border colors in // BasicLookAndFeel's defaults, but obviously they differ // from the colors that are actually used by the JDK. UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Color lineColor = new Color(238, 238, 238); Border inner = BorderFactory.createLineBorder(lineColor, 1); Color shadowInner = new Color(184, 207, 229); Color shadowOuter = new Color(122, 138, 153); Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Color.WHITE, shadowOuter, shadowInner); Border border = new BorderUIResource.CompoundBorderUIResource(outer, inner); frame.setBorder(border); // InternalFrames are invisible by default. frame.setVisible(false); }
|
protected void installDefaults() { // This is the border of InternalFrames in the BasicLookAndFeel. // Note that there exist entries for various border colors in // BasicLookAndFeel's defaults, but obviously they differ // from the colors that are actually used by the JDK. UIDefaults defaults = UIManager.getLookAndFeelDefaults(); Color lineColor = new Color(238, 238, 238); Border inner = BorderFactory.createLineBorder(lineColor, 1); Color shadowInner = new Color(184, 207, 229); Color shadowOuter = new Color(122, 138, 153); Border outer = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Color.WHITE, shadowOuter, shadowInner); Border border = new BorderUIResource.CompoundBorderUIResource(outer, inner); frame.setBorder(border); // InternalFrames are invisible by default. frame.setVisible(false); }
| 7,058
|
public void installUI(JComponent c) { if (c instanceof JInternalFrame) { frame = (JInternalFrame) c; internalFrameLayout = createLayoutManager(); frame.setLayout(internalFrameLayout); ((JComponent) frame.getRootPane().getGlassPane()).setOpaque(false); frame.getRootPane().getGlassPane().setVisible(true); installDefaults(); installListeners(); installComponents(); installKeyboardActions(); frame.setOpaque(true); titlePane.setOpaque(true); frame.invalidate(); } }
|
public void installUI(JComponent c) { if (c instanceof JInternalFrame) { frame = (JInternalFrame) c; internalFrameLayout = createLayoutManager(); frame.setLayout(internalFrameLayout); ((JComponent) frame.getRootPane().getGlassPane()).setOpaque(false); frame.getRootPane().getGlassPane().setVisible(true); installDefaults(); installListeners(); installComponents(); installKeyboardActions(); frame.setOpaque(true); frame.invalidate(); } }
| 7,060
|
public OctetSeqHolder(byte[] initial_value) { value = initial_value; typecode.setLength(value.length); }
|
public OctetSeqHolder() { value = initial_value; typecode.setLength(value.length); }
| 7,061
|
public OctetSeqHolder(byte[] initial_value) { value = initial_value; typecode.setLength(value.length); }
|
public OctetSeqHolder(byte[] initial_value) { value = initial_value; typecode.setLength(value.length); }
| 7,062
|
public void areaBounded(RubberBand band, int x1, int y1, int x2, int y2) { repaint(x1,y1,x2+1,y2+1);// System.out.println(" bound " + band.getEndPoint()); }
|
public void areaBounded(RubberBand band, int x1, int y1, int x2, int y2) { repaint();// System.out.println(" bound " + band.getEndPoint()); }
| 7,063
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
| 7,064
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
| 7,065
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
| 7,066
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
| 7,067
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
|
private void doKeyBoundArea(KeyEvent ke,String last) { Point p = new Point(); if (!rubberband.isAreaSelected()) { if (last.equals("[markleft]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()+1, p); if (last.equals("[markright]")) screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol()-1, p); if (last.equals("[markup]")) screen.getPointFromRowCol(screen.getCurrentRow()+1, screen.getCurrentCol(), p); if (last.equals("[markdown]")) screen.getPointFromRowCol(screen.getCurrentRow()-1, screen.getCurrentCol(), p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me); } screen.getPointFromRowCol(screen.getCurrentRow(), screen.getCurrentCol(), p); rubberband.getCanvas().translateEnd(p); MouseEvent me = new MouseEvent(this, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), MouseEvent.BUTTON1_MASK, p.x,p.y, 1,false); dispatchEvent(me);// Rectangle workR = new Rectangle();// rubberband.getBoundingArea(workR);// System.out.println(" area " + rubberband.getEndPoint() + " " + workR +// " from " ); }
| 7,068
|
DatagramSocketImpl getImpl() throws SocketException { try { if (! implCreated) { impl.create(); implCreated = true; } return impl; } catch (IOException e) { throw new SocketException(e.getMessage()); } }
|
DatagramSocketImpl getImpl() throws SocketException { try { if (! implCreated) { impl.create(); implCreated = true; } return impl; } catch (IOException e) { SocketException se = new SocketException(); se.initCause(e); throw se; } }
| 7,070
|
public Dimension getPreferredSize(JComponent c) { TableColumnModel cmod = header.getColumnModel(); TableCellRenderer defaultRend = header.getDefaultRenderer(); int ncols = cmod.getColumnCount(); Dimension ret = new Dimension(0,0); int spacing = 0; if (header.getTable() != null && header.getTable().getIntercellSpacing() != null) spacing = header.getTable().getIntercellSpacing().width; for (int i = 0; i < ncols; ++i) { TableColumn col = cmod.getColumn(i); TableCellRenderer rend = col.getHeaderRenderer(); if (rend == null) rend = defaultRend; Object val = col.getHeaderValue(); Component comp = rend.getTableCellRendererComponent(header.getTable(), val, false, // isSelected false, // isFocused -1, i); comp.setFont(header.getFont()); comp.setBackground(header.getBackground()); comp.setForeground(header.getForeground()); if (comp instanceof JComponent) ((JComponent)comp).setBorder(cellBorder); Dimension d = comp.getPreferredSize(); ret.width += spacing; ret.height = Math.max(d.height, ret.height); } ret.width = cmod.getTotalColumnWidth(); return ret; }
|
public Dimension getPreferredSize(JComponent ignored) { TableColumnModel cmod = header.getColumnModel(); TableCellRenderer defaultRend = header.getDefaultRenderer(); int ncols = cmod.getColumnCount(); Dimension ret = new Dimension(0,0); int spacing = 0; if (header.getTable() != null && header.getTable().getIntercellSpacing() != null) spacing = header.getTable().getIntercellSpacing().width; for (int i = 0; i < ncols; ++i) { TableColumn col = cmod.getColumn(i); TableCellRenderer rend = col.getHeaderRenderer(); if (rend == null) rend = defaultRend; Object val = col.getHeaderValue(); Component comp = rend.getTableCellRendererComponent(header.getTable(), val, false, // isSelected false, // isFocused -1, i); comp.setFont(header.getFont()); comp.setBackground(header.getBackground()); comp.setForeground(header.getForeground()); if (comp instanceof JComponent) ((JComponent)comp).setBorder(cellBorder); Dimension d = comp.getPreferredSize(); ret.width += spacing; ret.height = Math.max(d.height, ret.height); } ret.width = cmod.getTotalColumnWidth(); return ret; }
| 7,078
|
protected void dragTo(Point position, Point origin) { int loc = areaOfClick(origParent, SwingUtilities.convertPoint(toolBar, position, origParent)); if (loc != -1) { dragWindow.setBorderColor(dockingBorderColor); dragWindow.setBackground(dockingColor); } else { dragWindow.setBorderColor(floatingBorderColor); dragWindow.setBackground(floatingColor); } int w = 0; int h = 0; boolean tmp = ((loc == SwingConstants.NORTH) || (loc == SwingConstants.SOUTH) || (loc == -1)); cachedOrientation = toolBar.getOrientation(); cachedBounds = toolBar.getSize(); if (((cachedOrientation == SwingConstants.HORIZONTAL) && tmp) || ((cachedOrientation == VERTICAL) && ! tmp)) { w = cachedBounds.width; h = cachedBounds.height; } else { w = cachedBounds.height; h = cachedBounds.width; } Point p = dragWindow.getOffset(); Insets insets = toolBar.getInsets(); dragWindow.setBounds((origin.x + position.x) - p.x - ((insets.left + insets.right) / 2), (origin.y + position.y) - p.y - ((insets.top + insets.bottom) / 2), w, h); if (! dragWindow.isVisible()) dragWindow.show(); }
|
protected void dragTo(Point position, Point origin) { int loc = areaOfClick(origParent, SwingUtilities.convertPoint(toolBar, position, origParent)); if (loc != -1) { dragWindow.setBorderColor(dockingBorderColor); dragWindow.setBackground(dockingColor); } else { dragWindow.setBorderColor(floatingBorderColor); dragWindow.setBackground(floatingColor); } int w = 0; int h = 0; boolean tmp = ((loc == SwingConstants.NORTH) || (loc == SwingConstants.SOUTH) || (loc == -1)); cachedOrientation = toolBar.getOrientation(); cachedBounds = toolBar.getSize(); if (((cachedOrientation == SwingConstants.HORIZONTAL) && tmp) || ((cachedOrientation == VERTICAL) && ! tmp)) { w = cachedBounds.width; h = cachedBounds.height; } else { w = cachedBounds.height; h = cachedBounds.width; } Point p = dragWindow.getOffset(); Insets insets = toolBar.getInsets(); dragWindow.setBounds((origin.x + position.x) - p.x - ((insets.left + insets.right) / 2), (origin.y + position.y) - p.y - ((insets.top + insets.bottom) / 2), w, h); if (! dragWindow.isVisible()) dragWindow.show(); }
| 7,086
|
protected void installListeners() { dockingListener = createDockingListener(); toolBar.addMouseListener(dockingListener); toolBar.addMouseMotionListener(dockingListener); propertyListener = createPropertyListener(); toolBar.addPropertyChangeListener(propertyListener); toolBarContListener = createToolBarContListener(); toolBar.addContainerListener(toolBarContListener); windowListener = createFrameListener(); floatFrame.addWindowListener(windowListener); toolBarFocusListener = createToolBarFocusListener(); toolBar.addFocusListener(toolBarFocusListener); }
|
protected void installListeners() { dockingListener = createDockingListener(); toolBar.addMouseListener(dockingListener); toolBar.addMouseMotionListener(dockingListener); propertyListener = createPropertyListener(); toolBar.addPropertyChangeListener(propertyListener); toolBarContListener = createToolBarContListener(); toolBar.addContainerListener(toolBarContListener); windowListener = createFrameListener(); floatFrame.addWindowListener(windowListener); toolBarFocusListener = createToolBarFocusListener(); if (toolBarFocusListener != null) { int count = toolBar.getComponentCount(); for (int i = 0; i < count; i++) toolBar.getComponent(i).addFocusListener(toolBarFocusListener); } }
| 7,088
|
protected void navigateFocusedComp(int direction) throws NotImplementedException { // FIXME: Implement. }
|
protected void navigateFocusedComp(int direction) { // FIXME: Implement. }
| 7,089
|
protected void uninstallListeners() { toolBar.removeFocusListener(toolBarFocusListener); toolBarFocusListener = null; floatFrame.removeWindowListener(windowListener); windowListener = null; toolBar.removeContainerListener(toolBarContListener); toolBarContListener = null; toolBar.removeMouseMotionListener(dockingListener); toolBar.removeMouseListener(dockingListener); dockingListener = null; }
|
protected void uninstallListeners() { if (toolBarFocusListener != null) { int count = toolBar.getComponentCount(); for (int i = 0; i < count; i++) toolBar.getComponent(i).removeFocusListener(toolBarFocusListener); toolBarFocusListener = null; floatFrame.removeWindowListener(windowListener); windowListener = null; toolBar.removeContainerListener(toolBarContListener); toolBarContListener = null; toolBar.removeMouseMotionListener(dockingListener); toolBar.removeMouseListener(dockingListener); dockingListener = null; }
| 7,092
|
protected void check(int kind) throws BAD_OPERATION { if (has == null) throw new BAD_OPERATION("value not set"); if (xKind >= 0) { if (xKind != kind) if (!( xKind == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " when stored " + typeNamer.nameIt(xKind) ); } else { if (type().kind().value() != kind) if (!( type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " stored " + typeNamer.nameIt(type()) ); } }
|
protected void check(int kind) throws BAD_OPERATION { if (has == null) { BAD_OPERATION bad = new BAD_OPERATION("value not set"); bad.minor = Minor.Any; throw bad; } if (xKind >= 0) { if (xKind != kind) if (!( xKind == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " when stored " + typeNamer.nameIt(xKind) ); } else { if (type().kind().value() != kind) if (!( type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " stored " + typeNamer.nameIt(type()) ); } }
| 7,094
|
protected void check(int kind) throws BAD_OPERATION { if (has == null) throw new BAD_OPERATION("value not set"); if (xKind >= 0) { if (xKind != kind) if (!( xKind == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " when stored " + typeNamer.nameIt(xKind) ); } else { if (type().kind().value() != kind) if (!( type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " stored " + typeNamer.nameIt(type()) ); } }
|
protected void check(int kind) throws BAD_OPERATION { if (has == null) throw new BAD_OPERATION("value not set"); if (xKind >= 0) { if (xKind != kind) if (!( xKind == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " when stored " + typeNamer.nameIt(xKind) ); } else { if (type().kind().value() != kind) if (!( type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " stored " + typeNamer.nameIt(type()) ); } }
| 7,095
|
protected void check(int kind) throws BAD_OPERATION { if (has == null) throw new BAD_OPERATION("value not set"); if (xKind >= 0) { if (xKind != kind) if (!( xKind == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " when stored " + typeNamer.nameIt(xKind) ); } else { if (type().kind().value() != kind) if (!( type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " stored " + typeNamer.nameIt(type()) ); } }
|
protected void check(int kind) throws BAD_OPERATION { if (has == null) throw new BAD_OPERATION("value not set"); if (xKind >= 0) { if (xKind != kind) if (!( xKind == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " when stored " + typeNamer.nameIt(xKind) ); } else { if (type().kind().value() != kind) if (!( type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind ) ) throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) + " stored " + typeNamer.nameIt(type()) ); } }
| 7,096
|
public org.omg.CORBA.Object extract_Object() { try { return ((ObjectHolder) has).value; } catch (ClassCastException ex) { throw new BAD_OPERATION(); } }
|
public org.omg.CORBA.Object extract_Object() { try { return ((ObjectHolder) has).value; } catch (ClassCastException ex) { BAD_OPERATION bad = new BAD_OPERATION(); bad.initCause(ex); bad.minor = Minor.Any; throw bad; } }
| 7,097
|
public Serializable extract_Value() throws BAD_OPERATION { try { if (has instanceof ValueBaseHolder) return ((ValueBaseHolder) has).value; else { // Normally, ValueBase holder must be an instance of the // ValueBaseHolder. However some IDL compilers probably // have a bug, do not deriving this way. The the only // way to access the wrapped value is via reflection. Field f = has.getClass().getField("value"); return (Serializable) f.get(has); } } catch (Exception ex) { return new BAD_OPERATION("Value type expected"); } }
|
public Serializable extract_Value() throws BAD_OPERATION { try { if (has instanceof ValueBaseHolder) return ((ValueBaseHolder) has).value; else { // Normally, ValueBase holder must be an instance of the // ValueBaseHolder. However some IDL compilers probably // have a bug, do not deriving this way. The the only // way to access the wrapped value is via reflection. Field f = has.getClass().getField("value"); return (Serializable) f.get(has); } } catch (Exception ex) { BAD_OPERATION bad = new BAD_OPERATION("Value type expected"); bad.minor = Minor.Any; bad.initCause(ex); throw bad; } }
| 7,098
|
public void read_value(org.omg.CORBA.portable.InputStream input, TypeCode a_type ) throws MARSHAL { try { int kind = a_type.kind().value(); // Fixed needs special handling. if (kind == TCKind._tk_fixed) { BigDecimal dec = BigDecimalHelper.read(input, a_type.fixed_scale()); has = new FixedHolder(dec); } else { has = holderFactory.createHolder(a_type); if (has == null) { // Use the Universal Holder that reads till the end of stream. // This works with the extract/insert pair of the typical // Helper. cdrBufOutput buffer = new cdrBufOutput(); buffer.setOrb(orb); has = new universalHolder(buffer); } } type(a_type); if (!(has instanceof universalHolder) && (kind == TCKind._tk_value_box)) { // The streamable only contains operations for // reading the value, not the value header. Field vField = has.getClass().getField("value"); BoxedValueHelper helper; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(a_type.id())); helper = (BoxedValueHelper) helperClass.newInstance(); } catch (Exception ex) { helper = null; } Object content = Vio.read(input, helper); vField.set(has, content); } else has._read(input); } catch (Exception ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } }
|
public void read_value(org.omg.CORBA.portable.InputStream input, TypeCode a_type ) throws MARSHAL { try { int kind = a_type.kind().value(); // Fixed needs special handling. if (kind == TCKind._tk_fixed) { BigDecimal dec = BigDecimalHelper.read(input, a_type.fixed_scale()); has = new FixedHolder(dec); } else { has = holderFactory.createHolder(a_type); if (has == null) { // Use the Universal Holder that reads till the end of stream. // This works with the extract/insert pair of the typical // Helper. cdrBufOutput buffer = new cdrBufOutput(); buffer.setOrb(orb); has = new universalHolder(buffer); } } type(a_type); if (!(has instanceof universalHolder) && (kind == TCKind._tk_value_box)) { // The streamable only contains operations for // reading the value, not the value header. Field vField = has.getClass().getField("value"); BoxedValueHelper helper; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(a_type.id())); helper = (BoxedValueHelper) helperClass.newInstance(); } catch (Exception ex) { helper = null; } Object content = Vio.read(input, helper); vField.set(has, content); } else has._read(input); } catch (Exception ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } }
| 7,099
|
public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t) { if (p0 == p1) return; Rectangle rect = bounds.getBounds(); if (color == null) g.setColor(t.getSelectionColor()); else g.setColor(color); TextUI ui = t.getUI(); try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. if (l0.y == l1.y) { SwingUtilities.computeUnion(l0.x, l0.y, l0.width, l0.height, l1); // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, l1); paintHighlight(g, l1); } else { // 1. The line of p0 is painted from the position of p0 // to the right border. // 2. All lines between the ones where p0 and p1 lie on // are completely highlighted. The allocation area is used to find // out the bounds. // 3. The final line is painted from the left border to the // position of p1. // Highlight first line until the end. // If rect.x is non-zero the calculation will properly adjust the // area to be painted. l0.x -= rect.x; l0.width = rect.width - l0.x - rect.x; paintHighlight(g, l0); int posBelow = Utilities.getPositionBelow(t, p0, l0.x); int p1RowStart = Utilities.getRowStart(t, p1); if (posBelow != -1 && posBelow != p0 && Utilities.getRowStart(t, posBelow) != p1RowStart) { Rectangle grow = ui.modelToView(t, posBelow); grow.x = rect.x; grow.width = rect.width; // Find further lines which have to be highlighted completely. int nextPosBelow = posBelow; while (nextPosBelow != -1 && Utilities.getRowStart(t, nextPosBelow) != p1RowStart) { posBelow = nextPosBelow; nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x); if (nextPosBelow == posBelow) break; } // Now posBelow is an offset on the last line which has to be painted // completely. (newPosBelow is on the same line as p1) // Retrieve the rectangle of posBelow and use its y and height // value to calculate the final height of the multiple line // spanning rectangle. Rectangle end = ui.modelToView(t, posBelow); grow.height = end.y + end.height - grow.y; paintHighlight(g, grow); } // Paint last line from its beginning to the position of p1. l1.width = l1.x + l1.width - rect.x; l1.x = rect.x; paintHighlight(g, l1); } } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location exception"); err.initCause(ex); throw err; } }
|
public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t) { if (p0 == p1) return; Rectangle rect = bounds.getBounds(); if (color == null) g.setColor(t.getSelectionColor()); else g.setColor(color); TextUI ui = t.getUI(); try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. if (l0.y == l1.y) { SwingUtilities.computeUnion(l0.x, l0.y, l0.width, l0.height, l1); // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, l1); paintHighlight(g, l1); } else { // 1. The line of p0 is painted from the position of p0 // to the right border. // 2. All lines between the ones where p0 and p1 lie on // are completely highlighted. The allocation area is used to find // out the bounds. // 3. The final line is painted from the left border to the // position of p1. // Highlight first line until the end. // If rect.x is non-zero the calculation will properly adjust the // area to be painted. l0.x -= rect.x; l0.width = rect.width - l0.x - rect.x; paintHighlight(g, l0); int posBelow = Utilities.getPositionBelow(t, p0, l0.x); int p1RowStart = Utilities.getRowStart(t, p1); if (posBelow != -1 && posBelow != p0 && Utilities.getRowStart(t, posBelow) != p1RowStart) { Rectangle grow = ui.modelToView(t, posBelow); grow.x = rect.x; grow.width = rect.width; // Find further lines which have to be highlighted completely. int nextPosBelow = posBelow; while (nextPosBelow != -1 && Utilities.getRowStart(t, nextPosBelow) != p1RowStart) { posBelow = nextPosBelow; nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x); if (nextPosBelow == posBelow) break; } // Now posBelow is an offset on the last line which has to be painted // completely. (newPosBelow is on the same line as p1) // Retrieve the rectangle of posBelow and use its y and height // value to calculate the final height of the multiple line // spanning rectangle. Rectangle end = ui.modelToView(t, posBelow); grow.height = end.y + end.height - grow.y; paintHighlight(g, grow); } // Paint last line from its beginning to the position of p1. l1.width = l1.x + l1.width - rect.x; l1.x = rect.x; paintHighlight(g, l1); } } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location exception"); err.initCause(ex); throw err; } }
| 7,101
|
public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t) { if (p0 == p1) return; Rectangle rect = bounds.getBounds(); if (color == null) g.setColor(t.getSelectionColor()); else g.setColor(color); TextUI ui = t.getUI(); try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. if (l0.y == l1.y) { SwingUtilities.computeUnion(l0.x, l0.y, l0.width, l0.height, l1); // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, l1); paintHighlight(g, l1); } else { // 1. The line of p0 is painted from the position of p0 // to the right border. // 2. All lines between the ones where p0 and p1 lie on // are completely highlighted. The allocation area is used to find // out the bounds. // 3. The final line is painted from the left border to the // position of p1. // Highlight first line until the end. // If rect.x is non-zero the calculation will properly adjust the // area to be painted. l0.x -= rect.x; l0.width = rect.width - l0.x - rect.x; paintHighlight(g, l0); int posBelow = Utilities.getPositionBelow(t, p0, l0.x); int p1RowStart = Utilities.getRowStart(t, p1); if (posBelow != -1 && posBelow != p0 && Utilities.getRowStart(t, posBelow) != p1RowStart) { Rectangle grow = ui.modelToView(t, posBelow); grow.x = rect.x; grow.width = rect.width; // Find further lines which have to be highlighted completely. int nextPosBelow = posBelow; while (nextPosBelow != -1 && Utilities.getRowStart(t, nextPosBelow) != p1RowStart) { posBelow = nextPosBelow; nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x); if (nextPosBelow == posBelow) break; } // Now posBelow is an offset on the last line which has to be painted // completely. (newPosBelow is on the same line as p1) // Retrieve the rectangle of posBelow and use its y and height // value to calculate the final height of the multiple line // spanning rectangle. Rectangle end = ui.modelToView(t, posBelow); grow.height = end.y + end.height - grow.y; paintHighlight(g, grow); } // Paint last line from its beginning to the position of p1. l1.width = l1.x + l1.width - rect.x; l1.x = rect.x; paintHighlight(g, l1); } } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location exception"); err.initCause(ex); throw err; } }
|
public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t) { if (p0 == p1) return; Rectangle rect = bounds.getBounds(); if (color == null) g.setColor(t.getSelectionColor()); else g.setColor(color); TextUI ui = t.getUI(); try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. if (l0.y == l1.y) { SwingUtilities.computeUnion(l0.x, l0.y, l0.width, l0.height, l1); // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, l1); g.fillRect(l1.x, l1.y, l1.width, l1.height); } else { // 1. The line of p0 is painted from the position of p0 // to the right border. // 2. All lines between the ones where p0 and p1 lie on // are completely highlighted. The allocation area is used to find // out the bounds. // 3. The final line is painted from the left border to the // position of p1. // Highlight first line until the end. // If rect.x is non-zero the calculation will properly adjust the // area to be painted. l0.x -= rect.x; l0.width = rect.width - l0.x - rect.x; paintHighlight(g, l0); int posBelow = Utilities.getPositionBelow(t, p0, l0.x); int p1RowStart = Utilities.getRowStart(t, p1); if (posBelow != -1 && posBelow != p0 && Utilities.getRowStart(t, posBelow) != p1RowStart) { Rectangle grow = ui.modelToView(t, posBelow); grow.x = rect.x; grow.width = rect.width; // Find further lines which have to be highlighted completely. int nextPosBelow = posBelow; while (nextPosBelow != -1 && Utilities.getRowStart(t, nextPosBelow) != p1RowStart) { posBelow = nextPosBelow; nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x); if (nextPosBelow == posBelow) break; } // Now posBelow is an offset on the last line which has to be painted // completely. (newPosBelow is on the same line as p1) // Retrieve the rectangle of posBelow and use its y and height // value to calculate the final height of the multiple line // spanning rectangle. Rectangle end = ui.modelToView(t, posBelow); grow.height = end.y + end.height - grow.y; paintHighlight(g, grow); } // Paint last line from its beginning to the position of p1. l1.width = l1.x + l1.width - rect.x; l1.x = rect.x; g.fillRect(l1.x, l1.y, l1.width, l1.height); } } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location exception"); err.initCause(ex); throw err; } }
| 7,102
|
public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t) { if (p0 == p1) return; Rectangle rect = bounds.getBounds(); if (color == null) g.setColor(t.getSelectionColor()); else g.setColor(color); TextUI ui = t.getUI(); try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. if (l0.y == l1.y) { SwingUtilities.computeUnion(l0.x, l0.y, l0.width, l0.height, l1); // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, l1); paintHighlight(g, l1); } else { // 1. The line of p0 is painted from the position of p0 // to the right border. // 2. All lines between the ones where p0 and p1 lie on // are completely highlighted. The allocation area is used to find // out the bounds. // 3. The final line is painted from the left border to the // position of p1. // Highlight first line until the end. // If rect.x is non-zero the calculation will properly adjust the // area to be painted. l0.x -= rect.x; l0.width = rect.width - l0.x - rect.x; paintHighlight(g, l0); int posBelow = Utilities.getPositionBelow(t, p0, l0.x); int p1RowStart = Utilities.getRowStart(t, p1); if (posBelow != -1 && posBelow != p0 && Utilities.getRowStart(t, posBelow) != p1RowStart) { Rectangle grow = ui.modelToView(t, posBelow); grow.x = rect.x; grow.width = rect.width; // Find further lines which have to be highlighted completely. int nextPosBelow = posBelow; while (nextPosBelow != -1 && Utilities.getRowStart(t, nextPosBelow) != p1RowStart) { posBelow = nextPosBelow; nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x); if (nextPosBelow == posBelow) break; } // Now posBelow is an offset on the last line which has to be painted // completely. (newPosBelow is on the same line as p1) // Retrieve the rectangle of posBelow and use its y and height // value to calculate the final height of the multiple line // spanning rectangle. Rectangle end = ui.modelToView(t, posBelow); grow.height = end.y + end.height - grow.y; paintHighlight(g, grow); } // Paint last line from its beginning to the position of p1. l1.width = l1.x + l1.width - rect.x; l1.x = rect.x; paintHighlight(g, l1); } } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location exception"); err.initCause(ex); throw err; } }
|
public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t) { if (p0 == p1) return; Rectangle rect = bounds.getBounds(); if (color == null) g.setColor(t.getSelectionColor()); else g.setColor(color); TextUI ui = t.getUI(); try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. if (l0.y == l1.y) { SwingUtilities.computeUnion(l0.x, l0.y, l0.width, l0.height, l1); // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, l1); paintHighlight(g, l1); } else { // 1. The line of p0 is painted from the position of p0 // to the right border. // 2. All lines between the ones where p0 and p1 lie on // are completely highlighted. The allocation area is used to find // out the bounds. // 3. The final line is painted from the left border to the // position of p1. // Highlight first line until the end. // If rect.x is non-zero the calculation will properly adjust the // area to be painted. l0.x -= rect.x; l0.width = rect.width - l0.x - rect.x; paintHighlight(g, l0); int posBelow = Utilities.getPositionBelow(t, p0, l0.x); int p1RowStart = Utilities.getRowStart(t, p1); if (posBelow != -1 && posBelow != p0 && Utilities.getRowStart(t, posBelow) != p1RowStart) { Rectangle grow = ui.modelToView(t, posBelow); grow.x = rect.x; grow.width = rect.width; // Find further lines which have to be highlighted completely. int nextPosBelow = posBelow; while (nextPosBelow != -1 && Utilities.getRowStart(t, nextPosBelow) != p1RowStart) { posBelow = nextPosBelow; nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x); if (nextPosBelow == posBelow) break; } // Now posBelow is an offset on the last line which has to be painted // completely. (newPosBelow is on the same line as p1) // Retrieve the rectangle of posBelow and use its y and height // value to calculate the final height of the multiple line // spanning rectangle. Rectangle end = ui.modelToView(t, posBelow); grow.height = end.y + end.height - grow.y; paintHighlight(g, grow); } // Paint last line from its beginning to the position of p1. l1.width = l1.x + l1.width - rect.x; l1.x = rect.x; paintHighlight(g, l1); } } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location exception"); err.initCause(ex); throw err; } }
| 7,103
|
public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t) { if (p0 == p1) return; Rectangle rect = bounds.getBounds(); if (color == null) g.setColor(t.getSelectionColor()); else g.setColor(color); TextUI ui = t.getUI(); try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. if (l0.y == l1.y) { SwingUtilities.computeUnion(l0.x, l0.y, l0.width, l0.height, l1); // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, l1); paintHighlight(g, l1); } else { // 1. The line of p0 is painted from the position of p0 // to the right border. // 2. All lines between the ones where p0 and p1 lie on // are completely highlighted. The allocation area is used to find // out the bounds. // 3. The final line is painted from the left border to the // position of p1. // Highlight first line until the end. // If rect.x is non-zero the calculation will properly adjust the // area to be painted. l0.x -= rect.x; l0.width = rect.width - l0.x - rect.x; paintHighlight(g, l0); int posBelow = Utilities.getPositionBelow(t, p0, l0.x); int p1RowStart = Utilities.getRowStart(t, p1); if (posBelow != -1 && posBelow != p0 && Utilities.getRowStart(t, posBelow) != p1RowStart) { Rectangle grow = ui.modelToView(t, posBelow); grow.x = rect.x; grow.width = rect.width; // Find further lines which have to be highlighted completely. int nextPosBelow = posBelow; while (nextPosBelow != -1 && Utilities.getRowStart(t, nextPosBelow) != p1RowStart) { posBelow = nextPosBelow; nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x); if (nextPosBelow == posBelow) break; } // Now posBelow is an offset on the last line which has to be painted // completely. (newPosBelow is on the same line as p1) // Retrieve the rectangle of posBelow and use its y and height // value to calculate the final height of the multiple line // spanning rectangle. Rectangle end = ui.modelToView(t, posBelow); grow.height = end.y + end.height - grow.y; paintHighlight(g, grow); } // Paint last line from its beginning to the position of p1. l1.width = l1.x + l1.width - rect.x; l1.x = rect.x; paintHighlight(g, l1); } } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location exception"); err.initCause(ex); throw err; } }
|
public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t) { if (p0 == p1) return; Rectangle rect = bounds.getBounds(); if (color == null) g.setColor(t.getSelectionColor()); else g.setColor(color); TextUI ui = t.getUI(); try { Rectangle l0 = ui.modelToView(t, p0, null); Rectangle l1 = ui.modelToView(t, p1, null); // Note: The computed locations may lie outside of the allocation // area if the text is scrolled. if (l0.y == l1.y) { SwingUtilities.computeUnion(l0.x, l0.y, l0.width, l0.height, l1); // Paint only inside the allocation area. SwingUtilities.computeIntersection(rect.x, rect.y, rect.width, rect.height, l1); paintHighlight(g, l1); } else { // 1. The line of p0 is painted from the position of p0 // to the right border. // 2. All lines between the ones where p0 and p1 lie on // are completely highlighted. The allocation area is used to find // out the bounds. // 3. The final line is painted from the left border to the // position of p1. // Highlight first line until the end. // If rect.x is non-zero the calculation will properly adjust the // area to be painted. l0.x -= rect.x; l0.width = rect.width - l0.x - rect.x; paintHighlight(g, l0); int posBelow = Utilities.getPositionBelow(t, p0, l0.x); int p1RowStart = Utilities.getRowStart(t, p1); if (posBelow != -1 && posBelow != p0 && Utilities.getRowStart(t, posBelow) != p1RowStart) { Rectangle grow = ui.modelToView(t, posBelow); grow.x = rect.x; grow.width = rect.width; // Find further lines which have to be highlighted completely. int nextPosBelow = posBelow; while (nextPosBelow != -1 && Utilities.getRowStart(t, nextPosBelow) != p1RowStart) { posBelow = nextPosBelow; nextPosBelow = Utilities.getPositionBelow(t, posBelow, l0.x); if (nextPosBelow == posBelow) break; } // Now posBelow is an offset on the last line which has to be painted // completely. (newPosBelow is on the same line as p1) // Retrieve the rectangle of posBelow and use its y and height // value to calculate the final height of the multiple line // spanning rectangle. Rectangle end = ui.modelToView(t, posBelow); grow.height = end.y + end.height - grow.y; paintHighlight(g, grow); } // Paint last line from its beginning to the position of p1. l1.width = l1.x + l1.width - rect.x; l1.x = rect.x; paintHighlight(g, l1); } } catch (BadLocationException ex) { AssertionError err = new AssertionError("Unexpected bad location exception"); err.initCause(ex); throw err; } }
| 7,104
|
public Shape paintLayer(Graphics g, int p0, int p1, Shape bounds, JTextComponent c, View view) { throw new InternalError(); }
|
public Shape paintLayer(Graphics g, int p0, int p1, Shape bounds, JTextComponent c, View view) { Color col = getColor(); if (col == null) col = c.getSelectionColor(); g.setColor(col); Rectangle rect = null; if (p0 == view.getStartOffset() && p1 == view.getEndOffset()) { rect = bounds instanceof Rectangle ? (Rectangle) bounds : bounds.getBounds(); } else { try { Shape s = view.modelToView(p0, Position.Bias.Forward, p1, Position.Bias.Backward, bounds); rect = s instanceof Rectangle ? (Rectangle) s : s.getBounds(); } catch (BadLocationException ex) { } } if (rect != null) { g.fillRect(rect.x, rect.y, rect.width, rect.height); } return rect; }
| 7,105
|
public HighlightEntry(int p0, int p1, Highlighter.HighlightPainter painter) { this.p0 = p0; this.p1 = p1; this.painter = painter; }
|
public HighlightEntry(Position p0, Position p1, Highlighter.HighlightPainter painter) { this.p0 = p0; this.p1 = p1; this.painter = painter; }
| 7,106
|
public int getEndOffset() { return p1; }
|
public int getEndOffset() { return p1.getOffset(); }
| 7,107
|
public int getStartOffset() { return p0; }
|
public int getStartOffset() { return p0.getOffset(); }
| 7,108
|
public Object addHighlight(int p0, int p1, Highlighter.HighlightPainter painter) throws BadLocationException { checkPositions(p0, p1); HighlightEntry entry = new HighlightEntry(p0, p1, painter); highlights.add(entry); textComponent.getUI().damageRange(textComponent, p0, p1); return entry; }
|
public Object addHighlight(int p0, int p1, Highlighter.HighlightPainter painter) throws BadLocationException { checkPositions(p0, p1); HighlightEntry entry; Document doc = textComponent.getDocument(); Position pos0 = doc.createPosition(p0); Position pos1 = doc.createPosition(p1); if (getDrawsLayeredHighlights() && painter instanceof LayerPainter) entry = new LayerHighlightEntry(pos0, pos1, painter); else entry = new HighlightEntry(pos0, pos1, painter); highlights.add(entry); textComponent.getUI().damageRange(textComponent, p0, p1); return entry; }
| 7,109
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
| 7,110
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
| 7,111
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
| 7,112
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
| 7,113
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if (n1 == p1) if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else if (n1 == p1) { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else if (n1 == p1) { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else if (n1 == p1) { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else if (n1 == p1) { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
| 7,114
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
| 7,115
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, o0, o1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, o0, o1); ui.damageRange(textComponent, n0, n1); } }
|
public void changeHighlight(Object tag, int n0, int n1) throws BadLocationException { int o0, o1; checkPositions(n0, n1); HighlightEntry entry = (HighlightEntry) tag; o0 = entry.p0; o1 = entry.p1; // Prevent useless write & repaint operations. if (o0 == n0 && o1 == n1) return; entry.p0 = n0; entry.p1 = n1; TextUI ui = textComponent.getUI(); // Special situation where the old area has to be cleared simply. if (n0 == n1) ui.damageRange(textComponent, p0, p1); // Calculates the areas where a change is really neccessary else if ((o1 > n0 && o1 <= n1) || (n1 > o0 && n1 <= o1)) { // [fds, fde) - the first damage region // [sds, sde] - the second damage region int fds, sds; int fde, sde; // Calculate first damaged region. if(o0 < n0) { // Damaged region will be cleared as // the old highlight region starts first. fds = o0; fde = n0; } else { // Damaged region will be painted as // the new highlight region starts first. fds = n0; fde = o0; } if (o1 < n1) { // Final region will be painted as the // old highlight region finishes first sds = o1; sde = n1; } else { // Final region will be cleared as the // new highlight region finishes first. sds = n1; sde = o1; } // If there is no undamaged region in between // call damageRange only once. if (fde == sds) ui.damageRange(textComponent, fds, sde); else { if (fds != fde) ui.damageRange(textComponent, fds, fde); if (sds != sde) ui.damageRange(textComponent, sds, sde); } } else { // The two regions do not overlap. So mark // both areas as damaged. ui.damageRange(textComponent, p0, p1); ui.damageRange(textComponent, n0, n1); } }
| 7,116
|
public void paint(Graphics g) { int size = highlights.size(); // Check if there are any highlights. if (size == 0) return; // Prepares the rectangle of the inner drawing area. Insets insets = textComponent.getInsets(); Shape bounds = new Rectangle(insets.left, insets.top, textComponent.getWidth() - insets.left - insets.right, textComponent.getHeight() - insets.top - insets.bottom); for (int index = 0; index < size; ++index) { HighlightEntry entry = (HighlightEntry) highlights.get(index); entry.painter.paint(g, entry.p0, entry.p1, bounds, textComponent); } }
|
public void paint(Graphics g) { int size = highlights.size(); // Check if there are any highlights. if (size == 0) return; // Prepares the rectangle of the inner drawing area. Insets insets = textComponent.getInsets(); Shape bounds = new Rectangle(insets.left, insets.top, textComponent.getWidth() - insets.left - insets.right, textComponent.getHeight() - insets.top - insets.bottom); for (int index = 0; index < size; ++index) { HighlightEntry entry = (HighlightEntry) highlights.get(index); if (! (entry instanceof LayerHighlightEntry)) entry.painter.paint(g, entry.getStartOffset(), entry.getEndOffset(), bounds, textComponent); } }
| 7,118
|
public void paintLayeredHighlights(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent editor, View view) throws NotImplementedException { // TODO: Implement this properly. }
|
public void paintLayeredHighlights(Graphics g, int p0, int p1, Shape viewBounds, JTextComponent editor, View view) { // TODO: Implement this properly. }
| 7,119
|
public void removeHighlight(Object tag) { highlights.remove(tag); HighlightEntry entry = (HighlightEntry) tag; textComponent.getUI().damageRange(textComponent, entry.p0, entry.p1); }
|
public void removeHighlight(Object tag) { highlights.remove(tag); HighlightEntry entry = (HighlightEntry) tag; textComponent.getUI().damageRange(textComponent, entry.p0, entry.p1); }
| 7,122
|
protected void paintComponent(Graphics g) { log.debug("paint from screen"); if (bi == null) { checkOffScreenImage(); }// screen.paintComponent3(g); Graphics2D g2 = (Graphics2D) g; // Rectangle r = g.getClipBounds(); g2.setColor(bi.colorBg); g2.fillRect(0, 0, getWidth(), getHeight()); bi.drawImageBuffer(g2); if (rubberband.isAreaSelected() && !rubberband.isDragging()) { rubberband.erase(); rubberband.draw(); } keyPad.repaint(); }
|
protected void paintComponent(Graphics g) { if (bi == null) { checkOffScreenImage(); }// screen.paintComponent3(g); Graphics2D g2 = (Graphics2D) g; // Rectangle r = g.getClipBounds(); g2.setColor(bi.colorBg); g2.fillRect(0, 0, getWidth(), getHeight()); bi.drawImageBuffer(g2); if (rubberband.isAreaSelected() && !rubberband.isDragging()) { rubberband.erase(); rubberband.draw(); } keyPad.repaint(); }
| 7,123
|
public void resizeMe() {// screen.setBounds(getDrawingBounds()); //this is from screen5250 screen.setCursorActive(false); Rectangle r = getDrawingBounds(); if (bi != null) bi.resizeScreenArea(r.width, r.height); repaint();// screen.repaintScreen(); screen.setCursorActive(true); }
|
public void resizeMe() {// screen.setBounds(getDrawingBounds()); //this is from screen5250 screen.setCursorActive(false); Rectangle r = getDrawingBounds(); if (bi != null) bi.resizeScreenArea(r.width, r.height); screen.repaintScreen();// screen.repaintScreen(); screen.setCursorActive(true); }
| 7,124
|
public void applyLocalizedPattern(String pattern) { String localChars = formatData.getLocalPatternChars(); pattern = applyLocalizedPattern (pattern, localChars, standardChars); applyPattern(pattern); }
|
public void applyLocalizedPattern(String pattern) { String localChars = formatData.getLocalPatternChars(); pattern = translateLocalizedPattern(pattern, localChars, standardChars); applyPattern(pattern); }
| 7,125
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; CompiledField current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
| 7,126
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = standardChars.indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
| 7,127
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter throw new IllegalArgumentException("Invalid letter " + thisChar + "encountered at character " + i + "."); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. throw new IllegalArgumentException("Invalid letter " + thisChar + "encountered at character " + i + "."); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
| 7,128
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter throw new IllegalArgumentException("Quotes starting at character " + i + " not closed."); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. throw new IllegalArgumentException("Quotes starting at character " + i + " not closed."); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
| 7,129
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new FieldSizePair(field,1); tokens.add(current); } } } }
|
private void compileFormat(String pattern) { // Any alphabetical characters are treated as pattern characters // unless enclosed in single quotes. char thisChar; int pos; int field; FieldSizePair current = null; for (int i=0; i<pattern.length(); i++) { thisChar = pattern.charAt(i); field = formatData.getLocalPatternChars().indexOf(thisChar); if (field == -1) { current = null; if ((thisChar >= 'A' && thisChar <= 'Z') || (thisChar >= 'a' && thisChar <= 'z')) { // Not a valid letter tokens.add(new FieldSizePair(-1,0)); } else if (thisChar == '\'') { // Quoted text section; skip to next single quote pos = pattern.indexOf('\'',i+1); if (pos == -1) { // This ought to be an exception, but spec does not // let us throw one. tokens.add(new FieldSizePair(-1,0)); } if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) { tokens.add(pattern.substring(i+1,pos+1)); } else { tokens.add(pattern.substring(i+1,pos)); } i = pos; } else { // A special character tokens.add(new Character(thisChar)); } } else { // A valid field if ((current != null) && (field == current.field)) { current.size++; } else { current = new CompiledField(field,1,thisChar); tokens.add(current); } } } }
| 7,130
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof CompiledField) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,131
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { CompiledField cf = (CompiledField) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,132
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (cf.getField()) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,133
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (cf.getSize() == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,134
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), cf.getSize(), buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,135
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,136
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), cf.getSize(), buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,137
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), cf.getSize(), buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, cf.getSize(), buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), cf.getSize(), buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, cf.getSize(), buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), cf.getSize(), buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), cf.getSize(), buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), cf.getSize(), buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), cf.getSize(), buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), cf.getSize(), buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), cf.getSize(), buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), cf.getSize(), buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), cf.getSize(), buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, cf.getSize(), buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), cf.getSize(), buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,138
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), cf.getSize(), buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,139
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), cf.getSize(), buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,140
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (cf.getSize() < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (cf.getSize() < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,141
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), cf.getSize(), buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,142
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, cf.getSize(), buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,143
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), cf.getSize(), buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,144
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, cf.getSize() > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,145
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + cf.getCharacter()); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,146
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || p.field == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
|
private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos) { String temp; AttributedCharacterIterator.Attribute attribute; calendar.setTime(date); // go through vector, filling in fields where applicable, else toString Iterator iter = tokens.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof FieldSizePair) { FieldSizePair p = (FieldSizePair) o; int beginIndex = buffer.length(); switch (p.field) { case ERA_FIELD: buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA); break; case YEAR_FIELD: // If we have two digits, then we truncate. Otherwise, we // use the size of the pattern, and zero pad. buffer.setDefaultAttribute (DateFormat.Field.YEAR); if (p.size == 2) { temp = String.valueOf (calendar.get (Calendar.YEAR)); buffer.append (temp.substring (temp.length() - 2)); } else withLeadingZeros (calendar.get (Calendar.YEAR), p.size, buffer); break; case MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MONTH); if (p.size < 3) withLeadingZeros (calendar.get (Calendar.MONTH) + 1, p.size, buffer); else if (p.size < 4) buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]); else buffer.append (formatData.months[calendar.get (Calendar.MONTH)]); break; case DATE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH); withLeadingZeros (calendar.get (Calendar.DATE), p.size, buffer); break; case HOUR_OF_DAY1_FIELD: // 1-24 buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1); withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1, p.size, buffer); break; case HOUR_OF_DAY0_FIELD: // 0-23 buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0); withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), p.size, buffer); break; case MINUTE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MINUTE); withLeadingZeros (calendar.get (Calendar.MINUTE), p.size, buffer); break; case SECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.SECOND); withLeadingZeros(calendar.get (Calendar.SECOND), p.size, buffer); break; case MILLISECOND_FIELD: buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND); withLeadingZeros (calendar.get (Calendar.MILLISECOND), p.size, buffer); break; case DAY_OF_WEEK_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK); if (p.size < 4) buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]); else buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]); break; case DAY_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR); withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), p.size, buffer); break; case DAY_OF_WEEK_IN_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH); withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH), p.size, buffer); break; case WEEK_OF_YEAR_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR); withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR), p.size, buffer); break; case WEEK_OF_MONTH_FIELD: buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH); withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH), p.size, buffer); break; case AM_PM_FIELD: buffer.setDefaultAttribute (DateFormat.Field.AM_PM); buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]); break; case HOUR1_FIELD: // 1-12 buffer.setDefaultAttribute (DateFormat.Field.HOUR1); withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1, p.size, buffer); break; case HOUR0_FIELD: // 0-11 buffer.setDefaultAttribute (DateFormat.Field.HOUR0); withLeadingZeros (calendar.get (Calendar.HOUR), p.size, buffer); break; case TIMEZONE_FIELD: buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE); TimeZone zone = calendar.getTimeZone(); boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0; // FIXME: XXX: This should be a localized time zone. String zoneID = zone.getDisplayName (isDST, p.size > 3 ? TimeZone.LONG : TimeZone.SHORT); buffer.append (zoneID); break; default: throw new IllegalArgumentException ("Illegal pattern character " + p.field); } if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute() || cf.getField() == pos.getField())) { pos.setBeginIndex(beginIndex); pos.setEndIndex(buffer.length()); } } else { buffer.append(o.toString(), null); } } }
| 7,147
|
public String toLocalizedPattern() { String localChars = formatData.getLocalPatternChars(); return applyLocalizedPattern (pattern, standardChars, localChars); }
|
public String toLocalizedPattern() { String localChars = formatData.getLocalPatternChars(); return translateLocalizedPattern(pattern, standardChars, localChars); }
| 7,149
|
public String toString() { StringBuffer output = new StringBuffer(); Iterator i = tokens.iterator(); while (i.hasNext()) { output.append(i.next().toString()); } return output.toString(); }
|
public String toString() { StringBuffer output = new StringBuffer(); Iterator i = tokens.iterator(); while (i.hasNext()) { output.append(i.next().toString()); } return output.toString(); }
| 7,150
|
void setParentImpl(View p) { if (p != null) { Component c = getComponent(); p.getContainer().add(c); } else { Component c = getComponent(); Container parent = c.getParent(); parent.remove(c); comp = null; } }
|
private void setParentImpl(View p) { if (p != null) { Component c = getComponent(); p.getContainer().add(c); } else { Component c = getComponent(); Container parent = c.getParent(); parent.remove(c); comp = null; } }
| 7,152
|
public boolean canImport (JComponent c, DataFlavor[] flavors) { return false; }
|
public boolean canImport(JComponent c, DataFlavor[] flavors) throws NotImplementedException { return false; }
| 7,155
|
public void exportAsDrag (JComponent c, InputEvent e, int action) { // TODO: Implement this properly }
|
public void exportAsDrag(JComponent c, InputEvent e, int action) throws NotImplementedException { // TODO: Implement this properly }
| 7,157
|
protected void exportDone (JComponent c, Transferable data, int action) { // TODO: Implement this properly }
|
protected void exportDone(JComponent c, Transferable data, int action) throws NotImplementedException { // TODO: Implement this properly }
| 7,158
|
public boolean importData (JComponent c, Transferable t) { return false; }
|
public boolean importData(JComponent c, Transferable t) throws NotImplementedException { return false; }
| 7,160
|
public Group addToGroup(Group groupObject) { if (groupObject != null) { if (groupMemberHash.add(groupObject)) { //add in successful groupObject.addMemberObject(this); return groupObject; // bad, should return based on success of adding } else { Log.error("Can't add to group. already a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: the group object to add to is null"); return null; } }
|
public Group addToGroup(Group groupObject) { if (groupObject != null) { if (groupMemberHash.add(groupObject)) { //add in successful groupObject.addMemberObject(this); return groupObject; // bad, should return based on success of adding } else { Log.error("Can't add to group. already a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: the group object to add to is null"); return null; } }
| 7,161
|
public Group addToGroup(Group groupObject) { if (groupObject != null) { if (groupMemberHash.add(groupObject)) { //add in successful groupObject.addMemberObject(this); return groupObject; // bad, should return based on success of adding } else { Log.error("Can't add to group. already a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: the group object to add to is null"); return null; } }
|
public Group addToGroup(Group groupObject) { if (groupObject != null) { if (groupMemberHash.add(groupObject)) { //add in successful groupObject.addMemberObject(this); return groupObject; // bad, should return based on success of adding } else { Log.error("Can't add to group. already a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: the group object to add to is null"); return null; } }
| 7,162
|
protected Object clone () throws CloneNotSupportedException{ //shallow copy for fields BaseObject cloneObj = (BaseObject) super.clone(); // deep copy the attriOrder synchronized (this.attribOrder) { synchronized (cloneObj.attribOrder) { cloneObj.attribOrder = Collections.synchronizedList(new ArrayList()); int stop = this.attribOrder.size(); for (int i = 0; i < stop; i++) { cloneObj.attribOrder.add(new String((String) this.attribOrder.get(i))); } } } // XMLAttributes Clone, deep copy synchronized (this.attribHash) { synchronized (cloneObj.attribHash) { cloneObj.attribHash = new Hashtable(); Enumeration keys = this.attribHash.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); XMLAttribute XMLAttributeValue = (XMLAttribute) this.attribHash.get(key); cloneObj.attribHash.put(key, XMLAttributeValue.clone()); } } } return cloneObj; }
|
protected Object clone () throws CloneNotSupportedException{ //shallow copy for fields BaseObject cloneObj = (BaseObject) super.clone(); // deep copy the attriOrder synchronized (this.attribOrder) { synchronized (cloneObj.attribOrder) { cloneObj.attribOrder = Collections.synchronizedList(new ArrayList()); int stop = this.attribOrder.size(); for (int i = 0; i < stop; i++) { cloneObj.attribOrder.add(new String((String) this.attribOrder.get(i))); } } } // XMLAttributes Clone, deep copy synchronized (this.attribHash) { synchronized (cloneObj.attribHash) { cloneObj.attribHash = new Hashtable(); Enumeration keys = this.attribHash.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); XMLAttribute XMLAttributeValue = (XMLAttribute) this.attribHash.get(key); cloneObj.attribHash.put(key, XMLAttributeValue.clone()); } } } }
| 7,163
|
private String dealWithClosingGroupNodes (BaseObject obj, OutputStream outputstream, String indent) { // Should *both* groupMemberHash and openGroupNodeHash be synchronized?? synchronized(obj.groupMemberHash) { synchronized(this.openGroupNodeHash) { Iterator iter = this.openGroupNodeHash.iterator(); // Must be in synchronized block while (iter.hasNext()) { Group openGroup = (Group) iter.next(); // determine if this group that we belong to is already // open or not. if(!obj.groupMemberHash.contains(openGroup)) { // its *not* a member of this group and its still open, // so we need to close it. if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "</" + openGroup.classXDFNodeName + ">"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); this.openGroupNodeHash.remove(openGroup); // peel off some indent indent = indent.substring(0,indent.length() - sPrettyXDFOutputIndentation.length()); } } } } return indent; }
|
private String dealWithClosingGroupNodes (BaseObject obj, OutputStream outputstream, String indent) { // Should *both* groupMemberHash and openGroupNodeHash be synchronized?? synchronized(obj.groupMemberHash) { synchronized(this.openGroupNodeHash) { Iterator iter = this.openGroupNodeHash.iterator(); // Must be in synchronized block while (iter.hasNext()) { Group openGroup = (Group) iter.next(); // determine if this group that we belong to is already // open or not. if(!obj.groupMemberHash.contains(openGroup)) { // its *not* a member of this group and its still open, // so we need to close it. if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); writeOut(outputstream, "</" + openGroup.classXDFNodeName + ">"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); this.openGroupNodeHash.remove(openGroup); // peel off some indent indent = indent.substring(0,indent.length() - sPrettyXDFOutputIndentation.length()); } } } } return indent; }
| 7,164
|
private String dealWithClosingGroupNodes (BaseObject obj, OutputStream outputstream, String indent) { // Should *both* groupMemberHash and openGroupNodeHash be synchronized?? synchronized(obj.groupMemberHash) { synchronized(this.openGroupNodeHash) { Iterator iter = this.openGroupNodeHash.iterator(); // Must be in synchronized block while (iter.hasNext()) { Group openGroup = (Group) iter.next(); // determine if this group that we belong to is already // open or not. if(!obj.groupMemberHash.contains(openGroup)) { // its *not* a member of this group and its still open, // so we need to close it. if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "</" + openGroup.classXDFNodeName + ">"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); this.openGroupNodeHash.remove(openGroup); // peel off some indent indent = indent.substring(0,indent.length() - sPrettyXDFOutputIndentation.length()); } } } } return indent; }
|
private String dealWithClosingGroupNodes (BaseObject obj, OutputStream outputstream, String indent) { // Should *both* groupMemberHash and openGroupNodeHash be synchronized?? synchronized(obj.groupMemberHash) { synchronized(this.openGroupNodeHash) { Iterator iter = this.openGroupNodeHash.iterator(); // Must be in synchronized block while (iter.hasNext()) { Group openGroup = (Group) iter.next(); // determine if this group that we belong to is already // open or not. if(!obj.groupMemberHash.contains(openGroup)) { // its *not* a member of this group and its still open, // so we need to close it. if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "</" + openGroup.classXDFNodeName + ">"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); this.openGroupNodeHash.remove(openGroup); // peel off some indent indent = indent.substring(0,indent.length() - sPrettyXDFOutputIndentation.length()); } } } } return indent; }
| 7,165
|
private String dealWithClosingGroupNodes (BaseObject obj, OutputStream outputstream, String indent) { // Should *both* groupMemberHash and openGroupNodeHash be synchronized?? synchronized(obj.groupMemberHash) { synchronized(this.openGroupNodeHash) { Iterator iter = this.openGroupNodeHash.iterator(); // Must be in synchronized block while (iter.hasNext()) { Group openGroup = (Group) iter.next(); // determine if this group that we belong to is already // open or not. if(!obj.groupMemberHash.contains(openGroup)) { // its *not* a member of this group and its still open, // so we need to close it. if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "</" + openGroup.classXDFNodeName + ">"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); this.openGroupNodeHash.remove(openGroup); // peel off some indent indent = indent.substring(0,indent.length() - sPrettyXDFOutputIndentation.length()); } } } } return indent; }
|
private String dealWithClosingGroupNodes (BaseObject obj, OutputStream outputstream, String indent) { // Should *both* groupMemberHash and openGroupNodeHash be synchronized?? synchronized(obj.groupMemberHash) { synchronized(this.openGroupNodeHash) { Iterator iter = this.openGroupNodeHash.iterator(); // Must be in synchronized block while (iter.hasNext()) { Group openGroup = (Group) iter.next(); // determine if this group that we belong to is already // open or not. if(!obj.groupMemberHash.contains(openGroup)) { // its *not* a member of this group and its still open, // so we need to close it. if (sPrettyXDFOutput) writeOut(outputstream, indent); writeOut(outputstream, "</" + openGroup.classXDFNodeName + ">"); if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE); this.openGroupNodeHash.remove(openGroup); // peel off some indent indent = indent.substring(0,indent.length() - Specification.getInstance().getPrettyXDFOutputIndentation().length()); } } } } return indent; }
| 7,166
|
private String dealWithOpeningGroupNodes (BaseObject obj, OutputStream outputstream, String indent) { StringBuffer newIndent = new StringBuffer(indent); // Should *both* groupMemberHash and openGroupNodeHash be synchronized?? synchronized(obj.groupMemberHash) { synchronized(this.openGroupNodeHash) { Iterator iter = obj.groupMemberHash.iterator(); // Must be in synchronized block while (iter.hasNext()) { Group memberGroup = (Group) iter.next(); // determine if this group that we belong to is already // open or not. if(!this.openGroupNodeHash.contains(memberGroup)) { // its *not* already open, so we bump up the indentation, // open it and add it to the open group node list. newIndent.append(sPrettyXDFOutputIndentation); memberGroup.toXMLOutputStream(outputstream, new Hashtable(), newIndent.toString(), true, null, null); this.openGroupNodeHash.add(memberGroup); } } } } return newIndent.toString(); }
|
private String dealWithOpeningGroupNodes (BaseObject obj, OutputStream outputstream, String indent) { StringBuffer newIndent = new StringBuffer(indent); // Should *both* groupMemberHash and openGroupNodeHash be synchronized?? synchronized(obj.groupMemberHash) { synchronized(this.openGroupNodeHash) { Iterator iter = obj.groupMemberHash.iterator(); // Must be in synchronized block while (iter.hasNext()) { Group memberGroup = (Group) iter.next(); // determine if this group that we belong to is already // open or not. if(!this.openGroupNodeHash.contains(memberGroup)) { // its *not* already open, so we bump up the indentation, // open it and add it to the open group node list. newIndent.append(Specification.getInstance().getPrettyXDFOutputIndentation()); memberGroup.toXMLOutputStream(outputstream, new Hashtable(), newIndent.toString(), true, null, null); this.openGroupNodeHash.add(memberGroup); } } } } return newIndent.toString(); }
| 7,167
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
| 7,168
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
| 7,169
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
| 7,170
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo;
| 7,171
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
|
protected Hashtable getXMLInfo () { Hashtable xmlInfo = new Hashtable(); ArrayList attribList = new ArrayList(); ArrayList objRefList = new ArrayList(); int size = attribHash.size(); for (int i = 0; i < size; i++) { String attribName = (String) attribOrder.get(i); XMLAttribute obj = (XMLAttribute) attribHash.get(attribName); if (obj != null && obj.attribValue != null) { if ( obj.attribType == Constants.STRING_TYPE) { if (attribName.equals(sPCDATAAttribute)) { xmlInfo.put("PCDATA", obj.attribValue); } else { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); attribList.add(item); } } else { if(obj.attribType == Constants.NUMBER_TYPE || obj.attribType == Constants.STRING_OR_NUMBER_TYPE) { //it's an attribute of Number type Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue.toString()); attribList.add(item); } else {// add to list if it is not an empty list -k.z. if ((obj.attribType !=Constants.LIST_TYPE) || (((List)obj.attribValue).size()!=0)) { Hashtable item = new Hashtable(); item.put("name", attribName); item.put("value", obj.attribValue); item.put("type", obj.attribType); objRefList.add(item); } } } } } xmlInfo.put("attribList", attribList); xmlInfo.put("childObjList", objRefList); return xmlInfo; }
| 7,172
|
protected void hashtableInitXDFAttributes (Hashtable InitAttributeTable) { Object attribute; Object obj; int size = attribOrder.size(); for (int i = 0; i < size; i++) { attribute = attribOrder.get(i); obj = InitAttributeTable.get(attribute); // only if object exists if (obj != null) { XMLAttribute toRemove = (XMLAttribute) attribHash.remove(attribute); attribHash.put(attribute, new XMLAttribute(obj, toRemove.getAttribType())); } } }
|
protected void hashtableInitXDFAttributes (Hashtable InitAttributeTable) { Object attribute; Object obj; int size = attribOrder.size(); for (int i = 0; i < size; i++) { attribute = attribOrder.get(i); obj = InitAttributeTable.get(attribute); // only if object exists if (obj != null) { XMLAttribute toRemove = (XMLAttribute) attribHash.remove(attribute); attribHash.put(attribute, new XMLAttribute(obj, toRemove.getAttribType())); } } }
| 7,173
|
protected void hashtableInitXDFAttributes (Hashtable InitAttributeTable) { Object attribute; Object obj; int size = attribOrder.size(); for (int i = 0; i < size; i++) { attribute = attribOrder.get(i); obj = InitAttributeTable.get(attribute); // only if object exists if (obj != null) { XMLAttribute toRemove = (XMLAttribute) attribHash.remove(attribute); attribHash.put(attribute, new XMLAttribute(obj, toRemove.getAttribType())); } } }
|
protected void hashtableInitXDFAttributes (Hashtable InitAttributeTable) { Object attribute; Object obj; int size = attribOrder.size(); for (int i = 0; i < size; i++) { attribute = attribOrder.get(i); obj = InitAttributeTable.get(attribute); // only if object exists if (obj != null) { XMLAttribute toRemove = (XMLAttribute) attribHash.remove(attribute); attribHash.put(attribute, new XMLAttribute(obj, toRemove.getAttribType())); } } }
| 7,174
|
public boolean isGroupMember(Group groupObject) { if ( (groupObject != null) && groupMemberHash.contains(groupObject)) return true; else return false; }
|
public boolean isGroupMember(Group groupObject) { if ( groupMemberHash.contains(groupObject)) return true; else return false; }
| 7,175
|
public Group removeFromGroup (Group groupObject) { if (groupObject != null) { if (groupMemberHash.contains(groupObject)) { //this object does belong to the indicated Group object groupObject.removeMemberObject((Object) this); groupMemberHash.remove(groupObject); return groupObject; } else { Log.error("Can't delete from group. not a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: The group to add to is null"); return null; } }
|
public Group removeFromGroup (Group groupObject) { if (groupMemberHash.contains(groupObject)) { //this object does belong to the indicated Group object groupObject.removeMemberObject((Object) this); groupMemberHash.remove(groupObject); return groupObject; } else { Log.error("Can't delete from group. not a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: The group to add to is null"); return null; } }
| 7,176
|
public Group removeFromGroup (Group groupObject) { if (groupObject != null) { if (groupMemberHash.contains(groupObject)) { //this object does belong to the indicated Group object groupObject.removeMemberObject((Object) this); groupMemberHash.remove(groupObject); return groupObject; } else { Log.error("Can't delete from group. not a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: The group to add to is null"); return null; } }
|
public Group removeFromGroup (Group groupObject) { if (groupObject != null) { if (groupMemberHash.contains(groupObject)) { //this object does belong to the indicated Group object groupObject.removeMemberObject((Object) this); groupMemberHash.remove(groupObject); return groupObject; } else { Log.errorln("Can't delete from group. not a member of the group" + groupObject.getName()); return null; } } else { Log.error("Error: The group to add to is null"); return null; } }
| 7,177
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.