rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
final Integer newSelectedIndex = tabJList.getSelectedIndex(); final Integer lastIndex = tabJList.getModel().getSize() - 1; | final int newSelectedIndex = tabJList.getSelectedIndex(); final int lastIndex = tabJList.getModel().getSize() - 1; | private void tabJListValueChanged(javax.swing.event.ListSelectionEvent e) { final Integer newSelectedIndex = tabJList.getSelectedIndex(); final Integer lastIndex = tabJList.getModel().getSize() - 1; // The first time here, or if the current selection is the last item // in the list, or if the new selection is not the last item in // the list, then proceed as usual. if ((selectedIndex == -1) || (selectedIndex == lastIndex) || (newSelectedIndex != lastIndex)) { selectedIndex = newSelectedIndex; selectingLastIndex = Boolean.FALSE; } // If the last item is being selected then hold off until we can determine // that the user has clicked on the cell and not below the cell. else { tabJList.setSelectedIndex(selectedIndex); selectingLastIndex = Boolean.TRUE; } } |
if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.FALSE); mouseOverIndex = -1; | if (!isResizeDragging()) { if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.FALSE); mouseOverIndex = -1; } | protected final void installMouseOverTracker() { final MouseInputListener mouseOverListener = new MouseInputAdapter() { private int mouseOverIndex = -1; @Override public void mouseEntered(final MouseEvent e) { mouseMoved(e); } @Override public void mouseExited(final MouseEvent e) { if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.FALSE); mouseOverIndex = -1; } } @Override public void mouseMoved(MouseEvent e) { final int mouseOverIndex = getMouseOverIndex(e); if (mouseOverIndex != this.mouseOverIndex) { if (-1 != this.mouseOverIndex) { updateCellMouseOver(this.mouseOverIndex, Boolean.FALSE); } if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.TRUE); } this.mouseOverIndex = mouseOverIndex; } } }; tabJList.addMouseListener(mouseOverListener); tabJList.addMouseMotionListener(mouseOverListener); } |
final int mouseOverIndex = getMouseOverIndex(e); if (mouseOverIndex != this.mouseOverIndex) { if (-1 != this.mouseOverIndex) { updateCellMouseOver(this.mouseOverIndex, Boolean.FALSE); | if (!isResizeDragging()) { final int mouseOverIndex = getMouseOverIndex(e); if (mouseOverIndex != this.mouseOverIndex) { if (-1 != this.mouseOverIndex) { updateCellMouseOver(this.mouseOverIndex, Boolean.FALSE); } if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.TRUE); } this.mouseOverIndex = mouseOverIndex; | protected final void installMouseOverTracker() { final MouseInputListener mouseOverListener = new MouseInputAdapter() { private int mouseOverIndex = -1; @Override public void mouseEntered(final MouseEvent e) { mouseMoved(e); } @Override public void mouseExited(final MouseEvent e) { if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.FALSE); mouseOverIndex = -1; } } @Override public void mouseMoved(MouseEvent e) { final int mouseOverIndex = getMouseOverIndex(e); if (mouseOverIndex != this.mouseOverIndex) { if (-1 != this.mouseOverIndex) { updateCellMouseOver(this.mouseOverIndex, Boolean.FALSE); } if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.TRUE); } this.mouseOverIndex = mouseOverIndex; } } }; tabJList.addMouseListener(mouseOverListener); tabJList.addMouseMotionListener(mouseOverListener); } |
if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.TRUE); } this.mouseOverIndex = mouseOverIndex; | protected final void installMouseOverTracker() { final MouseInputListener mouseOverListener = new MouseInputAdapter() { private int mouseOverIndex = -1; @Override public void mouseEntered(final MouseEvent e) { mouseMoved(e); } @Override public void mouseExited(final MouseEvent e) { if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.FALSE); mouseOverIndex = -1; } } @Override public void mouseMoved(MouseEvent e) { final int mouseOverIndex = getMouseOverIndex(e); if (mouseOverIndex != this.mouseOverIndex) { if (-1 != this.mouseOverIndex) { updateCellMouseOver(this.mouseOverIndex, Boolean.FALSE); } if (-1 != mouseOverIndex) { updateCellMouseOver(mouseOverIndex, Boolean.TRUE); } this.mouseOverIndex = mouseOverIndex; } } }; tabJList.addMouseListener(mouseOverListener); tabJList.addMouseMotionListener(mouseOverListener); } |
|
final File install = new File(parent, "parity.install"); | final File install = new File(parent, "thinkparity.install"); | private static void initParityInstall() { final File parent = SESSION.getOutputDirectory(); final File install = new File(parent, "parity.install"); Assert.assertTrue("[LMODEL] [TEST INIT] [INIT INSTALL]", install.mkdir()); Assert.assertTrue("[LMODEL] [TEST INIT] [INIT INSTALL CORE]", new File(install, "core").mkdir()); final File lib = new File(install, "lib"); Assert.assertTrue("[LMODEL] [TEST INIT] [INIT INSTALL LIB]", lib.mkdir()); Assert.assertTrue("[LMODEL] [TEST INIT] [INIT INSTALL LIB NATIVE]", new File(lib, "win32").mkdir()); System.setProperty("parity.install", install.getAbsolutePath()); } |
System.setProperty("parity.install", install.getAbsolutePath()); | System.setProperty("thinkparity.install", install.getAbsolutePath()); | private static void initParityInstall() { final File parent = SESSION.getOutputDirectory(); final File install = new File(parent, "parity.install"); Assert.assertTrue("[LMODEL] [TEST INIT] [INIT INSTALL]", install.mkdir()); Assert.assertTrue("[LMODEL] [TEST INIT] [INIT INSTALL CORE]", new File(install, "core").mkdir()); final File lib = new File(install, "lib"); Assert.assertTrue("[LMODEL] [TEST INIT] [INIT INSTALL LIB]", lib.mkdir()); Assert.assertTrue("[LMODEL] [TEST INIT] [INIT INSTALL LIB NATIVE]", new File(lib, "win32").mkdir()); System.setProperty("parity.install", install.getAbsolutePath()); } |
} } public void documentCreated(final DocumentEvent e) { if(e.isRemote()) { browser.fireDocumentCreated(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(), Boolean.TRUE); } } }; } |
|
public void keyRequestAccepted(final DocumentEvent e) { if(e.isRemote()) { browser.fireDocumentUpdated(e.getDocument().getId(), e.isRemote()); } } public void keyRequestDeclined(final DocumentEvent e) { if(e.isRemote()) { browser.fireDocumentUpdated(e.getDocument().getId(), e.isRemote()); } } public void keyRequested(final DocumentEvent e) { if(e.isRemote()) { browser.fireDocumentUpdated(e.getDocument().getId(), e.isRemote()); } } | 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(), Boolean.TRUE); } } }; } |
|
catch(final ClassNotFoundException cnfx) { throw new ThinkParityException("", cnfx); } catch(final NoSuchMethodException nsmx) { throw new ThinkParityException("", nsmx); } catch(final IllegalAccessException iax) { throw new ThinkParityException("", iax); } catch(final InvocationTargetException itx) { throw new ThinkParityException("", itx); } | public void execute() { if(!isMounted()) { throw new IllegalStateException(); } // set last run property final Calendar lastRun = Calendar.getInstance(); properties.setProperty(PropertyNames.ParityImageLastRun, DateFormats.ImageLastRun.format(lastRun.getTime())); // set library path System.setProperty(PropertyNames.JavaLibraryPath, libraryPath); // save image configuration try { PropertiesUtil.store(properties, new File(root, FileNames.ThinkParityImageProperties), Sundry.ThinkParityImageHeader); } catch(final IOException iox) { throw new ThinkParityException("", iox); } // create class loader final ClassLoader classLoader = URLClassLoader.newInstance(classPath, null); try { // execute final Class mainClass = classLoader.loadClass(mainClassName); final Method mainMethod = mainClass.getMethod("main", new Class[] {mainArgs.getClass()}); mainMethod.invoke(null, new Object[] {mainArgs}); } catch(final ClassNotFoundException cnfx) { throw new ThinkParityException("", cnfx); } catch(final NoSuchMethodException nsmx) { throw new ThinkParityException("", nsmx); } catch(final IllegalAccessException iax) { throw new ThinkParityException("", iax); } catch(final InvocationTargetException itx) { throw new ThinkParityException("", itx); } } |
|
public Boolean doesExist(final UUID uniqueId) { synchronized(getImplLock()) { return getImpl().doesExist(uniqueId); } | public Boolean doesExist(final Long artifactId) { synchronized(getImplLock()) { return getImpl().doesExist(artifactId); } | public Boolean doesExist(final UUID uniqueId) { synchronized(getImplLock()) { return getImpl().doesExist(uniqueId); } } |
((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.FALSE); | ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).syncDocument(documentId, Boolean.FALSE); | public void fireDocumentCreated(final Long documentId) { SwingUtilities.invokeLater(new Runnable() { public void run() { ((BrowserInfoAvatar) avatarRegistry.get(AvatarId.BROWSER_INFO)).reload(); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.FALSE); } }); } |
((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.FALSE); | ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).syncDocument(documentId, Boolean.FALSE); | public void run() { ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.FALSE); } |
((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.FALSE); | ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).syncDocument(documentId, Boolean.FALSE); | public void fireDocumentDeleted(final Long documentId) { SwingUtilities.invokeLater(new Runnable() { public void run() { ((BrowserInfoAvatar) avatarRegistry.get(AvatarId.BROWSER_INFO)).reload(); } }); // refresh the document main list SwingUtilities.invokeLater(new Runnable() { public void run() { ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.FALSE); } }); } |
((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.TRUE); | ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).syncDocument(documentId, Boolean.TRUE); | public void fireDocumentReceived(final Long documentId) { // refresh the document main list SwingUtilities.invokeLater(new Runnable() { public void run() { ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.TRUE); } }); } |
((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.TRUE); | ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).syncDocument(documentId, Boolean.TRUE); | public void run() { ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, Boolean.TRUE); } |
((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, remoteReload); | ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).syncDocument(documentId, remoteReload); | public void run() { ((BrowserMainAvatar) avatarRegistry.get(AvatarId.BROWSER_MAIN)).reloadDocument(documentId, remoteReload); } |
logger.info("moveMainWindow(Point)"); logger.debug(l); | public void moveBrowserWindow(final Point l) { logger.info("moveMainWindow(Point)"); logger.debug(l); final Point newL = mainWindow.getLocation(); newL.x += l.x; newL.y += l.y; logger.debug(newL); mainWindow.setLocation(newL); if(null != history2Window && history2Window.isVisible()) { final Point hl = history2Window.getLocation(); hl.x += l.x; hl.y += l.y; history2Window.setLocation(hl); } } |
|
getRootPane().setBorder(windowBorder.get(avatar.getId())); | public void open(final Avatar avatar) { initComponents(avatar); debugGeometry(); debugLookAndFeel(); setSize(windowSize.get(avatar.getId())); setLocation(calculateLocation()); invalidate(); setVisible(true); } |
|
getRootPane().setBorder(getBorder()); | getRootPane().setBorder(new ImageBorder("MainWindowBorderTop.png", "MainWindowBorderLeft.png", "MainWindowBorderBottom.png", "MainWindowBorderRight.png")); | BrowserWindow(final Browser browser) throws HeadlessException { super("BrowserWindow"); this.browser = browser; // initialize the state new BrowserWindowState(this); getRootPane().setBorder(getBorder()); setIconImage(BROWSER_ICON); setTitle(getString("Title")); setUndecorated(true); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setResizable(false); setSize(BrowserWindow.getMainWindowSize()); applyNativeSkin(); initComponents(); } |
setSize(new Dimension(306, 462)); | setSize(new Dimension(306, 490)); | public History2Window(final BrowserWindow browserWindow, final Avatar avatar) { super(browserWindow, Boolean.FALSE, ""); final Color c1 = new Color(196, 213, 255, 255); final Color c2 = new Color(117, 130, 162, 255); getRootPane().setBorder(new CustomEtechedBorder(EtchedBorder.RAISED, c1, c2)); setUndecorated(true); setLayout(new GridBagLayout()); setSize(new Dimension(306, 462)); setLocation(calculateLocation(browserWindow, getSize())); initComponents(avatar); } |
explanationJLabel.setText(bundle.getString("ExportDialog.Explanation")); | explanationJLabel.setText(bundle.getString("ExportDialog.ExplanationContainer")); | private void initComponents() { explanationJLabel = new javax.swing.JLabel(); directoryJLabel = new javax.swing.JLabel(); directoryJTextField = new javax.swing.JTextField(); directoryJButton = new javax.swing.JButton(); openWhenDoneCheckBox = new javax.swing.JCheckBox(); okJButton = new javax.swing.JButton(); cancelJButton = new javax.swing.JButton(); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("localization/JPanel_Messages"); // NOI18N explanationJLabel.setText(bundle.getString("ExportDialog.Explanation")); // NOI18N explanationJLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); explanationJLabel.setFocusable(false); directoryJLabel.setText(bundle.getString("ExportDialog.Directory")); // NOI18N directoryJLabel.setFocusable(false); directoryJTextField.setEditable(false); directoryJTextField.setFocusable(false); directoryJButton.setText(bundle.getString("ExportDialog.DirectoryButton")); // NOI18N directoryJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { directoryJButtonActionPerformed(evt); } }); openWhenDoneCheckBox.setText(bundle.getString("ExportDialog.RunWhenDoneCheckbox")); // NOI18N openWhenDoneCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); openWhenDoneCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0)); okJButton.setText(bundle.getString("ExportDialog.OK")); // NOI18N okJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okJButtonActionPerformed(evt); } }); cancelJButton.setText(bundle.getString("ExportDialog.Cancel")); // NOI18N cancelJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelJButtonActionPerformed(evt); } }); 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() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, explanationJLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, openWhenDoneCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() .add(directoryJLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(directoryJTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(directoryJButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 26, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(layout.createSequentialGroup() .add(okJButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(cancelJButton))) .addContainerGap()) ); layout.linkSize(new java.awt.Component[] {cancelJButton, okJButton}, org.jdesktop.layout.GroupLayout.HORIZONTAL); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(explanationJLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(directoryJLabel) .add(directoryJTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(directoryJButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(openWhenDoneCheckBox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(cancelJButton) .add(okJButton)) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents |
final Long versionId = getInputVersionId(); File directory = new File(SwingUtil.extract(directoryJTextField)); getController().runExportVersion(containerId, versionId, directory); | if (exportType==ExportType.CONTAINER) { getController().runExport(containerId, directory); } else { final Long versionId = getInputVersionId(); getController().runExportVersion(containerId, versionId, directory); } | private void okJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okJButtonActionPerformed if(isInputValid()) { final Long containerId = getInputContainerId(); final Long versionId = getInputVersionId(); File directory = new File(SwingUtil.extract(directoryJTextField)); getController().runExportVersion(containerId, versionId, directory); disposeWindow(); } }//GEN-LAST:event_okJButtonActionPerformed |
private Delta calculateDelta(final ArtifactVersion compare, final List<? extends ArtifactVersion> compareToList) { for (final ArtifactVersion compareTo : compareToList) { if (compare.getArtifactId().equals(compareTo.getArtifactId())) { if (compare.getVersionId().equals(compareTo.getVersionId())) { return Delta.NONE; } else { return Delta.MODIFIED; | private ContainerVersionDelta calculateDelta(final Container container, final ContainerVersion compare, final ContainerVersion compareTo) { final ContainerVersionDelta versionDelta = new ContainerVersionDelta(); versionDelta.setCompareVersionId(compare.getVersionId()); versionDelta.setCompareToVersionId(compareTo.getVersionId()); versionDelta.setContainerId(container.getId()); final Delta didNotHit, notContains; if (compare.getVersionId() > compareTo.getVersionId()) { didNotHit = Delta.REMOVED; notContains = Delta.ADDED; } else if (compare.getVersionId() < compareTo.getVersionId()) { didNotHit = Delta.ADDED; notContains = Delta.REMOVED; } else { throw Assert.createUnreachable("Unexpected equality."); } final List<DocumentVersion> compareDocuments = containerIO.readDocumentVersions( versionDelta.getContainerId(), versionDelta.getCompareVersionId()); final List<DocumentVersion> compareToDocuments = containerIO.readDocumentVersions( versionDelta.getContainerId(), versionDelta.getCompareToVersionId()); ContainerVersionArtifactVersionDelta artifactVersionDelta; boolean didHit; for (final ArtifactVersion compareToDocument : compareToDocuments) { artifactVersionDelta = new ContainerVersionArtifactVersionDelta(); artifactVersionDelta.setArtifactId(compareToDocument.getArtifactId()); artifactVersionDelta.setArtifactVersionId(compareToDocument.getVersionId()); didHit = false; for (final ArtifactVersion versionDocument : compareDocuments) { if (versionDocument.getArtifactId().equals(compareToDocument.getArtifactId())) { if (versionDocument.getVersionId().equals(compareToDocument.getVersionId())) { artifactVersionDelta.setDelta(Delta.NONE); } else { artifactVersionDelta.setDelta(Delta.MODIFIED); } didHit = true; break; | private Delta calculateDelta(final ArtifactVersion compare, final List<? extends ArtifactVersion> compareToList) { for (final ArtifactVersion compareTo : compareToList) { if (compare.getArtifactId().equals(compareTo.getArtifactId())) { if (compare.getVersionId().equals(compareTo.getVersionId())) { return Delta.NONE; } else { return Delta.MODIFIED; } } else { return Delta.ADDED; } } return Delta.REMOVED; } |
} else { return Delta.ADDED; | } if (!didHit) { artifactVersionDelta.setDelta(didNotHit); } versionDelta.addDelta(artifactVersionDelta); } for (final ArtifactVersion compareDocument : compareDocuments) { if (!versionDelta.containsDelta(compareDocument)) { artifactVersionDelta = new ContainerVersionArtifactVersionDelta(); artifactVersionDelta.setArtifactId(compareDocument.getArtifactId()); artifactVersionDelta.setArtifactVersionId(compareDocument.getVersionId()); artifactVersionDelta.setDelta(notContains); versionDelta.addDelta(artifactVersionDelta); | private Delta calculateDelta(final ArtifactVersion compare, final List<? extends ArtifactVersion> compareToList) { for (final ArtifactVersion compareTo : compareToList) { if (compare.getArtifactId().equals(compareTo.getArtifactId())) { if (compare.getVersionId().equals(compareTo.getVersionId())) { return Delta.NONE; } else { return Delta.MODIFIED; } } else { return Delta.ADDED; } } return Delta.REMOVED; } |
return Delta.REMOVED; | return versionDelta; | private Delta calculateDelta(final ArtifactVersion compare, final List<? extends ArtifactVersion> compareToList) { for (final ArtifactVersion compareTo : compareToList) { if (compare.getArtifactId().equals(compareTo.getArtifactId())) { if (compare.getVersionId().equals(compareTo.getVersionId())) { return Delta.NONE; } else { return Delta.MODIFIED; } } else { return Delta.ADDED; } } return Delta.REMOVED; } |
previous, version)); | version, previous)); | void handlePublished(final ContainerPublishedEvent event) { logger.logApiId(); logger.logVariable("event", event); try { final InternalArtifactModel artifactModel = getInternalArtifactModel(); final Long containerId = artifactModel.readId(event.getUniqueId()); // add to local team final InternalUserModel userModel = getInternalUserModel(); final List<TeamMember> localTeam = artifactModel.readTeam2(containerId); final List<User> publishedToUsers = new ArrayList<User>(); for (final JabberId publishedToId : event.getPublishedTo()) { if (!contains(localTeam, publishedToId)) { artifactModel.addTeamMember(containerId, publishedToId); } publishedToUsers.add(userModel.read(publishedToId)); } // add the sender as well if (!contains(localTeam, event.getPublishedBy())) { artifactModel.addTeamMember(containerId, event.getPublishedBy()); } // delete draft final ContainerDraft draft = readDraft(containerId); if (null == draft) { logger.logWarning("Draft did not previously exist for {0}.", event.getName()); } else { for (final Artifact artifact : draft.getArtifacts()) { containerIO.deleteDraftArtifactRel(containerId, artifact.getId()); } containerIO.deleteDraft(containerId); } // create published to list containerIO.createPublishedTo(containerId, event.getVersionId(), publishedToUsers); // calculate differences final ContainerVersion version = readVersion(containerId, event.getVersionId()); final ContainerVersion previous = readPreviousVersion(containerId, event.getVersionId()); final ContainerVersion next = readNextVersion(containerId, event.getVersionId()); if (null == previous) { logger.logInfo("First version of {0}.", event.getName()); } else { containerIO.deleteDelta(containerId, previous.getVersionId(), version.getVersionId()); containerIO.createDelta(calculateDelta(read(containerId), previous, version)); } if (null == next) { logger.logInfo("Latest version of {0}.", event.getName()); } else { containerIO.deleteDelta(containerId, version.getVersionId(), next.getVersionId()); containerIO.createDelta(calculateDelta(read(containerId), version, next)); } // apply comment if (null != event.getComment() && 0 < event.getComment().trim().length()) containerIO.updateComment(containerId, version.getVersionId(), event.getComment()); // send confirmation getSessionModel().confirmArtifactReceipt(localUserId(), event.getUniqueId(), event.getVersionId(), localUserId(), currentDateTime()); // audit\fire event final Container postPublish = read(containerId); final ContainerDraft postPublishDraft = readDraft(containerId); final ContainerVersion postPublishVersion = readVersion(containerId, event.getVersionId()); auditContainerPublished(postPublish, postPublishDraft, postPublishVersion, event.getPublishedBy(), event.getPublishedTo(), event.getPublishedOn()); notifyContainerPublished(postPublish, postPublishDraft, postPublishVersion, remoteEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
version, next)); | next, version)); | void handlePublished(final ContainerPublishedEvent event) { logger.logApiId(); logger.logVariable("event", event); try { final InternalArtifactModel artifactModel = getInternalArtifactModel(); final Long containerId = artifactModel.readId(event.getUniqueId()); // add to local team final InternalUserModel userModel = getInternalUserModel(); final List<TeamMember> localTeam = artifactModel.readTeam2(containerId); final List<User> publishedToUsers = new ArrayList<User>(); for (final JabberId publishedToId : event.getPublishedTo()) { if (!contains(localTeam, publishedToId)) { artifactModel.addTeamMember(containerId, publishedToId); } publishedToUsers.add(userModel.read(publishedToId)); } // add the sender as well if (!contains(localTeam, event.getPublishedBy())) { artifactModel.addTeamMember(containerId, event.getPublishedBy()); } // delete draft final ContainerDraft draft = readDraft(containerId); if (null == draft) { logger.logWarning("Draft did not previously exist for {0}.", event.getName()); } else { for (final Artifact artifact : draft.getArtifacts()) { containerIO.deleteDraftArtifactRel(containerId, artifact.getId()); } containerIO.deleteDraft(containerId); } // create published to list containerIO.createPublishedTo(containerId, event.getVersionId(), publishedToUsers); // calculate differences final ContainerVersion version = readVersion(containerId, event.getVersionId()); final ContainerVersion previous = readPreviousVersion(containerId, event.getVersionId()); final ContainerVersion next = readNextVersion(containerId, event.getVersionId()); if (null == previous) { logger.logInfo("First version of {0}.", event.getName()); } else { containerIO.deleteDelta(containerId, previous.getVersionId(), version.getVersionId()); containerIO.createDelta(calculateDelta(read(containerId), previous, version)); } if (null == next) { logger.logInfo("Latest version of {0}.", event.getName()); } else { containerIO.deleteDelta(containerId, version.getVersionId(), next.getVersionId()); containerIO.createDelta(calculateDelta(read(containerId), version, next)); } // apply comment if (null != event.getComment() && 0 < event.getComment().trim().length()) containerIO.updateComment(containerId, version.getVersionId(), event.getComment()); // send confirmation getSessionModel().confirmArtifactReceipt(localUserId(), event.getUniqueId(), event.getVersionId(), localUserId(), currentDateTime()); // audit\fire event final Container postPublish = read(containerId); final ContainerDraft postPublishDraft = readDraft(containerId); final ContainerVersion postPublishVersion = readVersion(containerId, event.getVersionId()); auditContainerPublished(postPublish, postPublishDraft, postPublishVersion, event.getPublishedBy(), event.getPublishedTo(), event.getPublishedOn()); notifyContainerPublished(postPublish, postPublishDraft, postPublishVersion, remoteEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
final Long nextVersionId = | final Long previousVersionId = | ContainerVersion readPreviousVersion(final Long containerId, final Long versionId) { logger.logApiId(); logger.logVariable("containerId", containerId); logger.logVariable("versionId", versionId); try { final Long nextVersionId = artifactIO.readPreviousVersionId(containerId, versionId); if (null != nextVersionId && doesExistVersion(containerId, nextVersionId)) { return containerIO.readVersion(containerId, nextVersionId); } else { return null; } } catch (final Throwable t) { throw translateError(t); } } |
if (null != nextVersionId && doesExistVersion(containerId, nextVersionId)) { return containerIO.readVersion(containerId, nextVersionId); | if (null != previousVersionId && doesExistVersion(containerId, previousVersionId)) { return containerIO.readVersion(containerId, previousVersionId); | ContainerVersion readPreviousVersion(final Long containerId, final Long versionId) { logger.logApiId(); logger.logVariable("containerId", containerId); logger.logVariable("versionId", versionId); try { final Long nextVersionId = artifactIO.readPreviousVersionId(containerId, versionId); if (null != nextVersionId && doesExistVersion(containerId, nextVersionId)) { return containerIO.readVersion(containerId, nextVersionId); } else { return null; } } catch (final Throwable t) { throw translateError(t); } } |
return new AbstractComparator<ArtifactVersion>(Boolean.TRUE) { public int compare(final ArtifactVersion o1, final ArtifactVersion o2) { final int compareResult = o1.getName().compareTo(o2.getName()); if (0 == compareResult) { return subCompare(o1, o2); } else { return compareResult * resultMultiplier; } } }; | return new VersionNameComparator(Boolean.TRUE); | public Comparator<ArtifactVersion> createVersionByName() { return new AbstractComparator<ArtifactVersion>(Boolean.TRUE) { public int compare(final ArtifactVersion o1, final ArtifactVersion o2) { final int compareResult = o1.getName().compareTo(o2.getName()); if (0 == compareResult) { return subCompare(o1, o2); } else { return compareResult * resultMultiplier; } } }; } |
final AbstractComparator<User> comparator = new NameComparator(ascending); | final DefaultComparator<User> comparator = new NameComparator(ascending); | public static Comparator<User> createOrganizationAndName( final Boolean ascending) { final AbstractComparator<User> comparator = new NameComparator(ascending); comparator.add(new OrganizationComparator(ascending)); return comparator; } |
protected void assertOnline(final String assertion) { Assert.assertTrue(assertion, isOnline()); | protected void assertOnline() { assertOnline("USER NOT ONLINE"); | protected void assertOnline(final String assertion) { Assert.assertTrue(assertion, isOnline()); } |
public File createTempDirectory(final String suffix) throws IOException; | public File createTempDirectory() throws IOException; | public File createTempDirectory(final String suffix) throws IOException; |
final Map<ContainerVersion, Map<User, ArtifactReceipt>> publishedTo, final Map<ContainerVersion, Map<User, ArtifactReceipt>> sharedWith) | final Map<ContainerVersion, Map<User, ArtifactReceipt>> publishedTo) | public void write( final String pdfPath, final Container container, final User containerCreatedBy, final List<ContainerVersion> versions, final Map<ContainerVersion, User> versionsPublishedBy, final Map<ContainerVersion, List<DocumentVersion>> documents, final Map<DocumentVersion, Long> documentsSize, final Map<ContainerVersion, Map<User, ArtifactReceipt>> publishedTo, final Map<ContainerVersion, Map<User, ArtifactReceipt>> sharedWith) throws TransformerException, IOException { final String xmlPath = "pdfWriter.xml"; xmlWriter.write(xmlPath, container, containerCreatedBy, versions, versionsPublishedBy, documents, documentsSize, publishedTo, sharedWith); final Driver driver = new Driver(); final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); driver.setLogger(logger); driver.setRenderer(Driver.RENDER_PDF); final OutputStream outStream = new FileOutputStream(newFile(pdfPath)); try { driver.setOutputStream(outStream); final TransformerFactory factory = TransformerFactory.newInstance(); final Transformer transformer = factory.newTransformer( new StreamSource(ResourceUtil.getFile("xml/xslt/pdfWriter.xsl"))); final Result result = new SAXResult(driver.getContentHandler()); transformer.transform(new StreamSource( exportFileSystem.findFile(xmlPath)), result); } finally { outStream.close(); Assert.assertTrue(exportFileSystem.findFile(xmlPath).delete(), "Could not delete xml file {0}.", xmlPath); } } |
versionsPublishedBy, documents, documentsSize, publishedTo, sharedWith); | versionsPublishedBy, documents, documentsSize, publishedTo); | public void write( final String pdfPath, final Container container, final User containerCreatedBy, final List<ContainerVersion> versions, final Map<ContainerVersion, User> versionsPublishedBy, final Map<ContainerVersion, List<DocumentVersion>> documents, final Map<DocumentVersion, Long> documentsSize, final Map<ContainerVersion, Map<User, ArtifactReceipt>> publishedTo, final Map<ContainerVersion, Map<User, ArtifactReceipt>> sharedWith) throws TransformerException, IOException { final String xmlPath = "pdfWriter.xml"; xmlWriter.write(xmlPath, container, containerCreatedBy, versions, versionsPublishedBy, documents, documentsSize, publishedTo, sharedWith); final Driver driver = new Driver(); final Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); driver.setLogger(logger); driver.setRenderer(Driver.RENDER_PDF); final OutputStream outStream = new FileOutputStream(newFile(pdfPath)); try { driver.setOutputStream(outStream); final TransformerFactory factory = TransformerFactory.newInstance(); final Transformer transformer = factory.newTransformer( new StreamSource(ResourceUtil.getFile("xml/xslt/pdfWriter.xsl"))); final Result result = new SAXResult(driver.getContentHandler()); transformer.transform(new StreamSource( exportFileSystem.findFile(xmlPath)), result); } finally { outStream.close(); Assert.assertTrue(exportFileSystem.findFile(xmlPath).delete(), "Could not delete xml file {0}.", xmlPath); } } |
break; | continue; | public static void createZipFile(final File zipFile, final File inputDirectory) throws FileNotFoundException, IOException { Assert.assertNotTrue(zipFile.exists(), "Zip file ''{0}'' already exists.", zipFile); Assert.assertTrue(zipFile.createNewFile(), "Zip file ''{0}'' could not be created.", zipFile); final ZipOutputStream zipStream = new ZipOutputStream(new FileOutputStream(zipFile)); zipStream.setMethod(ZipOutputStream.DEFLATED); zipStream.setLevel(9); final File[] files = new FileSystem(inputDirectory).listFiles("/", Boolean.TRUE); try { FileInputStream fileStream = null; for (final File file : files) { // dont' add the zipFile if (file.getAbsolutePath().equals(zipFile.getAbsolutePath())) break; zipStream.putNextEntry(new ZipEntry(resolveName(inputDirectory, file))); fileStream = new FileInputStream(file); try { StreamUtil.copy(fileStream, zipStream); } finally { fileStream.close(); } zipStream.closeEntry(); } zipStream.flush(); } finally { zipStream.close(); } } |
final InputStream stream) throws IOException { | final InputStream stream, final Long streamSize) throws IOException { | protected String uploadStream(final StreamSession session, final InputStream stream) throws IOException { final InternalSessionModel sessionModel = getSessionModel(); final StreamWriter writer = new StreamWriter(session); writer.open(); try { final String streamId = sessionModel.createStream(session); writer.write(streamId, stream); return streamId; } finally { writer.close(); } } |
writer.write(streamId, stream); | writer.write(streamId, stream, streamSize); | protected String uploadStream(final StreamSession session, final InputStream stream) throws IOException { final InternalSessionModel sessionModel = getSessionModel(); final StreamWriter writer = new StreamWriter(session); writer.open(); try { final String streamId = sessionModel.createStream(session); writer.write(streamId, stream); return streamId; } finally { writer.close(); } } |
public List<JabberId> readTeamIds(UUID uniqueId) { | public List<JabberId> readTeamIds(final UUID uniqueId) { | public List<JabberId> readTeamIds(UUID uniqueId) { synchronized (getImplLock()) { return getImpl().readTeamIds(uniqueId); } } |
else { getSessionModel().send(contacts, documentId); } | else { if(ArtifactUtil.isKeyHolder(documentId)) { getSessionModel().send(contacts, documentId); } else { final DocumentVersion latestVersion = getDocumentModel().readLatestVersion(documentId); getSessionModel().send(contacts, documentId, latestVersion.getVersionId()); } } | private void sendJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendJButtonActionPerformed if(isInputValid()) { final Long documentId = extractDocumentId(); final List<User> contacts = proxy(extractTeam()); contacts.addAll(proxy(extractContacts())); final Boolean doIncludeKey = extractDoIncludeKey(); toggleVisualFeedback(Boolean.TRUE); try { if(doIncludeKey) { // create a version and send it // update the server key holder final User user = contacts.get(0); // TODO Refactor the user object. final JabberId jabberId = JabberIdBuilder.parseUsername(user.getSimpleUsername()); getSessionModel().sendKeyResponse(documentId, jabberId, KeyResponse.ACCEPT); } else { getSessionModel().send(contacts, documentId); } // NOTE Interesting ArtifactModel.getModel().applyFlagSeen(documentId); } catch(final ParityException px) { throw new RuntimeException(px); } finally { toggleVisualFeedback(Boolean.FALSE); getController().fireDocumentUpdated(documentId); disposeWindow(); } } }//GEN-LAST:event_sendJButtonActionPerformed |
public static JList create() { synchronized(singletonLock) { return singleton.doCreate(); } } | public static JList create() { return SINGLETON.doCreate(); } | public static JList create() { synchronized(singletonLock) { return singleton.doCreate(); } } |
public void send(final Collection<User> users, final Long documentId, final Long versionId) throws ParityException { synchronized(implLock) { impl.send(users, documentId, versionId); } | public void send(final Collection<User> users, final Long documentId) throws ParityException { synchronized(implLock) { impl.send(users, documentId); } | public void send(final Collection<User> users, final Long documentId, final Long versionId) throws ParityException { synchronized(implLock) { impl.send(users, documentId, versionId); } } |
final Data deleteData = new Data(1); deleteData.set(DeleteDraft.DataKey.CONTAINER_ID, getContainerId()); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_DELETE_DRAFT, deleteData)); | public void triggerPopup(final Connection connection, final Component invoker, final MouseEvent e, final int x, final int y) { final JPopupMenu jPopupMenu = MenuFactory.createPopup(); final Data addDocumentData = new Data(1); addDocumentData.set(AddDocument.DataKey.CONTAINER_ID, getContainerId()); addDocumentData.set(AddDocument.DataKey.FILES, new File[0]); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_ADD_DOCUMENT, addDocumentData)); if(connection == Connection.ONLINE) { final Data publishData = new Data(1); publishData.set(Publish.DataKey.CONTAINER_ID, getContainerId()); jPopupMenu.add(popupItemFactory.createPopupItem(ActionId.CONTAINER_PUBLISH, publishData)); } jPopupMenu.show(invoker, x, y); } |
|
public void teamMemberAdded(final DocumentEvent e) { if(e.isRemote()) { systemApplication.fireDocumentTeamMemberAdded(e.getUser(), e.getDocument()); } } | private DocumentListener createDocumentListener() { return new DocumentAdapter() { public void documentClosed(final DocumentEvent e) { if(e.isRemote()) systemApplication.fireDocumentClosed(e.getDocument()); } public void documentCreated(final DocumentEvent e) { if(e.isRemote()) systemApplication.fireDocumentCreated(e.getDocument()); } public void documentUpdated(final DocumentEvent e) { if(e.isRemote()) systemApplication.fireDocumentUpdated(e.getDocument()); } public void keyRequestAccepted(final DocumentEvent e) { if(e.isRemote()) systemApplication.fireDocumentKeyRequestAccepted(e.getUser(), e.getDocument()); } public void keyRequestDeclined(final DocumentEvent e) { if(e.isRemote()) systemApplication.fireDocumentKeyRequestDeclined(e.getUser(), e.getDocument()); } public void keyRequested(final DocumentEvent e) { if(e.isRemote()) systemApplication.fireDocumentKeyRequested(e.getUser(), e.getDocument()); } }; } |
|
switch (platform) { case WIN32: compareResult = o1.toLowerCase().compareTo(o2.toLowerCase()); break; case LINUX: case UNIX: compareResult = o1.compareTo(o2); break; default: throw Assert.createUnreachable("Unknown platform."); | if (null == o1) { if (null == o2) { compareResult = 0; } else { compareResult = -1; } } else { if (null == o2) { compareResult = 1; } else { switch (platform) { case WIN32: compareResult = o1.toLowerCase().compareTo(o2.toLowerCase()); break; case LINUX: case UNIX: compareResult = o1.compareTo(o2); break; default: throw Assert.createUnreachable("Unknown platform."); } } | public int compare(final String o1, final String o2) { final int compareResult; switch (platform) { case WIN32: compareResult = o1.toLowerCase().compareTo(o2.toLowerCase()); break; case LINUX: case UNIX: compareResult = o1.compareTo(o2); break; default: throw Assert.createUnreachable("Unknown platform."); } return compareResult * (ascending ? 1 : -1); } |
XMPPConnection.addConnectionListener(new ConnectionEstablishedListener() { public void connectionEstablished(final XMPPConnection connection) { handleConnectionEstablished(connection); } }); | public XMPPSessionImpl() { logger.info("Jive Software: Smack: " + SmackConfiguration.getVersion()); this.listeners = new ArrayList<SessionListener>(); this.xmppArtifact = new XMPPArtifact(this); this.xmppContainer = new XMPPContainer(this); this.xmppContact = new XMPPContact(this); this.xmppProfile = new XMPPProfile(this); this.xmppUser = new XMPPUser(this); XMPPConnection.addConnectionListener(new ConnectionEstablishedListener() { public void connectionEstablished(final XMPPConnection connection) { handleConnectionEstablished(connection); } }); } |
|
listener.sessionTerminated(); | listener.sessionTerminated(x); | public void notifyListener(final SessionListener listener) { listener.sessionTerminated(); } |
private void handleConnectionEstablished(final XMPPConnection xmppConnection) { if (null != this.xmppConnection && this.xmppConnection.equals(xmppConnection)) { notifyListeners(new EventNotifier<SessionListener>() { public void notifyListener(final SessionListener listener) { listener.sessionEstablished(); } }); } | private void handleConnectionEstablished() { notifyListeners(new EventNotifier<SessionListener>() { public void notifyListener(final SessionListener listener) { listener.sessionEstablished(); } }); | private void handleConnectionEstablished(final XMPPConnection xmppConnection) { if (null != this.xmppConnection && this.xmppConnection.equals(xmppConnection)) { notifyListeners(new EventNotifier<SessionListener>() { public void notifyListener(final SessionListener listener) { listener.sessionEstablished(); } }); } } |
listener.sessionTerminated(x); | listener.sessionEstablished(); | public void notifyListener(final SessionListener listener) { listener.sessionTerminated(x); } |
handleConnectionEstablished(); | public void login(final Environment environment, final Credentials credentials) throws SmackException { assertIsReachable(environment); try { if (Boolean.TRUE == isLoggedIn()) logout(); switch (environment.getServerProtocol()) { case XMPP: xmppConnection = new XMPPConnection(environment.getServerHost(), environment.getServerPort()); break; case XMPPS: xmppConnection = new SSLXMPPConnection(environment.getServerHost(), environment.getServerPort()); break; default: Assert.assertUnreachable("UNKNOWN ENVIRONMENT PROTOCOL"); } xmppConnection.addConnectionListener(new ConnectionListener() { public void connectionClosed() { handleConnectionClosed(); } public void connectionClosedOnError(final Exception x) { handleConnectionClosed(x); } }); xmppConnection.addPacketListener(new PacketListener() { public void processPacket(final Packet packet) { logger.debug(packet); } }, new PacketFilter() { public boolean accept(final Packet packet) { return true; } }); xmppArtifact.addEventHandlers(); xmppContact.addEventHandlers(); xmppContainer.addEventHandlers(); xmppUser.addEventHandlers(); xmppConnection.login( credentials.getUsername(), credentials.getPassword(), Jabber.RESOURCE); } catch (final XMPPException xmppx) { logger.error("login(String,Integer,String,String)", xmppx); throw XMPPErrorTranslator.translate(xmppx); } } |
|
public SmackException(String string) { super(string); } | SmackException(final String message, final Throwable cause) { super(message, cause); } | public SmackException(String string) { super(string); } |
this.flags = flags; | this.flags = new Vector<ParityObjectFlag>(flags.size()); add(flags); | private XMPPDocument(final byte[] content, final String createdBy, final Calendar createdOn, final String description, final Collection<ParityObjectFlag> flags, final UUID id, final String name, final String updatedBy, final Calendar updatedOn) { super(); this.content = new byte[content.length]; System.arraycopy(content, 0, this.content, 0, content.length); this.createdBy = createdBy; this.createdOn = createdOn; this.description = description; this.flags = flags; this.id = id; this.name = name; this.updatedBy = updatedBy; this.updatedOn = updatedOn; } |
public static XMPPDocument create(final Document document, final DocumentContent content) { return new XMPPDocument(content.getContent(), document.getCreatedBy(), document.getCreatedOn(), document.getDescription(), document.getFlags(), document.getId(), document.getName(), document.getUpdatedBy(), document.getUpdatedOn()); | public static XMPPDocument create(final byte[] content, final String createdBy, final Calendar createdOn, final String description, final Collection<ParityObjectFlag> flags, final UUID id, final String name, final String updatedBy, final Calendar updatedOn) { return new XMPPDocument(content, createdBy, createdOn, description, flags, id, name, updatedBy, updatedOn); | public static XMPPDocument create(final Document document, final DocumentContent content) { return new XMPPDocument(content.getContent(), document.getCreatedBy(), document.getCreatedOn(), document.getDescription(), document.getFlags(), document.getId(), document.getName(), document.getUpdatedBy(), document.getUpdatedOn()); } |
display.requestFocusInWindow(); | private void displayAvatar(final Avatar avatar, final Data input, final DisplayId displayId) { Assert.assertNotNull(avatar, "Avatar is null."); Assert.assertNotNull(displayId, "Display id is null."); final Display display = browserWindow.getDisplay(displayId); if (null == input) { logger.logWarning("Input for avatar {0} is null.", avatar); } else { avatar.setInput(input); } display.setAvatar(avatar); display.displayAvatar(); avatar.reload(); display.revalidate(); display.repaint(); } |
|
this.sharedWith = new HashMap<ContainerVersion, Map<User, ArtifactReceipt>>(); | public PDFXMLWriter(final FileSystem exportFileSystem) { super(); this.documents = new HashMap<ContainerVersion, List<DocumentVersion>>(); this.documentsSize = new HashMap<DocumentVersion, Long>(); this.publishedTo = new HashMap<ContainerVersion, Map<User, ArtifactReceipt>>(); this.sharedWith = new HashMap<ContainerVersion, Map<User, ArtifactReceipt>>(); this.versions = new ArrayList<ContainerVersion>(); this.versionsPublishedBy = new HashMap<ContainerVersion, User>(); this.exportFileSystem = exportFileSystem; } |
|
final Map<ContainerVersion, Map<User, ArtifactReceipt>> publishedTo, final Map<ContainerVersion, Map<User, ArtifactReceipt>> sharedWith) | final Map<ContainerVersion, Map<User, ArtifactReceipt>> publishedTo) | void write( final String path, final Container container, final User containerCreatedBy, final List<ContainerVersion> versions, final Map<ContainerVersion, User> versionsPublishedBy, final Map<ContainerVersion, List<DocumentVersion>> documents, final Map<DocumentVersion, Long> documentsSize, final Map<ContainerVersion, Map<User, ArtifactReceipt>> publishedTo, final Map<ContainerVersion, Map<User, ArtifactReceipt>> sharedWith) throws IOException, TransformerException { this.container = container; this.containerCreatedBy = containerCreatedBy; this.documents.clear(); this.documents.putAll(documents); this.documentsSize.clear(); this.documentsSize.putAll(documentsSize); this.publishedTo.clear(); this.publishedTo.putAll(publishedTo); this.sharedWith.clear(); this.sharedWith.putAll(publishedTo); this.versions.clear(); this.versions.addAll(versions); this.versionsPublishedBy.clear(); this.versionsPublishedBy.putAll(versionsPublishedBy); generateStatistics(); final XStream xstream = new XStream(); xstream.alias("container", PDFXMLContainer.class); xstream.alias("version", PDFXMLContainerVersion.class); xstream.alias("document", PDFXMLDocument.class); xstream.alias("user", PDFXMLUser.class); xstream.addImplicitCollection(PDFXMLContainer.class, "versions"); xstream.addImplicitCollection(PDFXMLContainerVersion.class, "documents"); xstream.addImplicitCollection(PDFXMLContainerVersion.class, "users"); xstream.toXML(createPDFXML(), newFileWriter(path)); } |
this.sharedWith.clear(); this.sharedWith.putAll(publishedTo); | void write( final String path, final Container container, final User containerCreatedBy, final List<ContainerVersion> versions, final Map<ContainerVersion, User> versionsPublishedBy, final Map<ContainerVersion, List<DocumentVersion>> documents, final Map<DocumentVersion, Long> documentsSize, final Map<ContainerVersion, Map<User, ArtifactReceipt>> publishedTo, final Map<ContainerVersion, Map<User, ArtifactReceipt>> sharedWith) throws IOException, TransformerException { this.container = container; this.containerCreatedBy = containerCreatedBy; this.documents.clear(); this.documents.putAll(documents); this.documentsSize.clear(); this.documentsSize.putAll(documentsSize); this.publishedTo.clear(); this.publishedTo.putAll(publishedTo); this.sharedWith.clear(); this.sharedWith.putAll(publishedTo); this.versions.clear(); this.versions.addAll(versions); this.versionsPublishedBy.clear(); this.versionsPublishedBy.putAll(versionsPublishedBy); generateStatistics(); final XStream xstream = new XStream(); xstream.alias("container", PDFXMLContainer.class); xstream.alias("version", PDFXMLContainerVersion.class); xstream.alias("document", PDFXMLDocument.class); xstream.alias("user", PDFXMLUser.class); xstream.addImplicitCollection(PDFXMLContainer.class, "versions"); xstream.addImplicitCollection(PDFXMLContainerVersion.class, "documents"); xstream.addImplicitCollection(PDFXMLContainerVersion.class, "users"); xstream.toXML(createPDFXML(), newFileWriter(path)); } |
|
public static File getFile(String resourcePath) { if (null == resourcePath) | public static File getFile(final String name) { if (null == name) | public static File getFile(String resourcePath) { if (null == resourcePath) return null; return new File(getURL(resourcePath).getFile()); } |
return new File(getURL(resourcePath).getFile()); | try { final URL url = getURL(name); if (null == url) return null; final String pathname = URLDecoder.decode( url.getFile(), SYSTEM_FILE_ENCODING); return new File(pathname); } catch (final UnsupportedEncodingException uex) { throw new RuntimeException(uex); } | public static File getFile(String resourcePath) { if (null == resourcePath) return null; return new File(getURL(resourcePath).getFile()); } |
super(doCompareAscending); | super(); | public NameComparator(final Boolean doCompareAscending) { super(doCompareAscending); this.comparator = new StringComparator(doCompareAscending); } |
final TabCell cell = (TabCell) tabJList.getModel().getElementAt(index); cell.setMouseOver(mouseOver); model.getListModel().removeElementAt(index); model.getListModel().add(index, cell); restoreSelection(); | if (index < tabJList.getModel().getSize()) { final TabCell cell = (TabCell) tabJList.getModel().getElementAt(index); cell.setMouseOver(mouseOver); model.getListModel().removeElementAt(index); model.getListModel().add(index, cell); restoreSelection(); } | private void updateCellMouseOver(final Integer index, final Boolean mouseOver) { saveSelection(); final TabCell cell = (TabCell) tabJList.getModel().getElementAt(index); cell.setMouseOver(mouseOver); model.getListModel().removeElementAt(index); model.getListModel().add(index, cell); restoreSelection(); } |
modifyDocument(OpheliaTestUser.JUNIT, document); | modifyDocument(OpheliaTestUser.JUNIT, document.getId()); | protected void setUp() throws Exception { super.setUp(); final File inputFile = getInputFile("JUnitTestFramework.txt"); final DocumentModel documentModel = getDocumentModel(OpheliaTestUser.JUNIT); final Document document = createDocument(OpheliaTestUser.JUNIT, inputFile); modifyDocument(OpheliaTestUser.JUNIT, document); final DocumentVersion version = createDocumentVersion(OpheliaTestUser.JUNIT, document); datum = new Fixture(documentModel, inputFile, version); } |
this.sortedBy = new ArrayList<Ordering>(); | this.sortedBy = new ArrayList<SortBy>(); | ArchiveTabModel(final TabPanelExtension extension) { super(extension); this.actionDelegate = new ArchiveTabActionDelegate(this); this.expandedState = new HashMap<TabPanel, Boolean>(); this.filteredPanels = new ArrayList<TabPanel>(); this.listModel = new DefaultListModel(); this.panels = new ArrayList<TabPanel>(); this.popupDelegate = new ArchiveTabPopupDelegate(this); this.sortedBy = new ArrayList<Ordering>(); this.visiblePanels = new ArrayList<TabPanel>(); } |
void applySort(final Ordering ordering, final Boolean ascending) { | void applySort(final SortBy sortBy) { | void applySort(final Ordering ordering, final Boolean ascending) { debug(); // if the sorted by stack already contains the ordering do nothing if (sortedBy.contains(ordering)) { if (sortedBy.get(sortedBy.indexOf( ordering)).isAscending().booleanValue() == ascending.booleanValue()) { return; } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.remove(ordering); sortedBy.add(ordering); synchronize(); } } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.add(ordering); synchronize(); } } |
if (sortedBy.contains(ordering)) { if (sortedBy.get(sortedBy.indexOf( ordering)).isAscending().booleanValue() == ascending.booleanValue()) { return; | if (isSortApplied(sortBy)) { if (sortBy.ascending) { sortBy.ascending = false; sortedBy.clear(); sortedBy.add(sortBy); | void applySort(final Ordering ordering, final Boolean ascending) { debug(); // if the sorted by stack already contains the ordering do nothing if (sortedBy.contains(ordering)) { if (sortedBy.get(sortedBy.indexOf( ordering)).isAscending().booleanValue() == ascending.booleanValue()) { return; } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.remove(ordering); sortedBy.add(ordering); synchronize(); } } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.add(ordering); synchronize(); } } |
ordering.setAscending(ascending); | void applySort(final Ordering ordering, final Boolean ascending) { debug(); // if the sorted by stack already contains the ordering do nothing if (sortedBy.contains(ordering)) { if (sortedBy.get(sortedBy.indexOf( ordering)).isAscending().booleanValue() == ascending.booleanValue()) { return; } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.remove(ordering); sortedBy.add(ordering); synchronize(); } } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.add(ordering); synchronize(); } } |
|
sortedBy.remove(ordering); sortedBy.add(ordering); synchronize(); | void applySort(final Ordering ordering, final Boolean ascending) { debug(); // if the sorted by stack already contains the ordering do nothing if (sortedBy.contains(ordering)) { if (sortedBy.get(sortedBy.indexOf( ordering)).isAscending().booleanValue() == ascending.booleanValue()) { return; } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.remove(ordering); sortedBy.add(ordering); synchronize(); } } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.add(ordering); synchronize(); } } |
|
ordering.setAscending(ascending); | sortBy.ascending = true; | void applySort(final Ordering ordering, final Boolean ascending) { debug(); // if the sorted by stack already contains the ordering do nothing if (sortedBy.contains(ordering)) { if (sortedBy.get(sortedBy.indexOf( ordering)).isAscending().booleanValue() == ascending.booleanValue()) { return; } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.remove(ordering); sortedBy.add(ordering); synchronize(); } } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.add(ordering); synchronize(); } } |
sortedBy.add(ordering); | sortedBy.add(sortBy); | void applySort(final Ordering ordering, final Boolean ascending) { debug(); // if the sorted by stack already contains the ordering do nothing if (sortedBy.contains(ordering)) { if (sortedBy.get(sortedBy.indexOf( ordering)).isAscending().booleanValue() == ascending.booleanValue()) { return; } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.remove(ordering); sortedBy.add(ordering); synchronize(); } } else { ordering.setAscending(ascending); sortedBy.clear(); sortedBy.add(ordering); synchronize(); } } |
String getString(final Ordering ordering) { | String getString(final SortBy sortBy) { | String getString(final Ordering ordering) { final StringBuffer pattern = new StringBuffer("ArchiveTab.{0}"); if (isSortApplied(ordering)) { pattern.append("_{1}"); if (ordering.isAscending()) { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "ASC")); } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "DESC")); } } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering)); } } |
if (isSortApplied(ordering)) { | if (isSortApplied(sortBy)) { | String getString(final Ordering ordering) { final StringBuffer pattern = new StringBuffer("ArchiveTab.{0}"); if (isSortApplied(ordering)) { pattern.append("_{1}"); if (ordering.isAscending()) { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "ASC")); } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "DESC")); } } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering)); } } |
if (ordering.isAscending()) { | if (sortBy.ascending) { | String getString(final Ordering ordering) { final StringBuffer pattern = new StringBuffer("ArchiveTab.{0}"); if (isSortApplied(ordering)) { pattern.append("_{1}"); if (ordering.isAscending()) { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "ASC")); } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "DESC")); } } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering)); } } |
MessageFormat.format(pattern.toString(), ordering, "ASC")); | MessageFormat.format(pattern.toString(), sortBy, "ASC")); | String getString(final Ordering ordering) { final StringBuffer pattern = new StringBuffer("ArchiveTab.{0}"); if (isSortApplied(ordering)) { pattern.append("_{1}"); if (ordering.isAscending()) { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "ASC")); } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "DESC")); } } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering)); } } |
MessageFormat.format(pattern.toString(), ordering, "DESC")); | MessageFormat.format(pattern.toString(), sortBy, "DESC")); | String getString(final Ordering ordering) { final StringBuffer pattern = new StringBuffer("ArchiveTab.{0}"); if (isSortApplied(ordering)) { pattern.append("_{1}"); if (ordering.isAscending()) { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "ASC")); } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "DESC")); } } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering)); } } |
MessageFormat.format(pattern.toString(), ordering)); | MessageFormat.format(pattern.toString(), sortBy)); | String getString(final Ordering ordering) { final StringBuffer pattern = new StringBuffer("ArchiveTab.{0}"); if (isSortApplied(ordering)) { pattern.append("_{1}"); if (ordering.isAscending()) { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "ASC")); } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering, "DESC")); } } else { return getExtension().getLocalization().getString( MessageFormat.format(pattern.toString(), ordering)); } } |
applySort(Ordering.CREATED_ON, Boolean.FALSE); | applySort(SortBy.CREATED_ON); | protected void initialize() { debug(); clearPanels(); final List<Container> containers = readContainers(); for (final Container container : containers) { addContainerPanel(container); } applySort(Ordering.CREATED_ON, Boolean.FALSE); debug(); } |
Boolean isSortApplied(final Ordering ordering) { | private boolean isSortApplied(final SortBy sortBy) { | Boolean isSortApplied(final Ordering ordering) { debug(); return sortedBy.contains(ordering); } |
return sortedBy.contains(ordering); | return sortedBy.contains(sortBy); | Boolean isSortApplied(final Ordering ordering) { debug(); return sortedBy.contains(ordering); } |
setSize(mainWindowSize); | setSize(BrowserWindow.this.getSize()); | public SemiTransparentJPanel(final Boolean enabled) { super(); setBorder(null); setOpaque(false); setSize(mainWindowSize); setLocation(0,0); this.enabled = enabled; } |
setSize(mainWindowSize); | setSize(BrowserWindow.this.getSize()); | public void paintComponent(final Graphics g) { super.paintComponent(g); if (enabled) { setSize(mainWindowSize); final Graphics2D g2 = (Graphics2D) g.create(); try { g2.setComposite(makeComposite(Colors.Browser.SemiTransparentLayer.LAYER_ALPHA)); g2.setPaint(Colors.Browser.SemiTransparentLayer.LAYER_COLOR); g2.fill(new Rectangle(mainWindowSize)); } finally { g2.dispose(); } } } |
g2.fill(new Rectangle(mainWindowSize)); | g2.fill(new Rectangle(BrowserWindow.this.getSize())); | public void paintComponent(final Graphics g) { super.paintComponent(g); if (enabled) { setSize(mainWindowSize); final Graphics2D g2 = (Graphics2D) g.create(); try { g2.setComposite(makeComposite(Colors.Browser.SemiTransparentLayer.LAYER_ALPHA)); g2.setPaint(Colors.Browser.SemiTransparentLayer.LAYER_COLOR); g2.fill(new Rectangle(mainWindowSize)); } finally { g2.dispose(); } } } |
roundCorners(); | private void initComponents() { mainPanel = new MainPanel(); add(mainPanel); roundCorners(); } |
|
private void initMenu() { final JMenuBar menuBar = new BrowserMenuBar(browser); | private void initMenu(final Boolean maximized) { final JMenuBar menuBar = new BrowserMenuBar(browser, maximized); | private void initMenu() { final JMenuBar menuBar = new BrowserMenuBar(browser); setJMenuBar(menuBar); } |
final Dimension size = getSize(); final Point location = getLocation(); setBounds(location.x, location.y, (int)size.getWidth(), (int)size.getHeight()); setMinimumSize(size); mainWindowSize.setSize(size); roundCorners(); validate(); repaint(); | if (maximize) { mainWindowSize.setSize(getSize()); mainWindowLocation.setLocation(getLocation()); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); setMaximizedBounds(env.getMaximumWindowBounds()); setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH); } else { setExtendedState(JFrame.NORMAL); } roundCorners(); | public void maximizeMainWindow(final Boolean maximize) { final Dimension size = getSize(); final Point location = getLocation(); setBounds(location.x, location.y, (int)size.getWidth(), (int)size.getHeight()); setMinimumSize(size); mainWindowSize.setSize(size); //if (!maximize) { roundCorners(); //} validate(); repaint(); } |
persistence.set("location", getLocation()); persistence.set("size", getMainWindowSize()); | if (browser.isBrowserWindowMaximized()) { persistence.set("location", getMainWindowLocation()); persistence.set("size", getMainWindowSize()); persistence.set("maximized", Boolean.TRUE); } else { persistence.set("location", getLocation()); persistence.set("size", getSize()); persistence.set("maximized", Boolean.FALSE); } | private void persist() { persistence.set("location", getLocation()); persistence.set("size", getMainWindowSize()); } |
this.components = new LinkedList<Component>(); this.mouseMotionAdapters = new HashMap<Component, MouseMotionAdapter>(50, 0.75F); this.mouseAdapters = new HashMap<Component, MouseAdapter>(50, 0.75F); | public Resizer(final Browser browser, final Component component, final Boolean supportMouseMove, final ResizeEdges resizeEdges) { this.browser = browser; this.component = component; this.supportMouseMove = supportMouseMove; this.resizeEdges = resizeEdges; initComponents(); } |
|
public BrowserMenuBar(final Browser browser) { | public BrowserMenuBar(final Browser browser, final Boolean maximized) { | public BrowserMenuBar(final Browser browser) { super(); this.browser = browser; this.localization = new JFrameLocalization("BrowserWindow.Menu"); this.popupItemFactory = PopupItemFactory.getInstance(); this.resizer = new Resizer(browser, this, Boolean.TRUE, Resizer.ResizeEdges.TOP); // Create JMenus final JMenu newMenu = MenuFactory.create(localization.getString("New"), new Integer(localization.getString("NewMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(6,0))); this.add(newMenu); final JMenu profileMenu = MenuFactory.create(localization.getString("Profile"), new Integer(localization.getString("ProfileMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(profileMenu); final JMenu helpMenu = MenuFactory.create(localization.getString("Help"), new Integer(localization.getString("HelpMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(helpMenu); // Create the New popup menu newMenu.add(popupItemFactory.createMenuPopupItem(ActionId.CONTAINER_CREATE, Data.emptyData())); newMenu.add(popupItemFactory.createMenuPopupItem(ActionId.CONTACT_CREATE_INCOMING_INVITATION, Data.emptyData())); // Create the Profile menu final Data updateProfileData = new Data(1); updateProfileData.set(Update.DataKey.DISPLAY_AVATAR, Boolean.TRUE); profileMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PROFILE_UPDATE, updateProfileData)); // Create the OpenHelp menu helpMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PLATFORM_BROWSER_OPEN_HELP, Data.emptyData())); helpMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PLATFORM_BROWSER_DISPLAY_INFO, Data.emptyData())); // Create the Sign-Up button this.add(Box.createRigidArea(new Dimension(5,0))); final JLabel label = new JLabel("Sign-Up"); label.setForeground(new Color(249, 162, 94, 255)); final String orig = label.getText(); label.setFont(Fonts.DefaultFontBold); label.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { final String text = label.getText(); label.setText(MessageFormat.format("<html><u>{0}</u></html>", text)); } @Override public void mouseExited(final MouseEvent e) { label.setText(MessageFormat.format("<html>{0}</html>", orig)); } }); this.add(label); //this.add(ButtonFactory.create(ActionId.PROFILE_SIGN_UP, Data.emptyData())); this.add(Box.createHorizontalGlue()); // Add minimize, maximize and close buttons this.add(getMinimizeButton()); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(getMaximizeButton()); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(getCloseButton()); this.add(Box.createRigidArea(new Dimension(4,0))); } |
this.add(Box.createRigidArea(new Dimension(5,0))); final JLabel label = new JLabel("Sign-Up"); label.setForeground(new Color(249, 162, 94, 255)); final String orig = label.getText(); label.setFont(Fonts.DefaultFontBold); label.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { final String text = label.getText(); label.setText(MessageFormat.format("<html><u>{0}</u></html>", text)); } @Override public void mouseExited(final MouseEvent e) { label.setText(MessageFormat.format("<html>{0}</html>", orig)); } }); this.add(label); | this.add(Box.createRigidArea(new Dimension(9,0))); this.add(getSignUpButton()); | public BrowserMenuBar(final Browser browser) { super(); this.browser = browser; this.localization = new JFrameLocalization("BrowserWindow.Menu"); this.popupItemFactory = PopupItemFactory.getInstance(); this.resizer = new Resizer(browser, this, Boolean.TRUE, Resizer.ResizeEdges.TOP); // Create JMenus final JMenu newMenu = MenuFactory.create(localization.getString("New"), new Integer(localization.getString("NewMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(6,0))); this.add(newMenu); final JMenu profileMenu = MenuFactory.create(localization.getString("Profile"), new Integer(localization.getString("ProfileMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(profileMenu); final JMenu helpMenu = MenuFactory.create(localization.getString("Help"), new Integer(localization.getString("HelpMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(helpMenu); // Create the New popup menu newMenu.add(popupItemFactory.createMenuPopupItem(ActionId.CONTAINER_CREATE, Data.emptyData())); newMenu.add(popupItemFactory.createMenuPopupItem(ActionId.CONTACT_CREATE_INCOMING_INVITATION, Data.emptyData())); // Create the Profile menu final Data updateProfileData = new Data(1); updateProfileData.set(Update.DataKey.DISPLAY_AVATAR, Boolean.TRUE); profileMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PROFILE_UPDATE, updateProfileData)); // Create the OpenHelp menu helpMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PLATFORM_BROWSER_OPEN_HELP, Data.emptyData())); helpMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PLATFORM_BROWSER_DISPLAY_INFO, Data.emptyData())); // Create the Sign-Up button this.add(Box.createRigidArea(new Dimension(5,0))); final JLabel label = new JLabel("Sign-Up"); label.setForeground(new Color(249, 162, 94, 255)); final String orig = label.getText(); label.setFont(Fonts.DefaultFontBold); label.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { final String text = label.getText(); label.setText(MessageFormat.format("<html><u>{0}</u></html>", text)); } @Override public void mouseExited(final MouseEvent e) { label.setText(MessageFormat.format("<html>{0}</html>", orig)); } }); this.add(label); //this.add(ButtonFactory.create(ActionId.PROFILE_SIGN_UP, Data.emptyData())); this.add(Box.createHorizontalGlue()); // Add minimize, maximize and close buttons this.add(getMinimizeButton()); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(getMaximizeButton()); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(getCloseButton()); this.add(Box.createRigidArea(new Dimension(4,0))); } |
this.add(getMaximizeButton()); | this.add(getMaximizeButton(maximized)); | public BrowserMenuBar(final Browser browser) { super(); this.browser = browser; this.localization = new JFrameLocalization("BrowserWindow.Menu"); this.popupItemFactory = PopupItemFactory.getInstance(); this.resizer = new Resizer(browser, this, Boolean.TRUE, Resizer.ResizeEdges.TOP); // Create JMenus final JMenu newMenu = MenuFactory.create(localization.getString("New"), new Integer(localization.getString("NewMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(6,0))); this.add(newMenu); final JMenu profileMenu = MenuFactory.create(localization.getString("Profile"), new Integer(localization.getString("ProfileMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(profileMenu); final JMenu helpMenu = MenuFactory.create(localization.getString("Help"), new Integer(localization.getString("HelpMnemonic").charAt(0))); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(helpMenu); // Create the New popup menu newMenu.add(popupItemFactory.createMenuPopupItem(ActionId.CONTAINER_CREATE, Data.emptyData())); newMenu.add(popupItemFactory.createMenuPopupItem(ActionId.CONTACT_CREATE_INCOMING_INVITATION, Data.emptyData())); // Create the Profile menu final Data updateProfileData = new Data(1); updateProfileData.set(Update.DataKey.DISPLAY_AVATAR, Boolean.TRUE); profileMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PROFILE_UPDATE, updateProfileData)); // Create the OpenHelp menu helpMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PLATFORM_BROWSER_OPEN_HELP, Data.emptyData())); helpMenu.add(popupItemFactory.createMenuPopupItem(ActionId.PLATFORM_BROWSER_DISPLAY_INFO, Data.emptyData())); // Create the Sign-Up button this.add(Box.createRigidArea(new Dimension(5,0))); final JLabel label = new JLabel("Sign-Up"); label.setForeground(new Color(249, 162, 94, 255)); final String orig = label.getText(); label.setFont(Fonts.DefaultFontBold); label.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { final String text = label.getText(); label.setText(MessageFormat.format("<html><u>{0}</u></html>", text)); } @Override public void mouseExited(final MouseEvent e) { label.setText(MessageFormat.format("<html>{0}</html>", orig)); } }); this.add(label); //this.add(ButtonFactory.create(ActionId.PROFILE_SIGN_UP, Data.emptyData())); this.add(Box.createHorizontalGlue()); // Add minimize, maximize and close buttons this.add(getMinimizeButton()); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(getMaximizeButton()); this.add(Box.createRigidArea(new Dimension(2,0))); this.add(getCloseButton()); this.add(Box.createRigidArea(new Dimension(4,0))); } |
if (!NO_NATIVE_SKIN) { | if (isRounded()) { | public void roundCorners(final Window window) { if (!NO_NATIVE_SKIN) { final Region region = NATIVE_SKIN.createRoundRectangleRegion(0, 0, window.getWidth() + 1, window.getHeight() + 1, 9, 9); NATIVE_SKIN.setWindowRegion(window, region, true); } } |
if(filter.doFilter(document)) { return null; } | if(null == document) { return null; } else if(filter.doFilter(document)) { return null; } | public MainProvider(final ArtifactModel artifactModel, final DocumentModel documentModel, final SystemMessageModel systemMessageModel) { super(); this.documentProvider = new SingleContentProvider() { public Object getElement(final Object input) { final Long documentId = (Long) ((Pair) input).getFirst(); final Filter<Artifact> filter = (Filter<Artifact>) ((Pair) input).getSecond(); try { final Document document = documentModel.get(documentId); if(filter.doFilter(document)) { return null; } else { return toDisplay(document, artifactModel); } } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.documentsProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { // sort by: // +> remote update ? later b4 earlier // +> last update ? later b4 earlier final AbstractArtifactComparator sort = new RemoteUpdatedOnComparator(Boolean.FALSE); sort.add(new UpdatedOnComparator(Boolean.FALSE)); final Filter<Artifact> filter = (Filter<Artifact>) input; final Collection<Document> documents; if(null != filter) { documents = documentModel.list(sort, filter); } else { documents = documentModel.list(sort); } return toDisplay(documents, artifactModel); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.systemMessageProvider = new SingleContentProvider() { public Object getElement(final Object input) { final Long systemMessageId = assertNotNullLong( "The main provider's system message provider " + "requires non-null java.lang.Long input.", input); final SystemMessage systemMessage; try { systemMessage = systemMessageModel.read(systemMessageId); } catch(final ParityException px) { throw new RuntimeException(px); } switch(systemMessage.getType()) { case INFO: case CONTACT_INVITATION: case CONTACT_INVITATION_RESPONSE: return systemMessage; case KEY_REQUEST: case KEY_RESPONSE: return null; default: throw Assert.createUnreachable("Unknown message type: " + systemMessage.getType()); } } }; this.systemMessagesProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { final Collection<SystemMessage> messages = systemMessageModel.readForNonArtifacts(); return messages.toArray(new SystemMessage[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.flatProviders = new FlatContentProvider[] {documentsProvider, systemMessagesProvider}; this.singleProviders = new SingleContentProvider[] {documentProvider, systemMessageProvider}; } |
if(filter.doFilter(document)) { return null; } | if(null == document) { return null; } else if(filter.doFilter(document)) { return null; } | public Object getElement(final Object input) { final Long documentId = (Long) ((Pair) input).getFirst(); final Filter<Artifact> filter = (Filter<Artifact>) ((Pair) input).getSecond(); try { final Document document = documentModel.get(documentId); if(filter.doFilter(document)) { return null; } else { return toDisplay(document, artifactModel); } } catch(final ParityException px) { throw new RuntimeException(px); } } |
this.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(final java.awt.event.MouseEvent e) { if (e.getButton()==MouseEvent.BUTTON1) { if (e.getClickCount() % 2 == 0) { getController().maximize(); } } } }); | public MainTitleAvatar() { super("BrowserTitle"); initComponents(); installResizer(); } |
|
void selectTab(final TabId tabId) { this.selectedTab = allTabs.get(tabId); | void selectTab(final TabListExtension tabListExtension) { this.selectedTab = pluginTabs.get(tabListExtension); | void selectTab(final TabId tabId) { this.selectedTab = allTabs.get(tabId); reloadDisplay(); } |
return MessageFormat.format("{0}.{2}", | return MessageFormat.format("{0}{1}", | public String fileName(final Document document) { return MessageFormat.format("{0}.{2}", FileUtil.getName(document.getName()), FileUtil.getExtension(document.getName())); } |
break; case REACTIVATE: history.add(customize(historyItem, (ReactivateEvent) auditEvent)); | public List<HistoryItem> build(final List<AuditEvent> auditEvents, final JabberId loggedInUser) throws ParityException { final List<HistoryItem> history = new LinkedList<HistoryItem>(); final ListIterator<AuditEvent> li = auditEvents.listIterator(); AuditEvent auditEvent; HistoryItem historyItem; while(li.hasNext()) { auditEvent = li.next(); historyItem = createCore(auditEvent); logger.debug(auditEvent); switch(auditEvent.getType()) { case ARCHIVE: history.add(customize(historyItem, (ArchiveEvent) auditEvent)); break; case CLOSE: history.add(customize(historyItem, (CloseEvent) auditEvent)); break; case CREATE: history.add(customize(historyItem, (CreateEvent) auditEvent)); break; case CREATE_REMOTE: history.add(applyCreateRemoteAttributes(historyItem, (CreateRemoteEvent) auditEvent)); break; case KEY_RESPONSE_DENIED: history.add(customize(historyItem, (KeyResponseDeniedEvent) auditEvent)); break; case KEY_REQUEST_DENIED: history.add(customize(historyItem, (KeyRequestDeniedEvent) auditEvent)); break; case PUBLISH: history.add(customize(historyItem, (PublishEvent) auditEvent)); break; case RECEIVE: history.add(customize(historyItem, (ReceiveEvent) auditEvent)); break; case RECEIVE_KEY: history.add(customize(historyItem, (ReceiveKeyEvent) auditEvent)); break; case RENAME: history.add(customize(historyItem, (RenameEvent) auditEvent)); break; case REQUEST_KEY: history.add(customize(historyItem, loggedInUser, (RequestKeyEvent) auditEvent)); break; case SEND: final SendEvent sendEvent = (SendEvent) auditEvent; final SendConfirmEvent confirmEvent = findConfirmation(auditEvents.listIterator(li.nextIndex()), sendEvent); history.add(customize(historyItem, sendEvent, confirmEvent)); break; case SEND_CONFIRM: // we do nothing break; case SEND_KEY: history.add(customize(historyItem, (SendKeyEvent) auditEvent)); break; case ADD_TEAM_MEMBER: final AddTeamMemberEvent atmEvent = (AddTeamMemberEvent) auditEvent; final AddTeamMemberConfirmEvent atmcEvent = findConfirmation(auditEvents.listIterator(li.nextIndex()), atmEvent); history.add(customize(historyItem, atmEvent, atmcEvent)); break; case ADD_TEAM_MEMBER_CONFIRM: // we do nothing break; default: logger.warn("[LMODEL] [DOCUMENT] [BUILD HISTORY] [UNSUPPORTED AUDIT EVENT {0}]"); } } return history; } |
|
Filter discrininatorFilter = this.createFilter(query.getFilter().getFilterClass()); if ( ! classDescriptor.isAbstract()) { FieldDescriptor fieldDescriptor = classDescriptor.getDiscriminatorFieldDescriptor(); discrininatorFilter.addEqualTo(fieldDescriptor.getFieldName(), classDescriptor.getClassName()); } if (classDescriptor.hasDescendants()) { Iterator descendantDescriptorIterator = classDescriptor.getDescendantClassDescriptors().iterator(); while (descendantDescriptorIterator.hasNext()) { ClassDescriptor descendantClassDescriptor = (ClassDescriptor)descendantDescriptorIterator.next(); discrininatorFilter = discrininatorFilter.addOrFilter( this.buildDiscriminatorFilter(query, descendantClassDescriptor)); } } return discrininatorFilter; } | Filter discriminatorFilter = this.createFilter(query.getFilter().getFilterClass()); if (!classDescriptor.isAbstract()) { FieldDescriptor fieldDescriptor = classDescriptor.getDiscriminatorFieldDescriptor(); discriminatorFilter.addEqualTo(fieldDescriptor.getFieldName(), classDescriptor.getClassName()); } if (classDescriptor.hasDescendants()) { Iterator descendantDescriptorIterator = classDescriptor.getDescendantClassDescriptors().iterator(); while (descendantDescriptorIterator.hasNext()) { ClassDescriptor descendantClassDescriptor = (ClassDescriptor) descendantDescriptorIterator.next(); discriminatorFilter = discriminatorFilter.addOrFilter( this.buildDiscriminatorFilter(query, descendantClassDescriptor)); } } return discriminatorFilter; } | private Filter buildDiscriminatorFilter(Query query, ClassDescriptor classDescriptor) { Filter discrininatorFilter = this.createFilter(query.getFilter().getFilterClass()); if ( ! classDescriptor.isAbstract()) { FieldDescriptor fieldDescriptor = classDescriptor.getDiscriminatorFieldDescriptor(); discrininatorFilter.addEqualTo(fieldDescriptor.getFieldName(), classDescriptor.getClassName()); } if (classDescriptor.hasDescendants()) { Iterator descendantDescriptorIterator = classDescriptor.getDescendantClassDescriptors().iterator(); while (descendantDescriptorIterator.hasNext()) { ClassDescriptor descendantClassDescriptor = (ClassDescriptor)descendantDescriptorIterator.next(); //Add subdescendant discriminator value discrininatorFilter = discrininatorFilter.addOrFilter( this.buildDiscriminatorFilter(query, descendantClassDescriptor)); } } return discrininatorFilter; } |
Filter filter = query.getFilter(); ClassDescriptor classDescriptor = mapper.getClassDescriptor(filter.getFilterClass()); if (classDescriptor.hasDiscriminatorField()) { Filter discrininatorFilter = buildDiscriminatorFilter(query, classDescriptor); filter = filter.addAndFilter(discrininatorFilter); } String jcrExp = ""; if ((filter.getScope() != null && ( ! filter.getScope().equals("")))) { jcrExp += "/jcr:root" + filter.getScope() + "element(*, "; } else { jcrExp += " } jcrExp += this.getNodeType(filter) + ") "; | Filter filter = query.getFilter(); ClassDescriptor classDescriptor = mapper.getClassDescriptor(filter.getFilterClass()); if (classDescriptor.hasDiscriminatorField()) { Filter discrininatorFilter = buildDiscriminatorFilter(query, classDescriptor); filter = filter.addAndFilter(discrininatorFilter); } String jcrExp = ""; if (((filter.getScope() != null) && (!filter.getScope().equals("")))) { jcrExp += "/jcr:root" + filter.getScope() + "element(*, "; } else { jcrExp += " } jcrExp += this.getNodeType(filter) + ") "; | public String buildJCRExpression(Query query) { Filter filter = query.getFilter(); // Check if the class has an inheritance discriminator field ClassDescriptor classDescriptor = mapper.getClassDescriptor(filter.getFilterClass()); if (classDescriptor.hasDiscriminatorField()) { Filter discrininatorFilter = buildDiscriminatorFilter(query, classDescriptor); filter = filter.addAndFilter(discrininatorFilter); } String jcrExp = ""; // Add scope if ((filter.getScope() != null && ( ! filter.getScope().equals("")))) { jcrExp += "/jcr:root" + filter.getScope() + "element(*, "; } else { jcrExp += "//element(*, "; } // Add node type jcrExp += this.getNodeType(filter) + ") "; // Add filter criteria String filterExp = ((FilterImpl)filter).getJcrExpression(); // Build the jcr filter if ((filterExp != null) && ( ! filterExp.equals(""))) { jcrExp += "[" + filterExp + "]"; } // Add order by jcrExp += ((QueryImpl)query).getOrderByExpression(); return jcrExp; } |
return this.jcrExpression; | return this.jcrExpression.toString(); | public String getJcrExpression() { return this.jcrExpression; } |
this.claszz = clazz; | this.clazz = clazz; | public FilterImpl(ClassDescriptor classDescriptor, Map atomicTypeConverters, Class clazz) { this.claszz = clazz; this.atomicTypeConverters = atomicTypeConverters; this.classDescriptor = classDescriptor; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.