rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
((JLabel) evt.getSource()).setIcon(MIN_ICON); | ((JLabel) evt.getSource()).setIcon(MINIMIZE_ICON); | private void minimizeJLabelMouseExited(java.awt.event.MouseEvent evt) { ((JLabel) evt.getSource()).setIcon(MIN_ICON); } |
logVariable("preSendPacket", DateUtil.getInstance()); | logger.logVariable("preSendPacket", DateUtil.getInstance()); | public XMPPMethodResponse execute(final XMPPConnection xmppConnection) { // add an executed on parameter setParameter(Xml.All.EXECUTED_ON, DateUtil.getInstance()); // create a collector for the response final PacketCollector idCollector = createPacketCollector(xmppConnection); // TIME This is a local timestamp. logVariable("preSendPacket", DateUtil.getInstance()); xmppConnection.sendPacket(this); // TIME This is a local timestamp. logVariable("postSendPacket", DateUtil.getInstance()); // this sleep has been inserted because when packets are sent within // x milliseconds of each other, they tend to get swallowed by the // smack library try { Thread.sleep(75); } catch(final InterruptedException ix) {} // the timeout is used because the timeout is not expected to be long; // and it helps debug non-implemented responses logVariable("preResponseCollected", DateUtil.getInstance()); try { final XMPPMethodResponse response =// (XMPPMethodResponse) idCollector.nextResult(7 * 1000); (XMPPMethodResponse) idCollector.nextResult(); return response; } catch (final Throwable t) { final String errorId = new ErrorHelper().getErrorId(t); logger.logError(t, errorId); logger.logError("name:{0}", name); logger.logError("xmppConnection:{0}", xmppConnection); throw new XMPPException(errorId); } finally { // re-set the parameters post execution logVariable("postResponseCollected", DateUtil.getInstance()); parameters.clear(); } } |
logVariable("postSendPacket", DateUtil.getInstance()); | logger.logVariable("postSendPacket", DateUtil.getInstance()); | public XMPPMethodResponse execute(final XMPPConnection xmppConnection) { // add an executed on parameter setParameter(Xml.All.EXECUTED_ON, DateUtil.getInstance()); // create a collector for the response final PacketCollector idCollector = createPacketCollector(xmppConnection); // TIME This is a local timestamp. logVariable("preSendPacket", DateUtil.getInstance()); xmppConnection.sendPacket(this); // TIME This is a local timestamp. logVariable("postSendPacket", DateUtil.getInstance()); // this sleep has been inserted because when packets are sent within // x milliseconds of each other, they tend to get swallowed by the // smack library try { Thread.sleep(75); } catch(final InterruptedException ix) {} // the timeout is used because the timeout is not expected to be long; // and it helps debug non-implemented responses logVariable("preResponseCollected", DateUtil.getInstance()); try { final XMPPMethodResponse response =// (XMPPMethodResponse) idCollector.nextResult(7 * 1000); (XMPPMethodResponse) idCollector.nextResult(); return response; } catch (final Throwable t) { final String errorId = new ErrorHelper().getErrorId(t); logger.logError(t, errorId); logger.logError("name:{0}", name); logger.logError("xmppConnection:{0}", xmppConnection); throw new XMPPException(errorId); } finally { // re-set the parameters post execution logVariable("postResponseCollected", DateUtil.getInstance()); parameters.clear(); } } |
logVariable("preResponseCollected", DateUtil.getInstance()); | logger.logVariable("preResponseCollected", DateUtil.getInstance()); | public XMPPMethodResponse execute(final XMPPConnection xmppConnection) { // add an executed on parameter setParameter(Xml.All.EXECUTED_ON, DateUtil.getInstance()); // create a collector for the response final PacketCollector idCollector = createPacketCollector(xmppConnection); // TIME This is a local timestamp. logVariable("preSendPacket", DateUtil.getInstance()); xmppConnection.sendPacket(this); // TIME This is a local timestamp. logVariable("postSendPacket", DateUtil.getInstance()); // this sleep has been inserted because when packets are sent within // x milliseconds of each other, they tend to get swallowed by the // smack library try { Thread.sleep(75); } catch(final InterruptedException ix) {} // the timeout is used because the timeout is not expected to be long; // and it helps debug non-implemented responses logVariable("preResponseCollected", DateUtil.getInstance()); try { final XMPPMethodResponse response =// (XMPPMethodResponse) idCollector.nextResult(7 * 1000); (XMPPMethodResponse) idCollector.nextResult(); return response; } catch (final Throwable t) { final String errorId = new ErrorHelper().getErrorId(t); logger.logError(t, errorId); logger.logError("name:{0}", name); logger.logError("xmppConnection:{0}", xmppConnection); throw new XMPPException(errorId); } finally { // re-set the parameters post execution logVariable("postResponseCollected", DateUtil.getInstance()); parameters.clear(); } } |
logVariable("postResponseCollected", DateUtil.getInstance()); | logger.logVariable("postResponseCollected", DateUtil.getInstance()); | public XMPPMethodResponse execute(final XMPPConnection xmppConnection) { // add an executed on parameter setParameter(Xml.All.EXECUTED_ON, DateUtil.getInstance()); // create a collector for the response final PacketCollector idCollector = createPacketCollector(xmppConnection); // TIME This is a local timestamp. logVariable("preSendPacket", DateUtil.getInstance()); xmppConnection.sendPacket(this); // TIME This is a local timestamp. logVariable("postSendPacket", DateUtil.getInstance()); // this sleep has been inserted because when packets are sent within // x milliseconds of each other, they tend to get swallowed by the // smack library try { Thread.sleep(75); } catch(final InterruptedException ix) {} // the timeout is used because the timeout is not expected to be long; // and it helps debug non-implemented responses logVariable("preResponseCollected", DateUtil.getInstance()); try { final XMPPMethodResponse response =// (XMPPMethodResponse) idCollector.nextResult(7 * 1000); (XMPPMethodResponse) idCollector.nextResult(); return response; } catch (final Throwable t) { final String errorId = new ErrorHelper().getErrorId(t); logger.logError(t, errorId); logger.logError("name:{0}", name); logger.logError("xmppConnection:{0}", xmppConnection); throw new XMPPException(errorId); } finally { // re-set the parameters post execution logVariable("postResponseCollected", DateUtil.getInstance()); parameters.clear(); } } |
logVariable("childElementXML.length():", childElementXML.length()); | logger.logVariable("childElementXML.length()", childElementXML.length()); logger.logVariable("childElementXML", childElementXML); | public String getChildElementXML() { final StringBuffer childElementXML = new StringBuffer() .append("<query xmlns=\"jabber:iq:parity:") .append(name) .append("\">") .append(getParametersXML()) .append("</query>"); logVariable("childElementXML.length():", childElementXML.length()); return childElementXML.toString(); } |
if(!isLoggedIn()) { login(); } | private void doStart() { if(!isFirstRun()) { firstRun(); } ApplicationFactory.create(this, ApplicationId.SYS_APP).start(this); ApplicationFactory.create(this, ApplicationId.BROWSER2).start(this); } |
|
public String getPublicationDate() { return getProperty(keyPublicationDate); | public Date getPublicationDate() { return (Date) getProperty(keyPublicationDate); | public String getPublicationDate() { return getProperty(keyPublicationDate); } |
return getProperty(keyTitle); | return (String) getProperty(keyTitle); | public String getTitle() { return getProperty(keyTitle); } |
storage = new Properties(); | storage = new Hashtable<String, Object>(); | public AmberMessage() { storage = new Properties(); } |
public void setProperty(String key, String value) { storage.setProperty(key, value); | public void setProperty(String key, Object value) { storage.put(key, value); | public void setProperty(String key, String value) { storage.setProperty(key, value); } |
storage = (Properties) YAML.load(in); | storage = (Hashtable<String, Object>) YAML.load(in); | public void fromYAML(String in) { storage = (Properties) YAML.load(in); } |
public String getProperty(String key) { return storage.getProperty(key); | public Object getProperty(String key) { return storage.get(key); | public String getProperty(String key) { return storage.getProperty(key); } |
protected File getXmlFile(final Document document, final DocumentVersion version) throws FileNotFoundException, IOException { logger.info("getXmlFile(Document,DocumentVersion)"); logger.debug(document); logger.debug(version); return new File( getXmlFileDirectory(document), new StringBuffer(document.getName()) .append(".") .append(version.getVersion()) .append(IXmlIOConstants.FILE_EXTENSION_DOCUMENT_VERSION) .toString()); | protected File getXmlFile(final Document document) throws FileNotFoundException, IOException { final File xmlFile = lookupXmlFile(document.getId()); if(null != xmlFile) { return xmlFile; } else { return xmlPathBuilder.getXmlFile(document, fillInStack(document)); } | protected File getXmlFile(final Document document, final DocumentVersion version) throws FileNotFoundException, IOException { logger.info("getXmlFile(Document,DocumentVersion)"); logger.debug(document); logger.debug(version); return new File( getXmlFileDirectory(document), new StringBuffer(document.getName()) .append(".") .append(version.getVersion()) .append(IXmlIOConstants.FILE_EXTENSION_DOCUMENT_VERSION) .toString()); } |
index.addLookup(document.getId(), getXmlFile(document)); | index.addXmlFileLookup(document.getId(), getXmlFile(document)); | private void writeIndexXml(final Document document) throws FileNotFoundException, IOException { synchronized(indexLock) { final IndexXmlIO indexXmlIO = new IndexXmlIO(workspace); final Index index = indexXmlIO.get(); index.addLookup(document.getId(), getXmlFile(document)); write(index, getIndexXmlFile()); } } |
if ((!resizeDragging) && (!moveDragging) && (resizeEdges!=ResizeEdges.NO_EDGE)) { | if (enabled &&(!resizeDragging) && (!moveDragging) && (resizeEdges!=ResizeEdges.NO_EDGE)) { | private void formMouseEntered(final java.awt.event.MouseEvent evt, final Component component) { if ((!resizeDragging) && (!moveDragging) && (resizeEdges!=ResizeEdges.NO_EDGE)) { initResize(evt, component); } } |
if ((!resizeDragging) && (!moveDragging) && (resizeEdges!=ResizeEdges.NO_EDGE)) { | if (enabled && (!resizeDragging) && (!moveDragging) && (resizeEdges!=ResizeEdges.NO_EDGE)) { | private void formMouseMoved(final java.awt.event.MouseEvent evt, final Component component) { if ((!resizeDragging) && (!moveDragging) && (resizeEdges!=ResizeEdges.NO_EDGE)) { initResize(evt, component); } } |
resizeOffsetX = evt.getPoint().x; resizeOffsetY = evt.getPoint().y; if ((resizeDirection == ResizeDirection.NONE) && (supportMouseMove)) { moveDragging = Boolean.TRUE; } else if (resizeDirection != ResizeDirection.NONE) { resizeDragging = Boolean.TRUE; | if (enabled) { resizeOffsetX = evt.getPoint().x; resizeOffsetY = evt.getPoint().y; if ((resizeDirection == ResizeDirection.NONE) && (supportMouseMove)) { moveDragging = Boolean.TRUE; } else if (resizeDirection != ResizeDirection.NONE) { resizeDragging = Boolean.TRUE; } | private void formMousePressed(final java.awt.event.MouseEvent evt, final Component component) { resizeOffsetX = evt.getPoint().x; resizeOffsetY = evt.getPoint().y; if ((resizeDirection == ResizeDirection.NONE) && (supportMouseMove)) { moveDragging = Boolean.TRUE; } else if (resizeDirection != ResizeDirection.NONE) { resizeDragging = Boolean.TRUE; } } |
public ParityException() { super(); } | ParityException(final Throwable cause) { super(cause); fillInStackTrace(); } | public ParityException() { super(); } |
super(list, ICON, getListItemText(document)); | super(list, ICON, document.getName()); | BrowserMainListItemDocument(final BrowserMainAvatar list, final Document document) { super(list, ICON, getListItemText(document)); this.documentId = document.getId(); this.selectionTimer = new Timer(500, new ActionListener() { public void actionPerformed(final ActionEvent e) { getController().selectDocument(documentId); getController().displayDocumentHistoryListAvatar(); } }); this.selectionTimer.setRepeats(false); if(hasBeenSeen()) { setListItemFont(UIConstants.DefaultFont); } else { setListItemFont(UIConstants.DefaultFontBold); } if(isKeyHolder()) { final GridBagConstraints c = new GridBagConstraints(); final JLabel jLabel = LabelFactory.create(new ImageIcon( ResourceUtil.getURL("images/keyHolder.png"))); c.anchor = GridBagConstraints.EAST; c.insets.right = 18; add(jLabel, c.clone()); } } |
protected BrowserMainListItem(final BrowserMainAvatar list, final ImageIcon listItemIcon, final String listItemText) { this(list, listItemIcon, listItemText, null); | protected BrowserMainListItem(final Type type, final ImageIcon icon, final String name, final Object data) { super(); this.data = data; this.type = type; this.name = name; this.icon = icon; | protected BrowserMainListItem(final BrowserMainAvatar list, final ImageIcon listItemIcon, final String listItemText) { this(list, listItemIcon, listItemText, null); } |
searchLeftJLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(final MouseEvent e) { searchLeftJLabelMouseClicked(e); } }); | private void initComponents() { searchJTextField = TextFactory.create(); // COLOR SearchText 237,241,244,255 searchJTextField.setBackground(new Color(237, 241, 244, 255)); // BORDER SearchText TopBottom 204,215,226,255 searchJTextField.setBorder(new TopBottomBorder(new Color(204, 215, 226, 255))); searchLeftJLabel = LabelFactory.create(SEARCH_LEFT_ICON); searchRightJLabel = LabelFactory.create(SEARCH_RIGHT_ICON); final GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.EAST; c.insets.left = 167; add(searchLeftJLabel, c.clone()); c.anchor = GridBagConstraints.CENTER; c.fill = GridBagConstraints.BOTH; c.insets.left = 0; c.weightx = 1; add(searchJTextField, c.clone()); c.fill = GridBagConstraints.NONE; c.insets.left = 0; c.insets.right = 7; c.weightx = 0; add(searchRightJLabel, c.clone()); } |
|
receiveKeyHistoryItem.setVersionId(receiveKeyEvent.getArtifactVersionId()); | private static ReceiveKeyHistoryItem buildReceiveKeyHistoryItem( final Document document, final ReceiveKeyEvent receiveKeyEvent, final Map<JabberId, User> receiveKeyEventUsers) { final ReceiveKeyHistoryItem receiveKeyHistoryItem = new ReceiveKeyHistoryItem(); receiveKeyHistoryItem.setDate(receiveKeyEvent.getCreatedOn()); receiveKeyHistoryItem.setDocumentId(receiveKeyEvent.getArtifactId()); receiveKeyHistoryItem.setEvent(HistoryItemEvent.RECEIVE_KEY); receiveKeyHistoryItem.setName(document.getName()); receiveKeyHistoryItem.setReceivedFrom( receiveKeyEventUsers.get(receiveKeyEvent.getReceivedFrom())); receiveKeyHistoryItem.setVersionId(receiveKeyEvent.getArtifactVersionId()); return receiveKeyHistoryItem; } |
|
if (cell.isSelectedContainer()) { int x = 3; x++; } if (list.hasFocus()) { int y = 4; y++; } if (cell.isSelectedContainer() && list.hasFocus()) { | if (cell.isSelectedContainer() && !cell.isFocusOnRight()) { | public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final AbstractVersionCell cell = (AbstractVersionCell) value; textJLabel.setText(cell.getText()); final Icon icon = cell.getIcon(); if (null!=icon) { iconJLabel.setIcon(icon); } if (isSelected) { if (cell.isSelectedContainer()) { int x = 3; x++; } if (list.hasFocus()) { int y = 4; y++; } if (cell.isSelectedContainer() && list.hasFocus()) { textJLabel.setForeground(Colors.Browser.List.INNER_LIST_SELECTION_FG); setBackground(Colors.Browser.List.INNER_LIST_SELECTION_BG); } else { textJLabel.setForeground(Colors.Browser.List.INNER_LEFT_LIST_SELECTION_NOFOCUS_FG); setBackground(Colors.Browser.List.INNER_LEFT_LIST_SELECTION_NOFOCUS_BG); } } else { textJLabel.setForeground(Colors.Browser.List.LIST_FG); if (0 == index % 2) { setBackground(Colors.Browser.List.LIST_EVEN_BG); } else { setBackground(Colors.Browser.List.LIST_ODD_BG); } } return this; } |
logger.debug("JMenuItem.Mnemonic[" + mnemonic + "]"); | private void applyMnemonic(final JMenuItem jMenuItem, final Integer mnemonic) { logger.debug("JMenuItem.Mnemonic[" + mnemonic + "]"); jMenuItem.setMnemonic(mnemonic); } |
|
logger.debug("JMenuItem[" + text + "]"); | private JMenuItem doCreate(final String text) { logger.debug("JMenuItem[" + text + "]"); final JMenuItem jMenuItem = new JMenuItem(text); applyDefaultFont(jMenuItem); applyMinimumWidth(jMenuItem, 150); return jMenuItem; } |
|
logger.debug(text); | private JCheckBoxMenuItem doCreateCheckBox(final String text, final Integer mnemonic) { logger.debug(text); final JCheckBoxMenuItem jCheckBoxMenuItem = new JCheckBoxMenuItem(text); applyDefaultFont(jCheckBoxMenuItem); applyMnemonic(jCheckBoxMenuItem, mnemonic); return jCheckBoxMenuItem; } |
|
this.mainKeyProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { return sessionModel.getArtifactKeys().toArray(new Long[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; | private ProviderFactory() { super(); final ModelFactory modelFactory = ModelFactory.getInstance(); this.documentModel = modelFactory.getDocumentModel(getClass()); this.sessionModel = modelFactory.getSessionModel(getClass()); this.systemMessageModel = modelFactory.getSystemMessageModel(getClass()); this.historyProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { final Long documentId = (Long) input; try { return documentModel.readHistory(documentId) .toArray(new HistoryItem[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.logger = ModelLoggerFactory.getLogger(getClass()); this.mainDocumentProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { // sort by: // +> hasBeenSeen ? true b4 false // +> last update ? earlier b4 later // +> name ? alpha order final AbstractArtifactComparator sort = new HasBeenSeenComparator(Boolean.FALSE); sort.add(new UpdatedOnComparator(Boolean.FALSE)); sort.add(new ComparatorBuilder().createByName(Boolean.TRUE)); return documentModel.list(sort).toArray(new Document[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.mainKeyProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { return sessionModel.getArtifactKeys().toArray(new Long[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.mainMessageProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { final Collection<SystemMessage> messages = systemMessageModel.read(); return messages.toArray(new SystemMessage[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.mainProvider = new CompositeFlatContentProvider() { private final ContentProvider[] contentProviders = new ContentProvider[] {mainDocumentProvider, mainMessageProvider, mainKeyProvider}; public Object[] getElements(final Integer index, final Object input) { Assert.assertNotNull("Index cannot be null.", index); Assert.assertTrue( "Index must lie within [0," + (contentProviders.length - 1) + "]", index >= 0 && index < contentProviders.length); return ((FlatContentProvider) getProvider(index)).getElements(input); } private FlatContentProvider getProvider(final Integer index) { return (FlatContentProvider) contentProviders[index]; } }; this.sendArtifactContactProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { List<Contact> roster; try { roster = sessionModel.readContacts(); // remove all team members from the roster list final Contact[] team = (Contact[]) input; if(null != team) { for(final Contact contact : team) roster.remove(contact); } } catch(final ParityException px) { throw new RuntimeException(px); } return roster.toArray(new Contact[] {}); } }; this.sendArtifactArtifactContactProvider = new FlatContentProvider() { final JabberId jabberId = JabberIdBuilder.parseUsername(preferences.getUsername()); public Object[] getElements(final Object input) { Assert.assertNotNull( "The team provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The team provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; List<Contact> artifactContacts; try { artifactContacts = sessionModel.readArtifactContacts(artifactId); Contact contact; for(final Iterator<Contact> i = artifactContacts.iterator(); i.hasNext();) { contact= i.next(); if(contact.getId().equals(jabberId)) { i.remove(); } } return artifactContacts.toArray(new Contact[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.sendArtifactVersionProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { Assert.assertNotNull( "The send artifact version provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The send artifact version provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; final List<DocumentVersion> versions = new LinkedList<DocumentVersion>(); try { versions.addAll(documentModel.listVersions(artifactId)); if(sessionModel.isLoggedInUserKeyHolder(artifactId)) { versions.add(0, WorkingVersion.getWorkingVersion()); } return versions.toArray(new DocumentVersion[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.sendArtifactProvider = new CompositeFlatContentProvider() { private final ContentProvider[] contentProviders = new ContentProvider[] {sendArtifactContactProvider, sendArtifactArtifactContactProvider, sendArtifactVersionProvider}; public Object[] getElements(final Integer index, final Object input) { Assert.assertNotNull( "Index for composite content provider cannot be null.", index); Assert.assertTrue( "Index for the send artifact content provider mus lie within [0," + 2 + "]", index >= 0 && index <= 2); return getProvider(index).getElements(input); } private FlatContentProvider getProvider(final Integer index) { return (FlatContentProvider) contentProviders[index]; } }; } |
|
private final ContentProvider[] contentProviders = new ContentProvider[] {mainDocumentProvider, mainMessageProvider, mainKeyProvider}; | private final ContentProvider[] contentProviders = new ContentProvider[] {mainDocumentProvider, mainMessageProvider}; | private ProviderFactory() { super(); final ModelFactory modelFactory = ModelFactory.getInstance(); this.documentModel = modelFactory.getDocumentModel(getClass()); this.sessionModel = modelFactory.getSessionModel(getClass()); this.systemMessageModel = modelFactory.getSystemMessageModel(getClass()); this.historyProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { final Long documentId = (Long) input; try { return documentModel.readHistory(documentId) .toArray(new HistoryItem[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.logger = ModelLoggerFactory.getLogger(getClass()); this.mainDocumentProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { // sort by: // +> hasBeenSeen ? true b4 false // +> last update ? earlier b4 later // +> name ? alpha order final AbstractArtifactComparator sort = new HasBeenSeenComparator(Boolean.FALSE); sort.add(new UpdatedOnComparator(Boolean.FALSE)); sort.add(new ComparatorBuilder().createByName(Boolean.TRUE)); return documentModel.list(sort).toArray(new Document[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.mainKeyProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { return sessionModel.getArtifactKeys().toArray(new Long[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.mainMessageProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { final Collection<SystemMessage> messages = systemMessageModel.read(); return messages.toArray(new SystemMessage[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.mainProvider = new CompositeFlatContentProvider() { private final ContentProvider[] contentProviders = new ContentProvider[] {mainDocumentProvider, mainMessageProvider, mainKeyProvider}; public Object[] getElements(final Integer index, final Object input) { Assert.assertNotNull("Index cannot be null.", index); Assert.assertTrue( "Index must lie within [0," + (contentProviders.length - 1) + "]", index >= 0 && index < contentProviders.length); return ((FlatContentProvider) getProvider(index)).getElements(input); } private FlatContentProvider getProvider(final Integer index) { return (FlatContentProvider) contentProviders[index]; } }; this.sendArtifactContactProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { List<Contact> roster; try { roster = sessionModel.readContacts(); // remove all team members from the roster list final Contact[] team = (Contact[]) input; if(null != team) { for(final Contact contact : team) roster.remove(contact); } } catch(final ParityException px) { throw new RuntimeException(px); } return roster.toArray(new Contact[] {}); } }; this.sendArtifactArtifactContactProvider = new FlatContentProvider() { final JabberId jabberId = JabberIdBuilder.parseUsername(preferences.getUsername()); public Object[] getElements(final Object input) { Assert.assertNotNull( "The team provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The team provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; List<Contact> artifactContacts; try { artifactContacts = sessionModel.readArtifactContacts(artifactId); Contact contact; for(final Iterator<Contact> i = artifactContacts.iterator(); i.hasNext();) { contact= i.next(); if(contact.getId().equals(jabberId)) { i.remove(); } } return artifactContacts.toArray(new Contact[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.sendArtifactVersionProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { Assert.assertNotNull( "The send artifact version provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The send artifact version provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; final List<DocumentVersion> versions = new LinkedList<DocumentVersion>(); try { versions.addAll(documentModel.listVersions(artifactId)); if(sessionModel.isLoggedInUserKeyHolder(artifactId)) { versions.add(0, WorkingVersion.getWorkingVersion()); } return versions.toArray(new DocumentVersion[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.sendArtifactProvider = new CompositeFlatContentProvider() { private final ContentProvider[] contentProviders = new ContentProvider[] {sendArtifactContactProvider, sendArtifactArtifactContactProvider, sendArtifactVersionProvider}; public Object[] getElements(final Integer index, final Object input) { Assert.assertNotNull( "Index for composite content provider cannot be null.", index); Assert.assertTrue( "Index for the send artifact content provider mus lie within [0," + 2 + "]", index >= 0 && index <= 2); return getProvider(index).getElements(input); } private FlatContentProvider getProvider(final Integer index) { return (FlatContentProvider) contentProviders[index]; } }; } |
return sessionModel.getArtifactKeys().toArray(new Long[] {}); | final Collection<SystemMessage> messages = systemMessageModel.read(); return messages.toArray(new SystemMessage[] {}); | public Object[] getElements(final Object input) { try { return sessionModel.getArtifactKeys().toArray(new Long[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } |
public Object[] getElements(final Object input) { try { final Collection<SystemMessage> messages = systemMessageModel.read(); return messages.toArray(new SystemMessage[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } | public Object[] getElements(final Integer index, final Object input) { Assert.assertNotNull("Index cannot be null.", index); Assert.assertTrue( "Index must lie within [0," + (contentProviders.length - 1) + "]", index >= 0 && index < contentProviders.length); return ((FlatContentProvider) getProvider(index)).getElements(input); | public Object[] getElements(final Object input) { try { final Collection<SystemMessage> messages = systemMessageModel.read(); return messages.toArray(new SystemMessage[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } |
public Object[] getElements(final Integer index, final Object input) { Assert.assertNotNull("Index cannot be null.", index); Assert.assertTrue( "Index must lie within [0," + (contentProviders.length - 1) + "]", index >= 0 && index < contentProviders.length); return ((FlatContentProvider) getProvider(index)).getElements(input); | public Object[] getElements(final Object input) { List<Contact> roster; try { roster = sessionModel.readContacts(); final Contact[] team = (Contact[]) input; if(null != team) { for(final Contact contact : team) roster.remove(contact); } } catch(final ParityException px) { throw new RuntimeException(px); } return roster.toArray(new Contact[] {}); | public Object[] getElements(final Integer index, final Object input) { Assert.assertNotNull("Index cannot be null.", index); Assert.assertTrue( "Index must lie within [0," + (contentProviders.length - 1) + "]", index >= 0 && index < contentProviders.length); return ((FlatContentProvider) getProvider(index)).getElements(input); } |
List<Contact> roster; | Assert.assertNotNull( "The team provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The team provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; List<Contact> artifactContacts; | public Object[] getElements(final Object input) { List<Contact> roster; try { roster = sessionModel.readContacts(); // remove all team members from the roster list final Contact[] team = (Contact[]) input; if(null != team) { for(final Contact contact : team) roster.remove(contact); } } catch(final ParityException px) { throw new RuntimeException(px); } return roster.toArray(new Contact[] {}); } |
roster = sessionModel.readContacts(); final Contact[] team = (Contact[]) input; if(null != team) { for(final Contact contact : team) roster.remove(contact); | artifactContacts = sessionModel.readArtifactContacts(artifactId); Contact contact; for(final Iterator<Contact> i = artifactContacts.iterator(); i.hasNext();) { contact= i.next(); if(contact.getId().equals(jabberId)) { i.remove(); } | public Object[] getElements(final Object input) { List<Contact> roster; try { roster = sessionModel.readContacts(); // remove all team members from the roster list final Contact[] team = (Contact[]) input; if(null != team) { for(final Contact contact : team) roster.remove(contact); } } catch(final ParityException px) { throw new RuntimeException(px); } return roster.toArray(new Contact[] {}); } |
return roster.toArray(new Contact[] {}); | public Object[] getElements(final Object input) { List<Contact> roster; try { roster = sessionModel.readContacts(); // remove all team members from the roster list final Contact[] team = (Contact[]) input; if(null != team) { for(final Contact contact : team) roster.remove(contact); } } catch(final ParityException px) { throw new RuntimeException(px); } return roster.toArray(new Contact[] {}); } |
|
"The team provider requires an artifact id: java.lang.Long.", | "The send artifact version provider requires an artifact id: java.lang.Long.", | public Object[] getElements(final Object input) { Assert.assertNotNull( "The team provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The team provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; List<Contact> artifactContacts; try { artifactContacts = sessionModel.readArtifactContacts(artifactId); Contact contact; for(final Iterator<Contact> i = artifactContacts.iterator(); i.hasNext();) { contact= i.next(); if(contact.getId().equals(jabberId)) { i.remove(); } } return artifactContacts.toArray(new Contact[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } |
List<Contact> artifactContacts; | final List<DocumentVersion> versions = new LinkedList<DocumentVersion>(); | public Object[] getElements(final Object input) { Assert.assertNotNull( "The team provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The team provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; List<Contact> artifactContacts; try { artifactContacts = sessionModel.readArtifactContacts(artifactId); Contact contact; for(final Iterator<Contact> i = artifactContacts.iterator(); i.hasNext();) { contact= i.next(); if(contact.getId().equals(jabberId)) { i.remove(); } } return artifactContacts.toArray(new Contact[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } |
artifactContacts = sessionModel.readArtifactContacts(artifactId); Contact contact; for(final Iterator<Contact> i = artifactContacts.iterator(); i.hasNext();) { contact= i.next(); if(contact.getId().equals(jabberId)) { i.remove(); } | versions.addAll(documentModel.listVersions(artifactId)); if(sessionModel.isLoggedInUserKeyHolder(artifactId)) { versions.add(0, WorkingVersion.getWorkingVersion()); | public Object[] getElements(final Object input) { Assert.assertNotNull( "The team provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The team provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; List<Contact> artifactContacts; try { artifactContacts = sessionModel.readArtifactContacts(artifactId); Contact contact; for(final Iterator<Contact> i = artifactContacts.iterator(); i.hasNext();) { contact= i.next(); if(contact.getId().equals(jabberId)) { i.remove(); } } return artifactContacts.toArray(new Contact[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } |
return artifactContacts.toArray(new Contact[] {}); | return versions.toArray(new DocumentVersion[] {}); | public Object[] getElements(final Object input) { Assert.assertNotNull( "The team provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The team provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; List<Contact> artifactContacts; try { artifactContacts = sessionModel.readArtifactContacts(artifactId); Contact contact; for(final Iterator<Contact> i = artifactContacts.iterator(); i.hasNext();) { contact= i.next(); if(contact.getId().equals(jabberId)) { i.remove(); } } return artifactContacts.toArray(new Contact[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } |
public Object[] getElements(final Object input) { | public Object[] getElements(final Integer index, final Object input) { | public Object[] getElements(final Object input) { Assert.assertNotNull( "The send artifact version provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The send artifact version provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; final List<DocumentVersion> versions = new LinkedList<DocumentVersion>(); try { versions.addAll(documentModel.listVersions(artifactId)); if(sessionModel.isLoggedInUserKeyHolder(artifactId)) { versions.add(0, WorkingVersion.getWorkingVersion()); } return versions.toArray(new DocumentVersion[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } |
"The send artifact version provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The send artifact version provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; final List<DocumentVersion> versions = new LinkedList<DocumentVersion>(); try { versions.addAll(documentModel.listVersions(artifactId)); if(sessionModel.isLoggedInUserKeyHolder(artifactId)) { versions.add(0, WorkingVersion.getWorkingVersion()); } return versions.toArray(new DocumentVersion[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } | "Index for composite content provider cannot be null.", index); Assert.assertTrue( "Index for the send artifact content provider mus lie within [0," + 2 + "]", index >= 0 && index <= 2); return getProvider(index).getElements(input); | public Object[] getElements(final Object input) { Assert.assertNotNull( "The send artifact version provider requires an artifact id: java.lang.Long.", input); Assert.assertOfType( "The send artifact version provider requires an artifact id: java.lang.Long.", Long.class, input); final Long artifactId = (Long) input; final List<DocumentVersion> versions = new LinkedList<DocumentVersion>(); try { versions.addAll(documentModel.listVersions(artifactId)); if(sessionModel.isLoggedInUserKeyHolder(artifactId)) { versions.add(0, WorkingVersion.getWorkingVersion()); } return versions.toArray(new DocumentVersion[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } |
browser.fireDocumentUpdated(e.getDocument().getId()); | browser.fireDocumentUpdated(e.getDocument().getId(), Boolean.TRUE); | private DocumentListener createDocumentListener() { return new DocumentAdapter() { public void confirmationReceived(final DocumentEvent e) { if(e.isRemote()) { browser.fireDocumentConfirmationReceived(e.getDocument().getId()); } } public void documentCreated(final DocumentEvent e) { if(e.isRemote()) { browser.fireDocumentCreated(e.getDocument().getId(), Boolean.TRUE); } } public void documentClosed(final DocumentEvent e) { if(e.isRemote()) { browser.getArtifactModel().removeFlagSeen(e.getDocument().getId()); browser.fireDocumentUpdated(e.getDocument().getId()); } } public void documentUpdated(final DocumentEvent e) { if(e.isRemote()) { browser.fireDocumentUpdated(e.getDocument().getId()); } } }; } |
browser.fireDocumentUpdated(e.getDocument().getId()); | browser.fireDocumentUpdated(e.getDocument().getId(), Boolean.TRUE); | public void documentUpdated(final DocumentEvent e) { if(e.isRemote()) { browser.fireDocumentUpdated(e.getDocument().getId()); } } |
try { return projectXmlIO.list(); } catch(IOException iox) { logger.error("list()", iox); throw ParityErrorTranslator.translate(iox); | try { final Collection<Project> list = new Vector<Project>(2); list.add(getInbox()); list.add(getMyProjects()); return list; | Collection<Project> list() throws ParityException { logger.info("list()"); try { return projectXmlIO.list(); } catch(IOException iox) { logger.error("list()", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("list()", rx); throw ParityErrorTranslator.translate(rx); } } |
Long.valueOf(streamOffset.getValue()), | public void run() { try { final HeaderReader headerReader = new HeaderReader(); final StreamHeader sessionId = headerReader.readNext(); if (null != sessionId) { final StreamSession streamSession = streamServer.authenticate(sessionId.getValue(), ((InetSocketAddress) socket.getRemoteSocketAddress()).getAddress()); final StreamHeader sessionType = headerReader.readNext(); final StreamHeader streamId = headerReader.readNext(); final StreamHeader streamOffset = headerReader.readNext(); if(null != streamSession) { if ("UPSTREAM".equals(sessionType.getValue())) { final StreamHeader streamSize = headerReader.readNext(); new UpstreamHandler(streamServer, streamSession, streamId.getValue(), Long.valueOf(streamSize.getValue()), Long.valueOf(streamOffset.getValue()), socket.getInputStream()).run(); } else if ("DOWNSTREAM".equals(sessionType.getValue())) { new DownstreamHandler(streamServer, streamSession, streamId.getValue(), streamServer.getSize(streamSession, streamId.getValue()), Long.valueOf(streamOffset.getValue()), socket.getOutputStream()).run(); } else { Assert.assertUnreachable("Unkown stream transfer."); } } } } catch (final IOException iox) { throw new StreamException(iox); } finally { try { socket.close(); } catch (final IOException iox2) { logger.logError(iox2, "Could not close client socket."); } } } |
|
public String getSystemUsername() { return "system"; } | public String getSystemUsername() { return new StringBuffer("system@") .append(getServerHost()).toString(); } | Preferences getPreferences() { final Properties javaProperties = loadPreferences(); // save the preferences on shutdown Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { storePreferences(javaProperties); } }); return new Preferences() { public Locale getLocale() { return Locale.getDefault(); } public String getServerHost() { final String override = System.getProperty("parity.serverhost"); if(null != override && 0 < override.length()) { return override; } else { return "thinkparity.dyndns.org"; } } public Integer getServerPort() { final Integer override = Integer.getInteger("parity.serverport"); if(null != override) { return override; } else { if(Boolean.getBoolean("parity.insecure")) { return 5222; } else { return 5223; } } } public String getSystemUsername() { return "system"; } public String getUsername() { return javaProperties.getProperty("parity.username", null); } public Boolean isSetLocale() { return Boolean.TRUE; } public Boolean isSetUsername() { final String username = getUsername(); return (null != username && 0 < username.length()); } public void setLocale(Locale locale) { // TODO Auto-generated method stub } public void setUsername(final String username) { javaProperties.setProperty("parity.username", username); } }; } |
public String getSystemUsername() { return "system"; } | public String getSystemUsername() { return new StringBuffer("system@") .append(getServerHost()).toString(); } | public String getSystemUsername() { return "system"; } |
loginAvatar = new LoginAvatar(this); openWindow(loginAvatar); | final LoginWindow window = new LoginWindow(); window.setVisibleAndWait(); | public void firstRun() { loginAvatar = new LoginAvatar(this); openWindow(loginAvatar); final String username = loginAvatar.getUsername(); final String password = loginAvatar.getPassword(); if(null != username && null != password) { final Credentials credentials = new Credentials(); credentials.setPassword(password); credentials.setUsername(username); workspaceModel.initialize(workspace, new LoginMonitor() { public Boolean confirmSynchronize() { final ConfirmSynchronize confirmSynchronize = new ConfirmSynchronize(); openWindow(confirmSynchronize); return confirmSynchronize.didConfirm(); } public void notifyInvalidCredentials(final Credentials credentials) { } }, credentials); } } |
final String username = loginAvatar.getUsername(); final String password = loginAvatar.getPassword(); | final String username = window.getUsername(); final String password = window.getPassword(); | public void firstRun() { loginAvatar = new LoginAvatar(this); openWindow(loginAvatar); final String username = loginAvatar.getUsername(); final String password = loginAvatar.getPassword(); if(null != username && null != password) { final Credentials credentials = new Credentials(); credentials.setPassword(password); credentials.setUsername(username); workspaceModel.initialize(workspace, new LoginMonitor() { public Boolean confirmSynchronize() { final ConfirmSynchronize confirmSynchronize = new ConfirmSynchronize(); openWindow(confirmSynchronize); return confirmSynchronize.didConfirm(); } public void notifyInvalidCredentials(final Credentials credentials) { } }, credentials); } } |
final ConfirmSynchronize confirmSynchronize = new ConfirmSynchronize(); openWindow(confirmSynchronize); return confirmSynchronize.didConfirm(); | final ConfirmSynchronizeWindow confirmWindow = new ConfirmSynchronizeWindow(); confirmWindow.setVisibleAndWait(); return confirmWindow.didConfirm(); | public void firstRun() { loginAvatar = new LoginAvatar(this); openWindow(loginAvatar); final String username = loginAvatar.getUsername(); final String password = loginAvatar.getPassword(); if(null != username && null != password) { final Credentials credentials = new Credentials(); credentials.setPassword(password); credentials.setUsername(username); workspaceModel.initialize(workspace, new LoginMonitor() { public Boolean confirmSynchronize() { final ConfirmSynchronize confirmSynchronize = new ConfirmSynchronize(); openWindow(confirmSynchronize); return confirmSynchronize.didConfirm(); } public void notifyInvalidCredentials(final Credentials credentials) { } }, credentials); } } |
private static final long serialVersionUID = 1; | public ErrorAvatar() { super("ErrorDialog", BrowserConstants.DIALOGUE_BACKGROUND); bindEscapeKey("Cancel", new AbstractAction() { /** @see java.io.Serializable */ private static final long serialVersionUID = 1; /** * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(final ActionEvent e) { disposeWindow(); } }); initComponents(); } |
|
javax.swing.JScrollPane errorJScrollPane; | private void initComponents() { javax.swing.JButton closeJButton; javax.swing.JScrollPane errorJScrollPane; closeJButton = new javax.swing.JButton(); errorMessageJLabel = new javax.swing.JLabel(); errorJScrollPane = new javax.swing.JScrollPane(); errorJTextArea = new javax.swing.JTextArea(); closeJButton.setText(java.util.ResourceBundle.getBundle("com/thinkparity/browser/platform/util/l10n/JPanel_Messages").getString("ErrorDialog.Ok")); closeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } }); errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .addContainerGap(303, Short.MAX_VALUE) .add(closeJButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeJButton) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
|
closeJButton = new javax.swing.JButton(); | private void initComponents() { javax.swing.JButton closeJButton; javax.swing.JScrollPane errorJScrollPane; closeJButton = new javax.swing.JButton(); errorMessageJLabel = new javax.swing.JLabel(); errorJScrollPane = new javax.swing.JScrollPane(); errorJTextArea = new javax.swing.JTextArea(); closeJButton.setText(java.util.ResourceBundle.getBundle("com/thinkparity/browser/platform/util/l10n/JPanel_Messages").getString("ErrorDialog.Ok")); closeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } }); errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .addContainerGap(303, Short.MAX_VALUE) .add(closeJButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeJButton) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
|
errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); | private void initComponents() { javax.swing.JButton closeJButton; javax.swing.JScrollPane errorJScrollPane; closeJButton = new javax.swing.JButton(); errorMessageJLabel = new javax.swing.JLabel(); errorJScrollPane = new javax.swing.JScrollPane(); errorJTextArea = new javax.swing.JTextArea(); closeJButton.setText(java.util.ResourceBundle.getBundle("com/thinkparity/browser/platform/util/l10n/JPanel_Messages").getString("ErrorDialog.Ok")); closeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } }); errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .addContainerGap(303, Short.MAX_VALUE) .add(closeJButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeJButton) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
|
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) | .add(org.jdesktop.layout.GroupLayout.LEADING, errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 372, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 372, Short.MAX_VALUE) | private void initComponents() { javax.swing.JButton closeJButton; javax.swing.JScrollPane errorJScrollPane; closeJButton = new javax.swing.JButton(); errorMessageJLabel = new javax.swing.JLabel(); errorJScrollPane = new javax.swing.JScrollPane(); errorJTextArea = new javax.swing.JTextArea(); closeJButton.setText(java.util.ResourceBundle.getBundle("com/thinkparity/browser/platform/util/l10n/JPanel_Messages").getString("ErrorDialog.Ok")); closeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } }); errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .addContainerGap(303, Short.MAX_VALUE) .add(closeJButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeJButton) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
.addContainerGap(303, Short.MAX_VALUE) | .add(copyDetailsJButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 220, Short.MAX_VALUE) | private void initComponents() { javax.swing.JButton closeJButton; javax.swing.JScrollPane errorJScrollPane; closeJButton = new javax.swing.JButton(); errorMessageJLabel = new javax.swing.JLabel(); errorJScrollPane = new javax.swing.JScrollPane(); errorJTextArea = new javax.swing.JTextArea(); closeJButton.setText(java.util.ResourceBundle.getBundle("com/thinkparity/browser/platform/util/l10n/JPanel_Messages").getString("ErrorDialog.Ok")); closeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } }); errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .addContainerGap(303, Short.MAX_VALUE) .add(closeJButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeJButton) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
.add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) | .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 49, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) | private void initComponents() { javax.swing.JButton closeJButton; javax.swing.JScrollPane errorJScrollPane; closeJButton = new javax.swing.JButton(); errorMessageJLabel = new javax.swing.JLabel(); errorJScrollPane = new javax.swing.JScrollPane(); errorJTextArea = new javax.swing.JTextArea(); closeJButton.setText(java.util.ResourceBundle.getBundle("com/thinkparity/browser/platform/util/l10n/JPanel_Messages").getString("ErrorDialog.Ok")); closeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } }); errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .addContainerGap(303, Short.MAX_VALUE) .add(closeJButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeJButton) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
.add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) | .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) | private void initComponents() { javax.swing.JButton closeJButton; javax.swing.JScrollPane errorJScrollPane; closeJButton = new javax.swing.JButton(); errorMessageJLabel = new javax.swing.JLabel(); errorJScrollPane = new javax.swing.JScrollPane(); errorJTextArea = new javax.swing.JTextArea(); closeJButton.setText(java.util.ResourceBundle.getBundle("com/thinkparity/browser/platform/util/l10n/JPanel_Messages").getString("ErrorDialog.Ok")); closeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } }); errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .addContainerGap(303, Short.MAX_VALUE) .add(closeJButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeJButton) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
.add(closeJButton) | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(closeJButton) .add(copyDetailsJButton)) | private void initComponents() { javax.swing.JButton closeJButton; javax.swing.JScrollPane errorJScrollPane; closeJButton = new javax.swing.JButton(); errorMessageJLabel = new javax.swing.JLabel(); errorJScrollPane = new javax.swing.JScrollPane(); errorJTextArea = new javax.swing.JTextArea(); closeJButton.setText(java.util.ResourceBundle.getBundle("com/thinkparity/browser/platform/util/l10n/JPanel_Messages").getString("ErrorDialog.Ok")); closeJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } }); errorJTextArea.setColumns(20); errorJTextArea.setRows(5); errorJScrollPane.setViewportView(errorJTextArea); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .addContainerGap(303, Short.MAX_VALUE) .add(closeJButton))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(errorMessageJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(errorJScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeJButton) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
closeJButtonActionPerformed(e); | copyDetailsJButtonActionPerformed(e); | public void actionPerformed(java.awt.event.ActionEvent e) { closeJButtonActionPerformed(e); } |
if(null != error) { errorJTextArea.setText(error); } | if (null != error) { errorJScrollPane.setVisible(true); copyDetailsJButton.setVisible(true); errorJTextArea.setText(error); errorJTextArea.setCaretPosition(0); } else { errorJScrollPane.setVisible(false); copyDetailsJButton.setVisible(false); } | private void reloadError() { errorJTextArea.setText(""); final String error = readInputError(); if(null != error) { errorJTextArea.setText(error); } } |
super(workspace, L18nContext.DOCUMENT); | super(workspace); | DocumentModelImpl(final Workspace workspace) { super(workspace, L18nContext.DOCUMENT); final ComparatorBuilder comparatorBuilder = new ComparatorBuilder(); this.auditor = new DocumentModelAuditor(getContext()); this.defaultComparator = comparatorBuilder.createByName(Boolean.TRUE); this.defaultHistoryComparator = new ComparatorBuilder().createIdDescending(); this.defaultHistoryFilter = new DefaultFilter(); this.defaultVersionComparator = comparatorBuilder.createVersionById(Boolean.TRUE); this.documentIO = IOFactory.getDefault().createDocumentHandler(); this.indexor = new DocumentIndexor(getContext()); this.localEventGen = new DocumentModelEventGenerator(DocumentEvent.Source.LOCAL); this.remoteEventGen = new DocumentModelEventGenerator(DocumentEvent.Source.REMOTE); } |
modifyDocument(OpheliaTestUser.JUNIT, document); | modifyDocument(OpheliaTestUser.JUNIT, document.getId()); | protected void setUp() throws Exception { super.setUp(); final InternalContainerModel containerModel = getContainerModel(OpheliaTestUser.JUNIT); final Container container = createContainer(OpheliaTestUser.JUNIT, NAME); final Document document = addDocument(OpheliaTestUser.JUNIT, container, getInputFiles()[0]); modifyDocument(OpheliaTestUser.JUNIT, document); datum = new Fixture(container, containerModel, document); datum.containerModel.addListener(datum); } |
final JabberId userId = JabberIdBuilder.build( credentials.getUsername(), Constants.Jabber.DOMAIN, credentials.getResource()); session.processEventQueue(userId); | private void processOfflineQueue() { assertIsReachable(environment); XMPPSession session = null; try { session = new XMPPSessionImpl(); session.login(environment, credentials); final JabberId userId = JabberIdBuilder.build( credentials.getUsername(), Constants.Jabber.DOMAIN, credentials.getResource()); session.processEventQueue(userId); } finally { Assert.assertNotNull(session, "User {0}'s session is null.", credentials.getUsername()); Assert.assertTrue(session.isLoggedIn(), "User {0} not logged in.", credentials.getUsername()); session.logout(); } } |
|
private Fixture(final Document d, final DocumentModel dModel, final Integer hitsExpectedSize, final IndexModel iModel) { this.d = d; | private Fixture(final String criteria, final DocumentModel dModel, final IndexModel iModel) { this.criteria = criteria; | private Fixture(final Document d, final DocumentModel dModel, final Integer hitsExpectedSize, final IndexModel iModel) { this.d = d; this.dModel = dModel; this.hitsExpectedSize = hitsExpectedSize; this.iModel = iModel; } |
this.hitsExpectedSize = hitsExpectedSize; | private Fixture(final Document d, final DocumentModel dModel, final Integer hitsExpectedSize, final IndexModel iModel) { this.d = d; this.dModel = dModel; this.hitsExpectedSize = hitsExpectedSize; this.iModel = iModel; } |
|
Document d; | protected void setUp() throws Exception { super.setUp(); final DocumentModel dModel = getDocumentModel(); final IndexModel iModel = getIndexModel(); data = new LinkedList<Fixture>(); Document d; for(final File inputFile : getInputFiles()) { d = dModel.create(inputFile.getName(), inputFile.getName(), inputFile); data.add(new Fixture(d, dModel, 1, iModel)); } } |
|
d = dModel.create(inputFile.getName(), inputFile.getName(), inputFile); data.add(new Fixture(d, dModel, 1, iModel)); | dModel.create(inputFile.getName(), inputFile.getName(), inputFile); data.add(new Fixture("JUnit", dModel, iModel)); | protected void setUp() throws Exception { super.setUp(); final DocumentModel dModel = getDocumentModel(); final IndexModel iModel = getIndexModel(); data = new LinkedList<Fixture>(); Document d; for(final File inputFile : getInputFiles()) { d = dModel.create(inputFile.getName(), inputFile.getName(), inputFile); data.add(new Fixture(d, dModel, 1, iModel)); } } |
indexHits = datum.iModel.search(datum.d.getName()); | indexHits = datum.iModel.search(datum.criteria); | public void testSearch() { try { List<IndexHit> indexHits; for(final Fixture datum : data) { indexHits = datum.iModel.search(datum.d.getName()); assertNotNull("Index hits is null.", indexHits); Document searchHit; for(final IndexHit indexHit : indexHits) { searchHit = datum.dModel.get(indexHit.getId()); assertEquals(searchHit.getName(), datum.d.getName()); } } } catch(final Throwable t) { fail(createFailMessage(t)); } } |
assertEquals(searchHit.getName(), datum.d.getName()); | assertTrue(searchHit.getName().contains(datum.criteria)); | public void testSearch() { try { List<IndexHit> indexHits; for(final Fixture datum : data) { indexHits = datum.iModel.search(datum.d.getName()); assertNotNull("Index hits is null.", indexHits); Document searchHit; for(final IndexHit indexHit : indexHits) { searchHit = datum.dModel.get(indexHit.getId()); assertEquals(searchHit.getName(), datum.d.getName()); } } } catch(final Throwable t) { fail(createFailMessage(t)); } } |
void setValueFactory(ValueFactory valueFactory) | public void setValueFactory(ValueFactory valueFactory) | void setValueFactory(ValueFactory valueFactory) { this.valueFactory = valueFactory; } |
String pathname = servletContext.getRealPath(toolboxFile); | String uniqueKey = servletContext.hashCode() + ':' + toolboxFile; | public static synchronized ServletToolboxManager getInstance(ServletContext servletContext, String toolboxFile) { // little fix up if (!toolboxFile.startsWith("/")) { toolboxFile = "/" + toolboxFile; } // get config file pathname String pathname = servletContext.getRealPath(toolboxFile); // check if a previous instance exists ServletToolboxManager toolboxManager = (ServletToolboxManager)managersMap.get(pathname); if (toolboxManager == null) { // if not, build one InputStream is = null; try { // get the bits is = servletContext.getResourceAsStream(toolboxFile); if (is != null) { LOG.info("Using config file '" + toolboxFile +"'"); toolboxManager = new ServletToolboxManager(servletContext); toolboxManager.load(is); // remember it managersMap.put(pathname, toolboxManager); LOG.info("Toolbox setup complete."); } } catch(Exception e) { LOG.error("Problem loading toolbox '" + toolboxFile +"' : " + e); // if this happens, it probably deserves // to have the stack trace logged StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); LOG.error(sw.toString()); } finally { try { if (is != null) { is.close(); } } catch(Exception ee) {} } } return toolboxManager; } |
(ServletToolboxManager)managersMap.get(pathname); | (ServletToolboxManager)managersMap.get(uniqueKey); | public static synchronized ServletToolboxManager getInstance(ServletContext servletContext, String toolboxFile) { // little fix up if (!toolboxFile.startsWith("/")) { toolboxFile = "/" + toolboxFile; } // get config file pathname String pathname = servletContext.getRealPath(toolboxFile); // check if a previous instance exists ServletToolboxManager toolboxManager = (ServletToolboxManager)managersMap.get(pathname); if (toolboxManager == null) { // if not, build one InputStream is = null; try { // get the bits is = servletContext.getResourceAsStream(toolboxFile); if (is != null) { LOG.info("Using config file '" + toolboxFile +"'"); toolboxManager = new ServletToolboxManager(servletContext); toolboxManager.load(is); // remember it managersMap.put(pathname, toolboxManager); LOG.info("Toolbox setup complete."); } } catch(Exception e) { LOG.error("Problem loading toolbox '" + toolboxFile +"' : " + e); // if this happens, it probably deserves // to have the stack trace logged StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); LOG.error(sw.toString()); } finally { try { if (is != null) { is.close(); } } catch(Exception ee) {} } } return toolboxManager; } |
managersMap.put(pathname, toolboxManager); | managersMap.put(uniqueKey, toolboxManager); | public static synchronized ServletToolboxManager getInstance(ServletContext servletContext, String toolboxFile) { // little fix up if (!toolboxFile.startsWith("/")) { toolboxFile = "/" + toolboxFile; } // get config file pathname String pathname = servletContext.getRealPath(toolboxFile); // check if a previous instance exists ServletToolboxManager toolboxManager = (ServletToolboxManager)managersMap.get(pathname); if (toolboxManager == null) { // if not, build one InputStream is = null; try { // get the bits is = servletContext.getResourceAsStream(toolboxFile); if (is != null) { LOG.info("Using config file '" + toolboxFile +"'"); toolboxManager = new ServletToolboxManager(servletContext); toolboxManager.load(is); // remember it managersMap.put(pathname, toolboxManager); LOG.info("Toolbox setup complete."); } } catch(Exception e) { LOG.error("Problem loading toolbox '" + toolboxFile +"' : " + e); // if this happens, it probably deserves // to have the stack trace logged StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); LOG.error(sw.toString()); } finally { try { if (is != null) { is.close(); } } catch(Exception ee) {} } } return toolboxManager; } |
setBorder(cell.getBorder()); | public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final MainCell cell = (MainCell) value; remove(paddingJLabel); final GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(0, Math.round(PADDING_INSET_LEFT * cell.getTextInsetFactor()), 0, 0); add(paddingJLabel, gridBagConstraints); if(isSelected) { background = cell.getBackgroundSelected(); nodeIconJLabel.setIcon(cell.getNodeIconSelected()); } else { background = cell.getBackground(); nodeIconJLabel.setIcon(cell.getNodeIcon()); } setBorder(cell.getBorder()); textJLabel.setFont(cell.getTextFont()); textJLabel.setForeground(cell.getTextForeground()); textJLabel.setText(cell.getText()); setToolTipText(cell.getToolTip()); infoIconJLabel.setIcon(cell.getInfoIcon()); revalidate(); repaint(); return this; } |
|
containerPanel.setExpanded(expanded); | private void doToggleExpansion(final TabPanel tabPanel) { final ContainerPanel containerPanel = (ContainerPanel) tabPanel; final Boolean expanded; if (isExpanded(containerPanel)) { expanded = Boolean.FALSE; } else { // NOTE-BEGIN:multi-expand to allow multiple selection in the list; remove here for (final TabPanel visiblePanel : visiblePanels) { if (isExpanded(visiblePanel)) { doToggleExpansion(visiblePanel); } } // NOTE-END:multi-expand expanded = Boolean.TRUE; browser.runApplyContainerFlagSeen( containerPanel.getContainer().getId()); } containerPanel.setExpanded(expanded); expandedState.put(tabPanel, expanded); } |
|
final StreamSession streamSession = streamModel.createSession(userId); final StreamWriter writer = new StreamWriter(streamSession); writer.open(); try { writer.write(streamId, stream, streamSize); } finally { try { stream.close(); } finally { writer.close(); | final StreamSession streamSession = streamModel.createArchiveSession(archiveId); uploadStream(new UploadMonitor() { public void chunkUploaded(final int chunkSize) { logger.logApiId(); logger.logVariable("chunkSize", chunkSize); | void createStream(final JabberId userId, final String streamId, final UUID uniqueId, final Long versionId) { logApiId(); logVariable("userId", userId); logVariable("streamId", streamId); logVariable("uniqueId", uniqueId); logVariable("versionId", versionId); try { assertIsAuthenticatedUser(userId); final JabberId archiveId = readArchiveId(userId); if (null == archiveId) { logWarning("No archive exists for user {0}.", userId); } else { final ClientModelFactory modelFactory = getModelFactory(archiveId); final InternalArtifactModel artifactModel = modelFactory.getArtifactModel(getClass()); final InternalDocumentModel documentModel = modelFactory.getDocumentModel(getClass()); final Long documentId = artifactModel.readId(uniqueId); final InputStream stream = documentModel.openVersionStream(documentId, versionId); final Long streamSize = documentModel.readVersionSize(documentId, versionId); final InternalStreamModel streamModel = getStreamModel(); final StreamSession streamSession = streamModel.createSession(userId); final StreamWriter writer = new StreamWriter(streamSession); writer.open(); try { writer.write(streamId, stream, streamSize); } finally { try { stream.close(); } finally { writer.close(); } } } } catch (final Throwable t) { throw translateError(t); } } |
} | }, streamId, streamSession, stream, streamSize); | void createStream(final JabberId userId, final String streamId, final UUID uniqueId, final Long versionId) { logApiId(); logVariable("userId", userId); logVariable("streamId", streamId); logVariable("uniqueId", uniqueId); logVariable("versionId", versionId); try { assertIsAuthenticatedUser(userId); final JabberId archiveId = readArchiveId(userId); if (null == archiveId) { logWarning("No archive exists for user {0}.", userId); } else { final ClientModelFactory modelFactory = getModelFactory(archiveId); final InternalArtifactModel artifactModel = modelFactory.getArtifactModel(getClass()); final InternalDocumentModel documentModel = modelFactory.getDocumentModel(getClass()); final Long documentId = artifactModel.readId(uniqueId); final InputStream stream = documentModel.openVersionStream(documentId, versionId); final Long streamSize = documentModel.readVersionSize(documentId, versionId); final InternalStreamModel streamModel = getStreamModel(); final StreamSession streamSession = streamModel.createSession(userId); final StreamWriter writer = new StreamWriter(streamSession); writer.open(); try { writer.write(streamId, stream, streamSize); } finally { try { stream.close(); } finally { writer.close(); } } } } catch (final Throwable t) { throw translateError(t); } } |
return InsetFactors.LEVEL_2; | return InsetFactors.LEVEL_3; | public Float getTextInsetFactor() { return InsetFactors.LEVEL_2; } |
if(jList.isSelectionEmpty()) { if(!jListModel.isEmpty()) { jList.setSelectedIndex(0); } } | private void reloadDocuments(final Long documentId) { // TODO Maintain the document selection final DisplayDocument[] displayDocuments = getDisplayDocuments(); int index = 0; for(final DisplayDocument displayDocument : displayDocuments) { jListModel.addElement(DocumentListItem.create(displayDocument)); if(displayDocument.getDocumentId().equals(documentId)) { jList.setSelectedIndex(index); } index++; } } |
|
private Fixture(final String description, final File file, final String documentContentChecksum, final DocumentModel documentModel, final String name) { | private Fixture(final String description, final File file, final String documentContentChecksum, final DocumentModel documentModel, final int expectedVersionsSize, final String name) { | private Fixture(final String description, final File file, final String documentContentChecksum, final DocumentModel documentModel, final String name) { this.description = description; this.file = file; this.documentContentChecksum = documentContentChecksum; this.documentModel = documentModel; this.name = name; } |
this.expectedVersionsSize = expectedVersionsSize; | private Fixture(final String description, final File file, final String documentContentChecksum, final DocumentModel documentModel, final String name) { this.description = description; this.file = file; this.documentContentChecksum = documentContentChecksum; this.documentModel = documentModel; this.name = name; } |
|
documentContentChecksum, documentModel, name)); | documentContentChecksum, documentModel, 0, name)); | protected void setUp() throws Exception { super.setUp(); final DocumentModel documentModel = getDocumentModel(); data = new Vector<Fixture>(4); String name, description; String documentContentChecksum; for(File testFile : getInputFiles()) { name = testFile.getName(); description = name; documentContentChecksum = MD5Util.md5Hex(FileUtil.readBytes(testFile)); data.add(new Fixture(description, testFile, documentContentChecksum, documentModel, name)); } } |
DocumentVersion version; DocumentVersionContent versionContent; DocumentContent versionContentSnapshot; | Collection<DocumentVersion> versions; | public void testCreate() { try { Document document; DocumentContent content; DocumentVersion version; DocumentVersionContent versionContent; DocumentContent versionContentSnapshot; for(Fixture datum : data) { document = datum.documentModel.create(datum.name, datum.description, datum.file); assertNotNull(document); content = datum.documentModel.getContent(document.getId()); assertNotNull(content); assertEquals(content.getChecksum(), datum.documentContentChecksum); version = datum.documentModel.listVersions(document.getId()).iterator().next(); assertNotNull(version); assertEquals(version.getArtifactId(), document.getId()); assertEquals(version.getArtifactUniqueId(), document.getUniqueId()); versionContent = datum.documentModel.getVersionContent(document.getId(), version.getVersionId()); versionContentSnapshot = versionContent.getDocumentContent(); assertNotNull(versionContent); assertEquals(versionContentSnapshot, content); } } catch(final Throwable t) { fail(createFailMessage(t)); } } |
version = datum.documentModel.listVersions(document.getId()).iterator().next(); assertNotNull(version); assertEquals(version.getArtifactId(), document.getId()); assertEquals(version.getArtifactUniqueId(), document.getUniqueId()); versionContent = datum.documentModel.getVersionContent(document.getId(), version.getVersionId()); versionContentSnapshot = versionContent.getDocumentContent(); assertNotNull(versionContent); assertEquals(versionContentSnapshot, content); | versions = datum.documentModel.listVersions(document.getId()); assertNotNull(versions); assertEquals("Number of versions does not match expectation.", datum.expectedVersionsSize, versions.size()); | public void testCreate() { try { Document document; DocumentContent content; DocumentVersion version; DocumentVersionContent versionContent; DocumentContent versionContentSnapshot; for(Fixture datum : data) { document = datum.documentModel.create(datum.name, datum.description, datum.file); assertNotNull(document); content = datum.documentModel.getContent(document.getId()); assertNotNull(content); assertEquals(content.getChecksum(), datum.documentContentChecksum); version = datum.documentModel.listVersions(document.getId()).iterator().next(); assertNotNull(version); assertEquals(version.getArtifactId(), document.getId()); assertEquals(version.getArtifactUniqueId(), document.getUniqueId()); versionContent = datum.documentModel.getVersionContent(document.getId(), version.getVersionId()); versionContentSnapshot = versionContent.getDocumentContent(); assertNotNull(versionContent); assertEquals(versionContentSnapshot, content); } } catch(final Throwable t) { fail(createFailMessage(t)); } } |
protected void backup(final JabberId userId) { | private void backup(final JabberId userId, final IQ query) { final JabberId archiveId = getUserModel().readArchiveId(userId); if (null != archiveId) { query.setTo(getJID(archiveId)); enqueue(archiveId, query); if (isOnline(archiveId)) { sendQueueUpdated(archiveId); } else { logWarning(MessageFormat.format("Archive {0} not online.", archiveId)); } } | protected void backup(final JabberId userId) { } |
boolean success = Velocity.evaluate(ctx, sw, LOG_TAG, vtl); | boolean success; if (engine == null) { success = Velocity.evaluate(ctx, sw, LOG_TAG, vtl); } else { success = engine.evaluate(ctx, sw, LOG_TAG, vtl); } | public String eval(Context ctx, String vtl) throws Exception { /* don't waste time with null or empty strings */ if (vtl == null || vtl.length() == 0) { return null; } StringWriter sw = new StringWriter(); boolean success = Velocity.evaluate(ctx, sw, LOG_TAG, vtl); if (success) { return sw.toString(); } /* or would it be preferable to return the original? */ return null; } |
final UUID uniqueId = getInternalArtifactModel().readUniqueId(artifactId); | final UUID uniqueId = getArtifactModel().readUniqueId(artifactId); | void archive(final Long artifactId) { logger.logApiId(); logger.logVariable("artifactId", artifactId); try { assertArchiveOnline(); final UUID uniqueId = getInternalArtifactModel().readUniqueId(artifactId); getSessionModel().archiveArtifact(localUserId(), uniqueId); } catch (final Throwable t) { throw translateError(t); } } |
if (null != getInternalArtifactModel().readId(uniqueId)) { | if (null != getArtifactModel().readId(uniqueId)) { | Container readContainer(final UUID uniqueId) { logger.logApiId(); logger.logVariable("uniqueId", uniqueId); try { assertArchiveOnline(); // HACK A quck'n'dirty check to see if the container exists locally if (null != getInternalArtifactModel().readId(uniqueId)) { return null; } else { return getSessionModel().readArchiveContainer( localUserId(), uniqueId); } } catch (final Throwable t) { throw translateError(t); } } |
final Long versionId, final UUID documentUniqueId) { | final Long versionId) { | List<DocumentVersion> readDocumentVersions(final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { logger.logApiId(); logger.logVariable("uniqueId", uniqueId); logger.logVariable("versionId", versionId); logger.logVariable("documentUniqueId", documentUniqueId); return readDocumentVersions(uniqueId, versionId, documentUniqueId, defaultVersionComparator, defaultVersionFilter); } |
logger.logVariable("documentUniqueId", documentUniqueId); return readDocumentVersions(uniqueId, versionId, documentUniqueId, | return readDocumentVersions(uniqueId, versionId, | List<DocumentVersion> readDocumentVersions(final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { logger.logApiId(); logger.logVariable("uniqueId", uniqueId); logger.logVariable("versionId", versionId); logger.logVariable("documentUniqueId", documentUniqueId); return readDocumentVersions(uniqueId, versionId, documentUniqueId, defaultVersionComparator, defaultVersionFilter); } |
new StreamSocketDelegate(streamServer, clientSocket).run(); | new Thread(new StreamSocketDelegate(streamServer, clientSocket), clientSocket.getRemoteSocketAddress().toString()).start(); | public void run() { logger.logApiId(); logger.logVariable("run", run); try { while (run) { started = true; synchronized (this) { notifyAll(); } final Socket clientSocket = serverSocket.accept(); logger.logTrace("Socket connected."); try { new StreamSocketDelegate(streamServer, clientSocket).run(); } catch (final Throwable t) { logger.logError(t, "Failed to negotiate stream {0}.", clientSocket.getRemoteSocketAddress()); } finally { clientSocket.close(); } logger.logTrace("Socket handler executed."); } } catch (final Throwable t) { logger.logFatal(t, "Fatal stream socket server error."); } } |
} finally { clientSocket.close(); | public void run() { logger.logApiId(); logger.logVariable("run", run); try { while (run) { started = true; synchronized (this) { notifyAll(); } final Socket clientSocket = serverSocket.accept(); logger.logTrace("Socket connected."); try { new StreamSocketDelegate(streamServer, clientSocket).run(); } catch (final Throwable t) { logger.logError(t, "Failed to negotiate stream {0}.", clientSocket.getRemoteSocketAddress()); } finally { clientSocket.close(); } logger.logTrace("Socket handler executed."); } } catch (final Throwable t) { logger.logFatal(t, "Fatal stream socket server error."); } } |
|
if(isKeyHolder(documentId)) { if(isClosed(document)) { deleteLocal(document); } else if(!isDistributed(documentId)) { deleteLocal(document); } else { throw Assert.createUnreachable( "[LMODEL] [DOCUMENT MODEL] [DELETE] [CANNOT DELETE DOCUMENT UNTIL IT HAS BEEN CLOSED]"); | if(isClosed(document)) { deleteLocal(document); } else { if(isKeyHolder(documentId)) { if(!isDistributed(documentId)) { deleteLocal(document); } else { throw Assert.createUnreachable( "[LMODEL] [DOCUMENT] [DELETE] [CAN ONLY DELETE CLOSED DOCUMENTS IF YOU ARE THE KEY HOLDER]"); } | void delete(final Long documentId) throws ParityException { logger.info("[LMODEL] [DOCUMENT MODEL] [DELETE]"); logger.debug(documentId); assertOnline("[LMODEL] [DOCUMENT MODEL] [DELETE] [USER IS NOT ONLINE]"); final Document document = get(documentId); if(isKeyHolder(documentId)) { if(isClosed(document)) { deleteLocal(document); } else if(!isDistributed(documentId)) { deleteLocal(document); } else { throw Assert.createUnreachable( "[LMODEL] [DOCUMENT MODEL] [DELETE] [CANNOT DELETE DOCUMENT UNTIL IT HAS BEEN CLOSED]"); } } else { deleteLocal(document); } // fire event notifyDocumentDeleted(null, localEventGen); } |
else { deleteLocal(document); } | void delete(final Long documentId) throws ParityException { logger.info("[LMODEL] [DOCUMENT MODEL] [DELETE]"); logger.debug(documentId); assertOnline("[LMODEL] [DOCUMENT MODEL] [DELETE] [USER IS NOT ONLINE]"); final Document document = get(documentId); if(isKeyHolder(documentId)) { if(isClosed(document)) { deleteLocal(document); } else if(!isDistributed(documentId)) { deleteLocal(document); } else { throw Assert.createUnreachable( "[LMODEL] [DOCUMENT MODEL] [DELETE] [CANNOT DELETE DOCUMENT UNTIL IT HAS BEEN CLOSED]"); } } else { deleteLocal(document); } // fire event notifyDocumentDeleted(null, localEventGen); } |
|
add(container.getFlags()); | setDraft(container.isDraft()); setId(container.getId()); setLocalDraft(container.isLocalDraft()); setName(container.getName()); setRemoteInfo(container.getRemoteInfo()); setState(container.getState()); | public ContainerCell(final Container container) { super(); setCreatedBy(container.getCreatedBy()); setCreatedOn(container.getCreatedOn()); add(container.getFlags()); setUniqueId(container.getUniqueId()); setName(container.getName()); setUpdatedBy(container.getUpdatedBy()); setUpdatedOn(container.getUpdatedOn()); setId(container.getId()); setLocalDraft(container.isSetLocalDraft()); setRemoteInfo(container.getRemoteInfo()); setState(container.getState()); this.closed = getState() == ArtifactState.CLOSED; this.imageCache = new MainCellImageCache(); this.keyHolder = contains(ArtifactFlag.KEY); this.popupItemFactory = PopupItemFactory.getInstance(); this.seen = contains(ArtifactFlag.SEEN); this.urgent = Boolean.FALSE; } |
setName(container.getName()); | public ContainerCell(final Container container) { super(); setCreatedBy(container.getCreatedBy()); setCreatedOn(container.getCreatedOn()); add(container.getFlags()); setUniqueId(container.getUniqueId()); setName(container.getName()); setUpdatedBy(container.getUpdatedBy()); setUpdatedOn(container.getUpdatedOn()); setId(container.getId()); setLocalDraft(container.isSetLocalDraft()); setRemoteInfo(container.getRemoteInfo()); setState(container.getState()); this.closed = getState() == ArtifactState.CLOSED; this.imageCache = new MainCellImageCache(); this.keyHolder = contains(ArtifactFlag.KEY); this.popupItemFactory = PopupItemFactory.getInstance(); this.seen = contains(ArtifactFlag.SEEN); this.urgent = Boolean.FALSE; } |
|
setId(container.getId()); setLocalDraft(container.isSetLocalDraft()); setRemoteInfo(container.getRemoteInfo()); setState(container.getState()); | add(container.getFlags()); | public ContainerCell(final Container container) { super(); setCreatedBy(container.getCreatedBy()); setCreatedOn(container.getCreatedOn()); add(container.getFlags()); setUniqueId(container.getUniqueId()); setName(container.getName()); setUpdatedBy(container.getUpdatedBy()); setUpdatedOn(container.getUpdatedOn()); setId(container.getId()); setLocalDraft(container.isSetLocalDraft()); setRemoteInfo(container.getRemoteInfo()); setState(container.getState()); this.closed = getState() == ArtifactState.CLOSED; this.imageCache = new MainCellImageCache(); this.keyHolder = contains(ArtifactFlag.KEY); this.popupItemFactory = PopupItemFactory.getInstance(); this.seen = contains(ArtifactFlag.SEEN); this.urgent = Boolean.FALSE; } |
if (!isSetDraft()) { | if (!isDraft()) { | public void triggerPopup(final Connection connection, final Component invoker, final MouseEvent e, final int x, final int y) { final JPopupMenu jPopupMenu = MenuFactory.createPopup(); if (!isSetDraft()) { final Data createDraftData = new Data(1); createDraftData.set(CreateDraft.DataKey.CONTAINER_ID, getId()); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_CREATE_DRAFT, createDraftData)); final Data deleteData = new Data(1); deleteData.set(Delete.DataKey.CONTAINER_ID, getId()); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_DELETE, deleteData)); } // include the container's id and unique id in the menu if(e.isShiftDown()) { final Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); final ActionListener debugActionListener = new ActionListener() { public void actionPerformed(final ActionEvent e) { final StringSelection stringSelection = new StringSelection(((JComponent) e.getSource()).getClientProperty("COPY_ME").toString()); systemClipboard.setContents(stringSelection, null); } }; final JMenuItem idJMenuItem = new JMenuItem("Id - " + getId()); idJMenuItem.putClientProperty("COPY_ME", getId()); idJMenuItem.addActionListener(debugActionListener); final JMenuItem uidJMenuItem = new JMenuItem("Unique id - " + getUniqueId()); uidJMenuItem.putClientProperty("COPY_ME", getUniqueId()); uidJMenuItem.addActionListener(debugActionListener); jPopupMenu.addSeparator(); jPopupMenu.add(idJMenuItem); jPopupMenu.add(uidJMenuItem); } jPopupMenu.show(invoker, x, y); } |
final Data deleteData = new Data(1); deleteData.set(Delete.DataKey.CONTAINER_ID, getId()); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_DELETE, deleteData)); } | final Data deleteData = new Data(1); deleteData.set(Delete.DataKey.CONTAINER_ID, getId()); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_DELETE, deleteData)); | public void triggerPopup(final Connection connection, final Component invoker, final MouseEvent e, final int x, final int y) { final JPopupMenu jPopupMenu = MenuFactory.createPopup(); if (!isSetDraft()) { final Data createDraftData = new Data(1); createDraftData.set(CreateDraft.DataKey.CONTAINER_ID, getId()); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_CREATE_DRAFT, createDraftData)); final Data deleteData = new Data(1); deleteData.set(Delete.DataKey.CONTAINER_ID, getId()); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_DELETE, deleteData)); } // include the container's id and unique id in the menu if(e.isShiftDown()) { final Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); final ActionListener debugActionListener = new ActionListener() { public void actionPerformed(final ActionEvent e) { final StringSelection stringSelection = new StringSelection(((JComponent) e.getSource()).getClientProperty("COPY_ME").toString()); systemClipboard.setContents(stringSelection, null); } }; final JMenuItem idJMenuItem = new JMenuItem("Id - " + getId()); idJMenuItem.putClientProperty("COPY_ME", getId()); idJMenuItem.addActionListener(debugActionListener); final JMenuItem uidJMenuItem = new JMenuItem("Unique id - " + getUniqueId()); uidJMenuItem.putClientProperty("COPY_ME", getUniqueId()); uidJMenuItem.addActionListener(debugActionListener); jPopupMenu.addSeparator(); jPopupMenu.add(idJMenuItem); jPopupMenu.add(uidJMenuItem); } jPopupMenu.show(invoker, x, y); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.