bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
---|---|---|
public static RubyString unmarshalFrom(UnmarshalStream input) throws java.io.IOException { return RubyString.newString(input.getRuntime(), input.unmarshalString()); }
|
public static RubyString unmarshalFrom(UnmarshalStream input) throws java.io.IOException { return RubyString.newString(input.getRuntime(), input.unmarshalString()); }
| 3,239,183 |
protected void onPlayerStateChange() { switch (state) { case START: if (historyState == Player.PAUSE) { switch (index) { case ACROSS_Z: //if (movieType == BACKWARD) frameNumberZ = endZ; //else frameNumberZ = startZ; break; case ACROSS_T: //if (movieType == BACKWARD) frameNumberT = endT; //else frameNumberT = startT; break; } } timer.start(); break; case STOP: timer.stop(); setFrameNumbers(); up = true; } }
|
protected void onPlayerStateChange() { switch (state) { case START: if (historyState == Player.PAUSE) { switch (index) { case ACROSS_Z: //if (movieType == BACKWARD) frameNumberZ = endZ; //else frameNumberZ = startZ; break; case ACROSS_T: //if (movieType == BACKWARD) frameNumberT = endT; //else frameNumberT = startT; break; } } timer.start(); break; case STOP: timer.stop(); setFrameNumbers(); up = true; } }
| 3,239,184 |
public static void main(final String[] args) { /* * EnhancedDebuggerWindow.PERSISTED_DEBUGGER = true; * EnhancedDebuggerWindow.MAX_TABLE_ROWS = 10; * XMPPConnection.DEBUG_ENABLED = true; */ String current = System.getProperty("java.library.path"); String classPath = System.getProperty("java.class.path"); // Set UIManager properties for JTree System.setProperty("apple.laf.useScreenMenuBar", "true"); /** Update Library Path **/ StringBuffer buf = new StringBuffer(); buf.append(current); buf.append(";"); final String workingDirectory = System.getProperty("appdir"); if (workingDirectory == null) { RESOURCE_DIRECTORY = new File(USER_HOME, "/Spark/resources").getAbsoluteFile(); BIN_DIRECTORY = new File(USER_HOME, "/Spark/bin").getAbsoluteFile(); LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile(); RESOURCE_DIRECTORY.mkdirs(); LOG_DIRECTORY.mkdirs(); if (!RESOURCE_DIRECTORY.exists() || !LOG_DIRECTORY.exists()) { JOptionPane.showMessageDialog(new JFrame(), "Unable to create directories necessary for runtime.", "Spark Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } } // This is the Spark.exe or Spark.dmg installed executable. else { // This is the installed executable. File workingDir = new File(workingDirectory); RESOURCE_DIRECTORY = new File(workingDir, "resources").getAbsoluteFile(); BIN_DIRECTORY = new File(workingDir, "bin").getAbsoluteFile(); LOG_DIRECTORY = new File(workingDir, "logs").getAbsoluteFile(); LOG_DIRECTORY.mkdirs(); try { buf.append(RESOURCE_DIRECTORY.getCanonicalPath()).append(";"); } catch (IOException e) { e.printStackTrace(); } } buf.append(classPath); // Update System Properties System.setProperty("java.library.path", buf.toString()); System.setProperty("sun.java2d.noddraw", "true"); SwingUtilities.invokeLater(new Runnable() { public void run() { // Start Application new Spark(); } }); // Handle arguments if (args.length > 0) { argument = args[0]; } }
|
public static void main(final String[] args) { /* * EnhancedDebuggerWindow.PERSISTED_DEBUGGER = true; * EnhancedDebuggerWindow.MAX_TABLE_ROWS = 10; * XMPPConnection.DEBUG_ENABLED = true; */ String current = System.getProperty("java.library.path"); String classPath = System.getProperty("java.class.path"); // Set UIManager properties for JTree System.setProperty("apple.laf.useScreenMenuBar", "true"); /** Update Library Path **/ StringBuffer buf = new StringBuffer(); buf.append(current); buf.append(";"); final String workingDirectory = System.getProperty("appdir"); if (workingDirectory == null) { RESOURCE_DIRECTORY = new File(USER_HOME, "/Spark/resources").getAbsoluteFile(); BIN_DIRECTORY = new File(USER_HOME, "/Spark/bin").getAbsoluteFile(); LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile(); RESOURCE_DIRECTORY.mkdirs(); LOG_DIRECTORY.mkdirs(); if (!RESOURCE_DIRECTORY.exists() || !LOG_DIRECTORY.exists()) { JOptionPane.showMessageDialog(new JFrame(), "Unable to create directories necessary for runtime.", "Spark Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } } // This is the Spark.exe or Spark.dmg installed executable. else { // This is the installed executable. File workingDir = new File(workingDirectory); RESOURCE_DIRECTORY = new File(workingDir, "resources").getAbsoluteFile(); BIN_DIRECTORY = new File(workingDir, "bin").getAbsoluteFile(); if (!Spark.isWindows()) { LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile(); } else { LOG_DIRECTORY = new File(workingDir, "logs").getAbsoluteFile(); } LOG_DIRECTORY.mkdirs(); try { buf.append(RESOURCE_DIRECTORY.getCanonicalPath()).append(";"); } catch (IOException e) { e.printStackTrace(); } } buf.append(classPath); // Update System Properties System.setProperty("java.library.path", buf.toString()); System.setProperty("sun.java2d.noddraw", "true"); SwingUtilities.invokeLater(new Runnable() { public void run() { // Start Application new Spark(); } }); // Handle arguments if (args.length > 0) { argument = args[0]; } }
| 3,239,186 |
public IRubyObject cmp(IRubyObject other) { if (!(other instanceof RubyNumeric)) { return getRuntime().getNil(); } return getRuntime().newFixnum(compareValue((RubyNumeric) other)); }
|
public IRubyObject cmp(IRubyObject other) { if (!(other instanceof RubyNumeric)) { return getRuntime().getNil(); } return getRuntime().newFixnum(compareValue((RubyNumeric) other)); }
| 3,239,187 |
public HTMLReport(Coverage coverage, File outputDir, File sourceDir) throws Exception { this.outputDir = outputDir; this.sourceDir = sourceDir; this.coverage = coverage; removeNonexistantClasses(); CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
|
public HTMLReport(Coverage coverage, File outputDir, File sourceDir) throws Exception { this.outputDir = outputDir; this.sourceDir = sourceDir; this.coverage = coverage; removeNonexistantClasses(); CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
| 3,239,188 |
public ImageCanvas(ViewerUIF view) { this.view = view; magFactor = 1.0; setBackground(Viewer.BACKGROUND_COLOR); setDoubleBuffered(true); }
|
public ImageCanvas(ViewerUIF view) { this.view = view; magFactor = 1.0; setBackground(Viewer.BACKGROUND_COLOR); setDoubleBuffered(true); }
| 3,239,189 |
public ImageCanvas(ViewerUIF view) { this.view = view; magFactor = 1.0; setBackground(Viewer.BACKGROUND_COLOR); setDoubleBuffered(true); }
|
public ImageCanvas(ViewerUIF view) { this.view = view; magFactor = 1.0; setBackground(Viewer.BACKGROUND_COLOR); setDoubleBuffered(true); }
| 3,239,190 |
public BufferedImage getDisplayImage() { //Now we only need to tell Java2D how to handle the RGB buffer. int sizeX = displayImage.getWidth(); int sizeY = displayImage.getHeight(); DataBufferByte buffer = new DataBufferByte(sizeX*sizeY, 3); DataBuffer dataBuf = displayImage.getRaster().getDataBuffer(); ColorModel cm = displayImage.getColorModel(); int v; for (int y = 0; y < sizeY; ++y) { for (int x = 0; x < sizeX; ++x) { v = dataBuf.getElem(0, sizeX*y+x); buffer.setElem(0, sizeX*y+x, cm.getRed(v)); buffer.setElem(1, sizeX*y+x, cm.getGreen(v)); buffer.setElem(2, sizeX*y+x, cm.getBlue(v)); } } ComponentColorModel ccm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3); return new BufferedImage(ccm, Raster.createWritableRaster(csm, buffer, null), false, null); }
|
public BufferedImage getDisplayImage() { //Now we only need to tell Java2D how to handle the RGB buffer. int sizeX = displayImage.getWidth(); int sizeY = displayImage.getHeight(); DataBufferByte buffer = new DataBufferByte(sizeX*sizeY, 3); DataBuffer dataBuf = displayImage.getRaster().getDataBuffer(); ColorModel cm = displayImage.getColorModel(); int v; for (int y = 0; y < sizeY; ++y) { for (int x = 0; x < sizeX; ++x) { v = dataBuf.getElem(0, sizeX*y+x); buffer.setElem(0, sizeX*y+x, cm.getRed(v)); buffer.setElem(1, sizeX*y+x, cm.getGreen(v)); buffer.setElem(2, sizeX*y+x, cm.getBlue(v)); } } ComponentColorModel ccm = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB), null, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); BandedSampleModel csm = new BandedSampleModel(DataBuffer.TYPE_BYTE, sizeX, sizeY, 3); return new BufferedImage(ccm, Raster.createWritableRaster(csm, buffer, null), false, null); }
| 3,239,191 |
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
|
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
| 3,239,192 |
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
|
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
| 3,239,193 |
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
|
public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; setLocation(); paintXYFrame(g2D); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setColor(Color.black); if (displayImage != null) g2D.drawImage(displayImage, null, ViewerUIF.START, ViewerUIF.START); }
| 3,239,194 |
public void paintImage(BufferedImage image) { this.image = image; if (image != null) { paintImage(magFactor, (int) (image.getWidth()*magFactor)+2*ViewerUIF.START, (int) (image.getHeight()*magFactor)+2*ViewerUIF.START); } }
|
public void paintImage(BufferedImage image) { this.image = image; if (image != null) { paintImage(magFactor, (int) (image.getWidth()*magFactor)+2*ViewerUIF.START, (int) (image.getHeight()*magFactor)+2*ViewerUIF.START); } }
| 3,239,195 |
public void paintImage(BufferedImage image) { this.image = image; if (image != null) { paintImage(magFactor, (int) (image.getWidth()*magFactor)+2*ViewerUIF.START, (int) (image.getHeight()*magFactor)+2*ViewerUIF.START); } }
|
public void paintImage(BufferedImage image) { this.image = image; if (image != null) { paintImage(magFactor, (int) (image.getWidth()*magFactor)+2*ViewerUIF.START, (int) (image.getHeight()*magFactor)+2*ViewerUIF.START); } }
| 3,239,196 |
private void paintXYFrame(Graphics2D g2D) { FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight()/4; //x-axis int x1 = ViewerUIF.START-ViewerUIF.ORIGIN; int y1 = ViewerUIF.START-ViewerUIF.ORIGIN; g2D.drawLine(x1, y1, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1-ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1+ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); //y-axis g2D.drawLine(x1, y1, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1-ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1+ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); //name g2D.drawString("o", x1-hFont, y1-hFont); g2D.drawString("x", x1+ViewerUIF.LENGTH/2, y1-hFont); g2D.drawString("y", x1-2*hFont, y1+ViewerUIF.LENGTH-hFont); }
|
private void paintXYFrame(Graphics2D g2D) { FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight()/4; //x-axis int x1 = ViewerUIF.START-ViewerUIF.ORIGIN; int y1 = ViewerUIF.START-ViewerUIF.ORIGIN; g2D.drawLine(x1, y1, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1-ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); g2D.drawLine(x1-ViewerUIF.ARROW+ViewerUIF.LENGTH, y1+ViewerUIF.ARROW, x1+ViewerUIF.LENGTH, y1); //y-axis g2D.drawLine(x1, y1, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1-ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); g2D.drawLine(x1+ViewerUIF.ARROW, ViewerUIF.LENGTH+y1-ViewerUIF.ARROW, x1, ViewerUIF.LENGTH+y1); //name g2D.drawString("o", x1-hFont, y1-hFont); g2D.drawString("x", x1+ViewerUIF.LENGTH/2, y1-hFont); g2D.drawString("y", x1-2*hFont, y1+ViewerUIF.LENGTH-hFont); }
| 3,239,197 |
private void setLocation() { Rectangle r = view.getScrollPane().getViewportBorderBounds(); x = ((r.width-w)/2); y = ((r.height-h)/2); if (x < 0) x = 0; if (y < 0) y = 0; setBounds(x, y, w, h); }
|
private void setLocation() { Rectangle r = view.getScrollPane().getViewportBorderBounds(); x = ((r.width-w)/2); y = ((r.height-h)/2); if (x < 0) x = 0; if (y < 0) y = 0; setBounds(x, y, w, h); }
| 3,239,198 |
private void setLocation() { Rectangle r = view.getScrollPane().getViewportBorderBounds(); x = ((r.width-w)/2); y = ((r.height-h)/2); if (x < 0) x = 0; if (y < 0) y = 0; setBounds(x, y, w, h); }
|
private void setLocation() { Rectangle r = view.getScrollPane().getViewportBorderBounds(); x = ((r.width-w)/2); y = ((r.height-h)/2); if (x < 0) x = 0; if (y < 0) y = 0; setBounds(x, y, w, h); }
| 3,239,199 |
private boolean isRescueHandled(Ruby ruby, RubyObject self, Node node) { // TMP_PROTECT; if (node.getArgsNode() == null) { // return ruby.getActException().m_kind_of(ruby.getExceptions().getStandardError()).isTrue(); } RubyBlock tmpBlock = ArgsUtil.beginCallArgs(ruby); RubyObject[] args = ArgsUtil.setupArgs(ruby, self, node.getArgsNode()); ArgsUtil.endCallArgs(ruby, tmpBlock); for (int i = 0; i < args.length; i++) { if (args[i].m_kind_of(ruby.getClasses().getModuleClass()).isFalse()) { throw new RubyTypeException("class or module required for rescue clause"); } if (ruby.getActException().m_kind_of((RubyModule)args[i]).isTrue()) { return true; } } return false; }
|
private boolean isRescueHandled(Ruby ruby, RubyObject self, Node node) { // TMP_PROTECT; if (node.getArgsNode() == null) { // return ruby.getActException().m_kind_of(ruby.getExceptions().getStandardError()).isTrue(); } RubyBlock tmpBlock = ArgsUtil.beginCallArgs(ruby); RubyPointer args = ArgsUtil.setupArgs(ruby, self, node.getArgsNode()); ArgsUtil.endCallArgs(ruby, tmpBlock); for (int i = 0; i < args.length; i++) { if (args[i].m_kind_of(ruby.getClasses().getModuleClass()).isFalse()) { throw new RubyTypeException("class or module required for rescue clause"); } if (ruby.getActException().m_kind_of((RubyModule)args[i]).isTrue()) { return true; } } return false; }
| 3,239,200 |
private boolean isRescueHandled(Ruby ruby, RubyObject self, Node node) { // TMP_PROTECT; if (node.getArgsNode() == null) { // return ruby.getActException().m_kind_of(ruby.getExceptions().getStandardError()).isTrue(); } RubyBlock tmpBlock = ArgsUtil.beginCallArgs(ruby); RubyObject[] args = ArgsUtil.setupArgs(ruby, self, node.getArgsNode()); ArgsUtil.endCallArgs(ruby, tmpBlock); for (int i = 0; i < args.length; i++) { if (args[i].m_kind_of(ruby.getClasses().getModuleClass()).isFalse()) { throw new RubyTypeException("class or module required for rescue clause"); } if (ruby.getActException().m_kind_of((RubyModule)args[i]).isTrue()) { return true; } } return false; }
|
private boolean isRescueHandled(Ruby ruby, RubyObject self, Node node) { // TMP_PROTECT; if (node.getArgsNode() == null) { // return ruby.getActException().m_kind_of(ruby.getExceptions().getStandardError()).isTrue(); } RubyBlock tmpBlock = ArgsUtil.beginCallArgs(ruby); RubyObject[] args = ArgsUtil.setupArgs(ruby, self, node.getArgsNode()); ArgsUtil.endCallArgs(ruby, tmpBlock); for (int i = 0; i < args.length; i++) { if (args[i].m_kind_of(ruby.getClasses().getModuleClass()).isFalse()) { throw new RubyTypeException("class or module required for rescue clause"); } if (ruby.getActException().m_kind_of((RubyModule)args[i]).isTrue()) { return true; } } return false; }
| 3,239,201 |
private boolean isRescueHandled(Ruby ruby, RubyObject self, Node node) { // TMP_PROTECT; if (node.getArgsNode() == null) { // return ruby.getActException().m_kind_of(ruby.getExceptions().getStandardError()).isTrue(); } RubyBlock tmpBlock = ArgsUtil.beginCallArgs(ruby); RubyObject[] args = ArgsUtil.setupArgs(ruby, self, node.getArgsNode()); ArgsUtil.endCallArgs(ruby, tmpBlock); for (int i = 0; i < args.length; i++) { if (args[i].m_kind_of(ruby.getClasses().getModuleClass()).isFalse()) { throw new RubyTypeException("class or module required for rescue clause"); } if (ruby.getActException().m_kind_of((RubyModule)args[i]).isTrue()) { return true; } } return false; }
|
private boolean isRescueHandled(Ruby ruby, RubyObject self, Node node) { // TMP_PROTECT; if (node.getArgsNode() == null) { // return ruby.getActException().m_kind_of(ruby.getExceptions().getStandardError()).isTrue(); } RubyBlock tmpBlock = ArgsUtil.beginCallArgs(ruby); RubyObject[] args = ArgsUtil.setupArgs(ruby, self, node.getArgsNode()); ArgsUtil.endCallArgs(ruby, tmpBlock); for (int i = 0; i < args.length; i++) { if (args[i].m_kind_of(ruby.getClasses().getModuleClass()).isFalse()) { throw new RubyTypeException("class or module required for rescue clause"); } if (ruby.getActException().m_kind_of((RubyModule)args.getRuby(i)).isTrue()) { return true; } } return false; }
| 3,239,202 |
public static void parseTemplate(String name, Reader in) { try { Builder bb = parser.parseBlock(name, in); Block b = (Block) bb.build(new BuildContext(broker)); } catch (Exception e) { System.err.println("Exception parsing template " + name + "\n" + e); } }
|
public static void parseTemplate(String name, Reader in) { try { Builder bb = parser.parseBlock(name, in); bb.build(new BuildContext(broker)); } catch (Exception e) { System.err.println("Exception parsing template " + name + "\n" + e); } }
| 3,239,203 |
public SendMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setText("Cancel"); retryButton.setText("Retry"); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(retryButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); retryButton.setVisible(false); retryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); } }); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); retryButton.setForeground(new Color(73, 113, 196)); retryButton.setFont(new Font("Verdana", Font.BOLD, 10)); retryButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); }
|
public SendMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Dialog", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setText("Cancel"); retryButton.setText("Retry"); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(retryButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); retryButton.setVisible(false); retryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); } }); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); retryButton.setForeground(new Color(73, 113, 196)); retryButton.setFont(new Font("Verdana", Font.BOLD, 10)); retryButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); }
| 3,239,204 |
public SendMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setText("Cancel"); retryButton.setText("Retry"); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(retryButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); retryButton.setVisible(false); retryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); } }); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); retryButton.setForeground(new Color(73, 113, 196)); retryButton.setFont(new Font("Verdana", Font.BOLD, 10)); retryButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); }
|
public SendMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setText("Cancel"); retryButton.setText("Retry"); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(retryButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); retryButton.setVisible(false); retryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); } }); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); retryButton.setForeground(new Color(73, 113, 196)); retryButton.setFont(new Font("Verdana", Font.BOLD, 10)); retryButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); }
| 3,239,205 |
public SendMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setText("Cancel"); retryButton.setText("Retry"); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(retryButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); retryButton.setVisible(false); retryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); } }); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); retryButton.setForeground(new Color(73, 113, 196)); retryButton.setFont(new Font("Verdana", Font.BOLD, 10)); retryButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); }
|
public SendMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setText("Cancel"); retryButton.setText("Retry"); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(retryButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); retryButton.setVisible(false); retryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); } }); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Dialog", Font.BOLD, 10)); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); retryButton.setForeground(new Color(73, 113, 196)); retryButton.setFont(new Font("Verdana", Font.BOLD, 10)); retryButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); }
| 3,239,206 |
public SendMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setText("Cancel"); retryButton.setText("Retry"); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(retryButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); retryButton.setVisible(false); retryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); } }); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); retryButton.setForeground(new Color(73, 113, 196)); retryButton.setFont(new Font("Verdana", Font.BOLD, 10)); retryButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); }
|
public SendMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setText("Cancel"); retryButton.setText("Retry"); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(retryButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); retryButton.setVisible(false); retryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); } }); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); retryButton.setForeground(new Color(73, 113, 196)); retryButton.setFont(new Font("Dialog", Font.BOLD, 10)); retryButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); }
| 3,239,207 |
private void makeClickable(final JLabel label) { label.setToolTipText("Click to open"); label.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { openFile(fileToSend); } public void mouseEntered(MouseEvent e) { label.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { label.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
|
private void makeClickable(final JLabel label) { label.setToolTipText(Res.getString("message.click.to.open")); label.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { openFile(fileToSend); } public void mouseEntered(MouseEvent e) { label.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { label.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
| 3,239,208 |
public void sendFile(final OutgoingFileTransfer transfer, FileTransferManager transferManager, final String jid, final String nickname) { this.transferManager = transferManager; cancelButton.setVisible(true); retryButton.setVisible(false); this.fullJID = jid; this.nickname = nickname; this.transfer = transfer; String fileName = transfer.getFileName(); long fileSize = transfer.getFileSize(); ByteFormat format = new ByteFormat(); String text = format.format(fileSize); fileToSend = new File(transfer.getFilePath()); fileLabel.setText(fileName + " (" + text + ")"); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(jid); titleLabel.setText("Waiting for " + contactItem.getNickname() + " to accept file transfer."); if (isImage(fileName)) { try { URL imageURL = new File(transfer.getFilePath()).toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } else { File file = new File(transfer.getFilePath()); Icon icon = GraphicUtils.getIcon(file); imageLabel.setIcon(icon); } cancelButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { transfer.cancel(); } }); cancelButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); progressBar.setMaximum((int)fileSize); progressBar.setVisible(false); progressBar.setStringPainted(true); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); SwingWorker worker = new SwingWorker() { public Object construct() { while (true) { try { Thread.sleep(10); FileTransfer.Status status = transfer.getStatus(); if (status == Status.ERROR || status == Status.COMPLETE || status == Status.CANCLED || status == Status.REFUSED) { break; } updateBar(transfer, nickname); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } } return ""; } public void finished() { updateBar(transfer, nickname); } }; worker.start(); makeClickable(imageLabel); makeClickable(titleLabel); }
|
public void sendFile(final OutgoingFileTransfer transfer, FileTransferManager transferManager, final String jid, final String nickname) { this.transferManager = transferManager; cancelButton.setVisible(true); retryButton.setVisible(false); this.fullJID = jid; this.nickname = nickname; this.transfer = transfer; String fileName = transfer.getFileName(); long fileSize = transfer.getFileSize(); ByteFormat format = new ByteFormat(); String text = format.format(fileSize); fileToSend = new File(transfer.getFilePath()); fileLabel.setText(fileName + " (" + text + ")"); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(jid); titleLabel.setText(Res.getString("message.transfer.waiting.on.user", contactItem.getNickname())); if (isImage(fileName)) { try { URL imageURL = new File(transfer.getFilePath()).toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } else { File file = new File(transfer.getFilePath()); Icon icon = GraphicUtils.getIcon(file); imageLabel.setIcon(icon); } cancelButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { transfer.cancel(); } }); cancelButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); progressBar.setMaximum((int)fileSize); progressBar.setVisible(false); progressBar.setStringPainted(true); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); SwingWorker worker = new SwingWorker() { public Object construct() { while (true) { try { Thread.sleep(10); FileTransfer.Status status = transfer.getStatus(); if (status == Status.ERROR || status == Status.COMPLETE || status == Status.CANCLED || status == Status.REFUSED) { break; } updateBar(transfer, nickname); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } } return ""; } public void finished() { updateBar(transfer, nickname); } }; worker.start(); makeClickable(imageLabel); makeClickable(titleLabel); }
| 3,239,209 |
public void sendFile(final OutgoingFileTransfer transfer, FileTransferManager transferManager, final String jid, final String nickname) { this.transferManager = transferManager; cancelButton.setVisible(true); retryButton.setVisible(false); this.fullJID = jid; this.nickname = nickname; this.transfer = transfer; String fileName = transfer.getFileName(); long fileSize = transfer.getFileSize(); ByteFormat format = new ByteFormat(); String text = format.format(fileSize); fileToSend = new File(transfer.getFilePath()); fileLabel.setText(fileName + " (" + text + ")"); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(jid); titleLabel.setText("Waiting for " + contactItem.getNickname() + " to accept file transfer."); if (isImage(fileName)) { try { URL imageURL = new File(transfer.getFilePath()).toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } else { File file = new File(transfer.getFilePath()); Icon icon = GraphicUtils.getIcon(file); imageLabel.setIcon(icon); } cancelButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { transfer.cancel(); } }); cancelButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); progressBar.setMaximum((int)fileSize); progressBar.setVisible(false); progressBar.setStringPainted(true); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); SwingWorker worker = new SwingWorker() { public Object construct() { while (true) { try { Thread.sleep(10); FileTransfer.Status status = transfer.getStatus(); if (status == Status.ERROR || status == Status.COMPLETE || status == Status.CANCLED || status == Status.REFUSED) { break; } updateBar(transfer, nickname); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } } return ""; } public void finished() { updateBar(transfer, nickname); } }; worker.start(); makeClickable(imageLabel); makeClickable(titleLabel); }
|
public void sendFile(final OutgoingFileTransfer transfer, FileTransferManager transferManager, final String jid, final String nickname) { this.transferManager = transferManager; cancelButton.setVisible(true); retryButton.setVisible(false); this.fullJID = jid; this.nickname = nickname; this.transfer = transfer; String fileName = transfer.getFileName(); long fileSize = transfer.getFileSize(); ByteFormat format = new ByteFormat(); String text = format.format(fileSize); fileToSend = new File(transfer.getFilePath()); fileLabel.setText(fileName + " (" + text + ")"); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(jid); titleLabel.setText("Waiting for " + contactItem.getNickname() + " to accept file transfer."); if (isImage(fileName)) { try { URL imageURL = new File(transfer.getFilePath()).toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } else { File file = new File(transfer.getFilePath()); Icon icon = GraphicUtils.getIcon(file); imageLabel.setIcon(icon); } cancelButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { transfer.cancel(); } }); cancelButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); progressBar.setMaximum((int)fileSize); progressBar.setVisible(false); progressBar.setStringPainted(true); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); SwingWorker worker = new SwingWorker() { public Object construct() { while (true) { try { Thread.sleep(10); FileTransfer.Status status = transfer.getStatus(); if (status == Status.ERROR || status == Status.COMPLETE || status == Status.CANCLED || status == Status.REFUSED) { break; } updateBar(transfer, nickname); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } } return ""; } public void finished() { updateBar(transfer, nickname); } }; worker.start(); makeClickable(imageLabel); makeClickable(titleLabel); }
| 3,239,210 |
public Object construct() { while (true) { try { Thread.sleep(10); FileTransfer.Status status = transfer.getStatus(); if (status == Status.ERROR || status == Status.COMPLETE || status == Status.CANCLED || status == Status.REFUSED) { break; } updateBar(transfer, nickname); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } } return ""; }
|
public Object construct() { while (true) { try { Thread.sleep(10); FileTransfer.Status status = transfer.getStatus(); if (status == Status.ERROR || status == Status.COMPLETE || status == Status.CANCLED || status == Status.REFUSED) { break; } updateBar(transfer, nickname); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } } return ""; }
| 3,239,211 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,212 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.error) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,213 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText(Res.getString("message.unable.to.send.file", nickname)); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,214 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,215 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.complete) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,216 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText(Res.getString("message.you.have.sent", nickname)); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,217 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.cancelled) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,218 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText(Res.getString("message.file.transfer.canceled")); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,219 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.refused) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,220 |
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(nickname + " did not accept the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
|
private void updateBar(final OutgoingFileTransfer transfer, String nickname) { FileTransfer.Status status = transfer.getStatus(); if (status == Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating file transfer with " + nickname + ". Please wait..."); } else if (status == Status.ERROR) { if (transfer.getException() != null) { Log.error("Error occured during file transfer.", transfer.getException()); } progressBar.setVisible(false); titleLabel.setText("You were unable to send the file to " + nickname); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.IN_PROGRESS) { titleLabel.setText("Sending a file to " + nickname); showAlert(false); if (!progressBar.isVisible()) { progressBar.setVisible(true); } progressBar.setValue((int)transfer.getBytesSent()); ByteFormat format = new ByteFormat(); String bytesSent = format.format(transfer.getBytesSent()); progressBar.setString(bytesSent + " sent"); } else if (status == Status.COMPLETE) { progressBar.setVisible(false); titleLabel.setText("You have sent a file to " + nickname + "."); cancelButton.setVisible(false); showAlert(true); } else if (status == Status.CANCLED) { progressBar.setVisible(false); titleLabel.setText("You have cancelled the file transfer."); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } else if (status == Status.REFUSED) { progressBar.setVisible(false); titleLabel.setText(Res.getString("message.file.transfer.rejected", nickname)); cancelButton.setVisible(false); retryButton.setVisible(true); showAlert(true); } }
| 3,239,221 |
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (!(value instanceof TreeImageDisplay)) return this; TreeImageDisplay node = (TreeImageDisplay) value; if (node.getLevel() == 0) { setIcon(icons.getIcon(IconManager.ROOT)); return this; } if (numberChildrenVisible) setText(node.getNodeText()); else setText(node.getNodeName()); setToolTipText(node.getToolTip()); setIcon(node.getUserObject()); Color c = node.getHighLight(); if (c == null) c = tree.getForeground(); setForeground(c); if (!sel) setBorderSelectionColor(getBackground()); int w = getIcon().getIconWidth(); w += getIconTextGap(); FontMetrics fm = getFontMetrics(getFont()); w += fm.stringWidth(getText()); setPreferredSize(new Dimension(w, fm.getHeight())); return this; }
|
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (!(value instanceof TreeImageDisplay)) return this; TreeImageDisplay node = (TreeImageDisplay) value; if (node.getLevel() == 0) { setIcon(icons.getIcon(IconManager.ROOT)); return this; } if (numberChildrenVisible) setText(node.getNodeText()); else setText(node.getNodeName()); setToolTipText(node.getToolTip()); setIcon(node.getUserObject()); Color c = node.getHighLight(); if (c == null) c = tree.getForeground(); setForeground(c); if (!sel) setBorderSelectionColor(getBackground()); int w = 0; if (getIcon() != null) w += getIcon().getIconWidth(); w += getIconTextGap(); FontMetrics fm = getFontMetrics(getFont()); w += fm.stringWidth(getText()); setPreferredSize(new Dimension(w, fm.getHeight())); return this; }
| 3,239,222 |
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (!(value instanceof TreeImageDisplay)) return this; TreeImageDisplay node = (TreeImageDisplay) value; if (node.getLevel() == 0) { setIcon(icons.getIcon(IconManager.ROOT)); return this; } if (numberChildrenVisible) setText(node.getNodeText()); else setText(node.getNodeName()); setToolTipText(node.getToolTip()); setIcon(node.getUserObject()); Color c = node.getHighLight(); if (c == null) c = tree.getForeground(); setForeground(c); if (!sel) setBorderSelectionColor(getBackground()); int w = getIcon().getIconWidth(); w += getIconTextGap(); FontMetrics fm = getFontMetrics(getFont()); w += fm.stringWidth(getText()); setPreferredSize(new Dimension(w, fm.getHeight())); return this; }
|
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (!(value instanceof TreeImageDisplay)) return this; TreeImageDisplay node = (TreeImageDisplay) value; if (node.getLevel() == 0) { setIcon(icons.getIcon(IconManager.ROOT)); return this; } if (numberChildrenVisible) setText(node.getNodeText()); else setText(node.getNodeName()); setToolTipText(node.getToolTip()); setIcon(node.getUserObject()); Color c = node.getHighLight(); if (c == null) c = tree.getForeground(); setForeground(c); if (!sel) setBorderSelectionColor(getBackground()); int w = getIcon().getIconWidth(); w += getIconTextGap(); FontMetrics fm = getFontMetrics(getFont()); if (node.getUserObject() instanceof ImageData) w += fm.stringWidth(node.getNodeName()); else w += fm.stringWidth(getText()); setPreferredSize(new Dimension(w, fm.getHeight())); return this; }
| 3,239,223 |
public IRubyObject[] all_symbols() { Object[] tmp = table.values().toArray(); IRubyObject[] array = new IRubyObject[tmp.length]; for (int i = 0; i < tmp.length; i++) { array[i] = (IRubyObject) ((WeakSymbolEntry) tmp[i]).get(); } return array; }
|
public IRubyObject[] all_symbols() { Object[] tmp = table.values().toArray(); IRubyObject[] array = new IRubyObject[tmp.length]; for (int i = 0; i < tmp.length; i++) { array[i] = (IRubyObject) ((WeakSymbolEntry) tmp[i]).get(); } return array; }
| 3,239,224 |
public RubySymbol lookup(String name) { clean(); WeakSymbolEntry ref = (WeakSymbolEntry) table.get(name); if (ref == null) { return null; } return (RubySymbol) ref.get(); }
|
public RubySymbol lookup(String name) { clean(); WeakSymbolEntry ref = (WeakSymbolEntry) table.get(name); if (ref == null) { return null; } return (RubySymbol) ref.get(); }
| 3,239,225 |
public RubySymbol lookup(String name) { clean(); WeakSymbolEntry ref = (WeakSymbolEntry) table.get(name); if (ref == null) { return null; } return (RubySymbol) ref.get(); }
|
public RubySymbol lookup(String name) { clean(); WeakSymbolEntry ref = (WeakSymbolEntry) table.get(name); if (ref == null) { return null; } return null; }
| 3,239,226 |
public void store(RubySymbol symbol) { clean(); table.put(symbol.asSymbol(), new WeakSymbolEntry(symbol, unusedSymbols)); }
|
public void store(RubySymbol symbol) { clean(); table.put(symbol.asSymbol(), new WeakSymbolEntry(symbol, unusedSymbols)); }
| 3,239,227 |
public void dispose() { super.dispose(); globalSelectionListener.unregister(); }
|
public void dispose() { super.dispose(); globalSelectionListener.unregister(); }
| 3,239,232 |
private void setUpViewer() { theTableViewer = new TableViewer(viewArea, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); theTableViewer.setContentProvider(new ViewContentProvider()); theTableViewer.setLabelProvider(new ViewLabelProvider()); getSite().setSelectionProvider(theTableViewer); globalSelectionListener = new GlobalSelectionListener<Object>(this) { @Override protected Object wantObject(Object o) { return (o instanceof IContainer) ? o : marshallElementFrom(o); } @Override protected void selectObjects(List<Object> objects) { /* We could have a lot of IContainers and a lot of Elements here... * We show the infstats of the first IContainer or Element and then * select all Elements in that infstats. */ Object first = objects.get(0); DirTracker dt = (first instanceof IContainer) ? InfstatsManager.getManager().getTrackerFor((IContainer) first) : ((BelongsToInfstats) first).getOwningInfstats().getDir(); useDirectory(dt); theTableViewer.setSelection(new StructuredSelection(objects), true); } }; getSite().getPage().addPostSelectionListener(globalSelectionListener); Table theTable = theTableViewer.getTable(); setUpTableColumns(theTable); theTable.setHeaderVisible(true); // Helpful [Let's try disabling this to get more screen space] goToAction = new Action() { @Override public void run() { doRevealElement1(); } }; theTableViewer .addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { goToAction.run(); } }); }
|
private void setUpViewer() { theTableViewer = new TableViewer(viewArea, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); theTableViewer.setContentProvider(new ViewContentProvider()); theTableViewer.setLabelProvider(new ViewLabelProvider()); getSite().setSelectionProvider(theTableViewer); globalSelectionListener = new GlobalSelectionListener<Object>(this) { @Override protected Object wantObject(Object o) { return (o instanceof IContainer) ? o : marshallElementFrom(o); } @Override protected void selectObjects(List<Object> objects) { /* We could have a lot of IContainers and a lot of Elements here... * We show the infstats of the first IContainer or Element and then * select all Elements in that infstats. */ Object first = objects.get(0); DirTracker dt = (first instanceof IContainer) ? InfstatsManager.getManager().getTrackerFor((IContainer) first) : ((BelongsToInfstats) first).getOwningInfstats().getDir(); useDirectory(dt); theTableViewer.setSelection(new StructuredSelection(objects), true); } }; getSite().getPage().addPostSelectionListener(globalSelectionListener); Table theTable = theTableViewer.getTable(); setUpTableColumns(theTable); theTable.setHeaderVisible(true); // Helpful [Let's try disabling this to get more screen space] goToAction = new Action() { @Override public void run() { doRevealElement1(); } }; theTableViewer .addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { goToAction.run(); } }); }
| 3,239,233 |
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Context context = null; try { wm = new WM(); context = new Context(null); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } try { context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) }; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip",false)); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); Writer w = new OutputStreamWriter(System.out); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
|
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Context context = null; try { wm = new WM(); context = wm.getContext(); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } try { context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) }; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip",false)); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); Writer w = new OutputStreamWriter(System.out); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
| 3,239,235 |
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
|
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
| 3,239,236 |
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
|
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
| 3,239,237 |
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
|
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
| 3,239,238 |
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
|
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
| 3,239,239 |
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
|
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
| 3,239,240 |
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
|
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
| 3,239,241 |
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(isOwner); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
|
private JPanel buildPermissions(final PermissionData permissions) { JPanel content = new JPanel(); double[][] tl = {{TableLayout.PREFERRED, TableLayout.FILL}, //columns {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED} }; //rows content.setLayout(new TableLayout(tl)); content.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); //The owner is the only person allowed to modify the permissions. boolean isOwner = model.isObjectOwner(); //Owner JLabel label = UIUtilities.setTextFont(OWNER); JPanel p = new JPanel(); JCheckBox box = new JCheckBox(READ); box.setSelected(permissions.isUserRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isUserWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setUserWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 0, l, c"); content.add(p, "1, 0, l, c"); //Group label = UIUtilities.setTextFont(GROUP); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isGroupRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isGroupWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setGroupWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 1, l, c"); content.add(p, "1,1, l, c"); //OTHER label = UIUtilities.setTextFont(WORLD); p = new JPanel(); box = new JCheckBox(READ); box.setSelected(permissions.isWorldRead()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldRead(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); box = new JCheckBox(WRITE); box.setSelected(permissions.isWorldWrite()); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox source = (JCheckBox) e.getSource(); permissions.setWorldWrite(source.isSelected()); view.setEdit(true); } }); box.setEnabled(false); p.add(box); content.add(label, "0, 2, l, c"); content.add(p, "1, 2, l, c"); return content; }
| 3,239,242 |
public void testNulls(){ Set test = new HashSet(); test.add(new Integer(-1)); // Non-existence set of ids int nonExp = -1; // Non-existence experimenter ID // assertTrue(emptyColl,getHb().findDatasetAnnotations(test).size()==0); assertTrue(emptyColl,getHb().findDatasetAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,getHb().findDatasetAnnotationsForExperimenter(test,nonExp).size()==0); assertTrue(emptyColl,getHb().findDatasetAnnotationsForExperimenter(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,getHb().findImageAnnotations(test).size()==0); assertTrue(emptyColl,getHb().findImageAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,getHb().findImageAnnotationsForExperimenter(test,nonExp).size()==0); assertTrue(emptyColl,getHb().findImageAnnotationsForExperimenter(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,getHb().findPDIHierarchies(test).size()==0); assertTrue(emptyColl,getHb().findPDIHierarchies(new HashSet()).size()==0); // assertTrue(emptyColl,getHb().findCGCIHierarchies(test).size()==0); assertTrue(emptyColl,getHb().findCGCIHierarchies(new HashSet()).size()==0); // assertNull(nullObj,getHb().loadCGCIHierarchy(CategoryGroup.class, 0)); assertNull(nullObj,getHb().loadCGCIHierarchy(Category.class, 0)); assertNull(nullObj,getHb().loadCGCIAnnotatedHierarchy(CategoryGroup.class, 0,nonExp)); assertNull(nullObj,getHb().loadCGCIAnnotatedHierarchy(Category.class, 0,nonExp)); // assertNull(nullObj,getHb().loadPDIHierarchy(Project.class, 0)); assertNull(nullObj,getHb().loadPDIHierarchy(Dataset.class, 0)); assertNull(nullObj,getHb().loadPDIAnnotatedHierarchy(Project.class, 0,nonExp)); assertNull(nullObj,getHb().loadPDIAnnotatedHierarchy(Dataset.class, 0,nonExp)); // assertTrue(emptyColl,getHb().findCGCPaths(test,true).size()==0); assertTrue(emptyColl,getHb().findCGCPaths(new HashSet(),true).size()==0); assertTrue(emptyColl,getHb().findCGCPaths(test,false).size()==0); assertTrue(emptyColl,getHb().findCGCPaths(new HashSet(),false).size()==0); }
|
public void testNulls(){ Set test = new HashSet(); test.add(new Integer(-1)); // Non-existence set of ids int nonExp = -1; // Non-existence experimenter ID // assertTrue(emptyColl,getHb().findDatasetAnnotations(test).size()==0); assertTrue(emptyColl,getHb().findDatasetAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,getHb().findDatasetAnnotationsForExperimenter(test,nonExp).size()==0); assertTrue(emptyColl,getHb().findDatasetAnnotationsForExperimenter(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,getHb().findImageAnnotations(test).size()==0); assertTrue(emptyColl,getHb().findImageAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,getHb().findImageAnnotationsForExperimenter(test,nonExp).size()==0); assertTrue(emptyColl,getHb().findImageAnnotationsForExperimenter(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,getHb().findPDIHierarchies(test).size()==0); assertTrue(emptyColl,getHb().findPDIHierarchies(new HashSet()).size()==0); // assertTrue(emptyColl,getHb().findCGCIHierarchies(test).size()==0); assertTrue(emptyColl,getHb().findCGCIHierarchies(new HashSet()).size()==0); // assertNull(nullObj,getHb().loadCGCIHierarchy(CategoryGroup.class, 0)); assertNull(nullObj,getHb().loadCGCIHierarchy(Category.class, 0)); assertNull(nullObj,getHb().loadCGCIAnnotatedHierarchy(CategoryGroup.class, 0,nonExp)); assertNull(nullObj,getHb().loadCGCIAnnotatedHierarchy(Category.class, 0,nonExp)); // assertNull(nullObj,getHb().loadPDIHierarchy(Project.class, 0)); assertNull(nullObj,getHb().loadPDIHierarchy(Dataset.class, 0)); assertNull(nullObj,getHb().loadPDIAnnotatedHierarchy(Project.class, 0,nonExp)); assertNull(nullObj,getHb().loadPDIAnnotatedHierarchy(Dataset.class, 0,nonExp)); // assertTrue(emptyColl,getHb().findCGCPaths(test,true).size()==0); assertTrue(emptyColl,getHb().findCGCPaths(new HashSet(),true).size()==0); assertTrue(emptyColl,getHb().findCGCPaths(new HashSet(),false).size()==0); }
| 3,239,243 |
public QueueWriter() { this(1024); }
|
public QueueWriter() { this(1024); }
| 3,239,244 |
private void ensureLocalCapacity(int size) { if (count < 0 || buffer[count] != null) { count++; offset[count] = localPos; length[count] = 0; if (count >= buffer.length) { increaseCapacity(); } } if ((localPos + size) >= local.length) { char[] tmpLocal = new char[local.length * 2 + size]; System.arraycopy(local,0,tmpLocal,0,local.length); local = tmpLocal; } }
|
private void ensureLocalCapacity(int size) { if (count < 0 || buffer[count] != null) { count++; offset[count] = localPos; length[count] = 0; if (count >= buffer.length) { increaseCapacity(); } } if ((localPos + size) >= local.length) { char[] tmpLocal = new char[local.length * 2 + size]; System.arraycopy(local,0,tmpLocal,0,local.length); local = tmpLocal; } }
| 3,239,245 |
public static void main(String arg[]) throws Exception { QueueWriter qw = new QueueWriter(3); char cary[] = "Hello, brave new world".toCharArray(); for (int j = 0; j < 2; j++) { for (int i = 0; i < arg.length; i++) { qw.write(arg[i],1,arg[i].length() - 2); // qw.write(arg[i]); qw.write(' '); qw.write(cary,7,6); } System.out.println("Count: " + qw.count); System.out.println("- - - - Output - - - -"); System.out.println(qw.toString()); qw.reset(); } }
|
public static void main(String arg[]) throws Exception { QueueWriter qw = new QueueWriter(3); char cary[] = "Hello, brave new world".toCharArray(); for (int j = 0; j < 2; j++) { for (int i = 0; i < arg.length; i++) { qw.write(arg[i],1,arg[i].length() - 2); // qw.write(arg[i]); qw.write(' '); qw.write(cary,7,6); } System.out.println("Count: " + qw.count); System.out.println("- - - - Output - - - -"); System.out.println(qw.toString()); qw.reset(); } }
| 3,239,246 |
public static void main(String arg[]) throws Exception { QueueWriter qw = new QueueWriter(3); char cary[] = "Hello, brave new world".toCharArray(); for (int j = 0; j < 2; j++) { for (int i = 0; i < arg.length; i++) { qw.write(arg[i],1,arg[i].length() - 2); // qw.write(arg[i]); qw.write(' '); qw.write(cary,7,6); } System.out.println("Count: " + qw.count); System.out.println("- - - - Output - - - -"); System.out.println(qw.toString()); qw.reset(); } }
|
public static void main(String arg[]) throws Exception { QueueWriter qw = new QueueWriter(3); char cary[] = "Hello, brave new world".toCharArray(); for (int j = 0; j < 2; j++) { for (int i = 0; i < arg.length; i++) { qw.write(arg[i],1,arg[i].length() - 2); // qw.write(arg[i]); qw.write(' '); qw.write(cary,7,6); } System.out.println("Count: " + qw.count); System.out.println("- - - - Output - - - -"); System.out.println(qw.toString()); qw.reset(); } }
| 3,239,247 |
public void reset() { for (int i = 0; i <= count; i++) { buffer[i] = null; offset[i] = 0; length[i] = 0; localPos = 0; count = -1; size = 0; } }
|
public void reset() { for (int i = 0; i <= count; i++) { buffer[i] = null; offset[i] = 0; length[i] = 0; localPos = 0; count = -1; size = 0; } }
| 3,239,248 |
public String toString() { StringBuffer buf = new StringBuffer(size); char[] b; for (int i = 0; i <= count; i++) { b = (buffer[i] == null) ? local : buffer[i]; buf.append(b,offset[i],length[i]); } return buf.toString(); }
|
public String toString() { StringBuffer buf = new StringBuffer(size); char[] b; for (int i = 0; i <= count; i++) { b = (buffer[i] == null) ? local : buffer[i]; buf.append(b,offset[i],length[i]); } return buf.toString(); }
| 3,239,249 |
public void write(char c[], int off, int len) { count++; if (count >= buffer.length) { increaseCapacity(); } buffer[count] = c; offset[count] = off; length[count] = len; // update statistics size += len; }
|
publicvoidwrite(charc[],intoff,intlen){count++;if(count>=buffer.length){increaseCapacity();}buffer[count]=c;offset[count]=off;length[count]=len;//updatestatisticssize+=len;}
| 3,239,250 |
public void writeTo(Writer out) throws IOException { char[] b; for (int i = 0; i <= count; i++) { b = (buffer[i] == null) ? local : buffer[i]; out.write(b,offset[i],length[i]); } }
|
public void writeTo(Writer out) throws IOException { char[] b; for (int i = 0; i <= count; i++) { b = (buffer[i] == null) ? local : buffer[i]; out.write(b,offset[i],length[i]); } }
| 3,239,251 |
public IRubyObject initialize(RubyString newPath) { newPath.checkSafeString();// TODO: Consolidate this absolute file nonsense dir = (NormalizedFile)new NormalizedFile(newPath.getValue()).getAbsoluteFile(); if (!dir.isDirectory()) { dir = null; throw getRuntime().newErrnoENOENTError(newPath.getValue() + " is not a directory"); } path = newPath; List snapshotList = new ArrayList(); snapshotList.add("."); snapshotList.add(".."); snapshotList.addAll(getContents(dir)); snapshot = (String[]) snapshotList.toArray(new String[snapshotList.size()]); pos = 0; return this; }
|
public IRubyObject initialize(RubyString newPath) { newPath.checkSafeString();// TODO: Consolidate this absolute file nonsense dir = (NormalizedFile)new NormalizedFile(newPath.toString()).getAbsoluteFile(); if (!dir.isDirectory()) { dir = null; throw getRuntime().newErrnoENOENTError(newPath.getValue() + " is not a directory"); } path = newPath; List snapshotList = new ArrayList(); snapshotList.add("."); snapshotList.add(".."); snapshotList.addAll(getContents(dir)); snapshot = (String[]) snapshotList.toArray(new String[snapshotList.size()]); pos = 0; return this; }
| 3,239,252 |
public IRubyObject initialize(RubyString newPath) { newPath.checkSafeString();// TODO: Consolidate this absolute file nonsense dir = (NormalizedFile)new NormalizedFile(newPath.getValue()).getAbsoluteFile(); if (!dir.isDirectory()) { dir = null; throw getRuntime().newErrnoENOENTError(newPath.getValue() + " is not a directory"); } path = newPath; List snapshotList = new ArrayList(); snapshotList.add("."); snapshotList.add(".."); snapshotList.addAll(getContents(dir)); snapshot = (String[]) snapshotList.toArray(new String[snapshotList.size()]); pos = 0; return this; }
|
public IRubyObject initialize(RubyString newPath) { newPath.checkSafeString();// TODO: Consolidate this absolute file nonsense dir = (NormalizedFile)new NormalizedFile(newPath.getValue()).getAbsoluteFile(); if (!dir.isDirectory()) { dir = null; throw getRuntime().newErrnoENOENTError(newPath.toString() + " is not a directory"); } path = newPath; List snapshotList = new ArrayList(); snapshotList.add("."); snapshotList.add(".."); snapshotList.addAll(getContents(dir)); snapshot = (String[]) snapshotList.toArray(new String[snapshotList.size()]); pos = 0; return this; }
| 3,239,253 |
public IRubyObject read() { if (!isOpen) { throw getRuntime().newIOError("Directory already closed"); } if (pos >= snapshot.length) { return getRuntime().getNil(); } RubyString result = new RubyString(getRuntime(), snapshot[pos]); pos++; return result; }
|
public IRubyObject read() { if (!isOpen) { throw getRuntime().newIOError("Directory already closed"); } if (pos >= snapshot.length) { return getRuntime().getNil(); } RubyString result = getRuntime().newString(snapshot[pos]); pos++; return result; }
| 3,239,254 |
public IOHandlerSeekable(IRuby runtime, String path, IOModes modes) throws IOException, InvalidValueException { super(runtime); this.path = path; this.modes = modes; JRubyFile theFile = JRubyFile.create(runtime.getCurrentDirectory(),path); if (theFile.exists()) { if (modes.shouldTruncate()) { // If we only want to open for writing we should remove // the old file before opening the fresh one. If it fails // to remove it we should do something? if (!theFile.delete()) { } } } else { if (modes.isReadable() && !modes.isWriteable()) { throw new FileNotFoundException(); } } // Do not open as 'rw' if we don't need to since a file with permissions for read-only // will barf if opened 'rw'. String javaMode = "r"; if (modes.isWriteable()) { javaMode += "w"; } // We always open this rw since we can only open it r or rw. file = new RandomAccessFile(theFile, javaMode); isOpen = true; if (modes.isAppendable()) { seek(0, SEEK_END); } String ls = System.getProperty("line.separator"); if (!modes.isBinary() && !"\n".equals(ls)) { shouldReplace = true; if ("\r".equals(ls)) { isWin = false; } } // We give a fileno last so that we do not consume these when // we have a problem opening a file. fileno = RubyIO.getNewFileno(); }
|
public IOHandlerSeekable(IRuby runtime, String path, IOModes modes) throws IOException, InvalidValueException { super(runtime); this.path = path; this.modes = modes; JRubyFile theFile = JRubyFile.create(runtime.getCurrentDirectory(),path); if (theFile.exists()) { if (modes.shouldTruncate()) { // If we only want to open for writing we should remove // the old file before opening the fresh one. If it fails // to remove it we should do something? if (!theFile.delete()) { } } } else { if (modes.isReadable() && !modes.isWriteable()) { throw new FileNotFoundException(); } } // Do not open as 'rw' if we don't need to since a file with permissions for read-only // will barf if opened 'rw'. String javaMode = "r"; if (modes.isWriteable()) { javaMode += "w"; } // We always open this rw since we can only open it r or rw. file = new RandomAccessFile(theFile, javaMode); isOpen = true; if (modes.isAppendable()) { seek(0, SEEK_END); } String ls = System.getProperty("line.separator"); if (!modes.isBinary() && !"\n".equals(ls)) { shouldReplace = true; if ("\r".equals(ls)) { isWin = false; } } // We give a fileno last so that we do not consume these when // we have a problem opening a file. fileno = RubyIO.getNewFileno(); }
| 3,239,255 |
public int sysread() throws IOException { if(!shouldReplace) { return file.read(); } else { int curr = file.read(); if (curr != '\r') { return curr; } else if (!isWin) { return '\n'; } else { int next = file.read(); if(next == '\n') { return next; } file.seek(file.getFilePointer() - 1); return curr; } } }
|
public int sysread() throws IOException { if(!shouldReplace) { return file.read(); } else { int curr = file.read(); if (curr != '\r') { return curr; } else if (!isWin) { return '\n'; } else { int next = file.read(); if(next == '\n') { return next; } file.seek(file.getFilePointer() - 1); return curr; } } }
| 3,239,256 |
protected WikiPage createNewPage (WikiSystem wiki, WebContext wc, WikiUser user) throws Exception { // get the page elements from the request String editor = user.getIdentifier(); String text = wc.getForm ("TEXT"); boolean moderated = wc.getForm ("MODERATED").equals ("true"); String keywords = wc.getForm ("RELATED_TITLES"); String pageName = wc.getForm ("save"); // create the page System.err.println ("pageName: " + pageName); WikiPage newPage = wiki.createPage (pageName, editor, text); newPage.setRelatedTitles (keywordsToStringArray(keywords)); newPage.setIsModerated(moderated); System.err.println ("pageName: " + newPage.getTitle()); // make sure to save the page wiki.savePage (newPage); return newPage; }
|
protected WikiPage createNewPage (WikiSystem wiki, WebContext wc, WikiUser user) throws Exception { // get the page elements from the request String editor = user.getIdentifier(); String text = wc.getForm ("TEXT"); boolean moderated = wc.getForm ("MODERATED") != null && wc.getForm("MODERATED").equals ("true"); String keywords = wc.getForm ("RELATED_TITLES"); String pageName = wc.getForm ("save"); // create the page System.err.println ("pageName: " + pageName); WikiPage newPage = wiki.createPage (pageName, editor, text); newPage.setRelatedTitles (keywordsToStringArray(keywords)); newPage.setIsModerated(moderated); System.err.println ("pageName: " + newPage.getTitle()); // make sure to save the page wiki.savePage (newPage); return newPage; }
| 3,239,257 |
public static void main(String args[]) throws IOException { int n = Integer.parseInt(args[0]); HashMap dict = new HashMap(); String word; try { BufferedReader in = new BufferedReader(new FileReader("Usr.Dict.Words")); while ((word = in.readLine()) != null) { dict.put(word, new Integer(1)); } in.close(); } catch (IOException e) { System.err.println(e); return; } try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while ((word = in.readLine()) != null) { if (!dict.containsKey(word)) { System.out.println(word); } } } catch (IOException e) { System.err.println(e); return; } }
|
public static void main(String args[]) throws IOException { int n = Integer.parseInt(args[0]); HashMap dict = new HashMap(); String word; try { BufferedReader in = new BufferedReader(new FileReader("Usr.Dict.Words")); while ((word = in.readLine()) != null) { dict.put(word, new Integer(1)); } in.close(); } catch (IOException e) { System.err.println(e); return; } try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while ((word = in.readLine()) != null) { if (!dict.containsKey(word)) { System.out.println(word); } } } catch (IOException e) { System.err.println(e); return; } }
| 3,239,258 |
private void addEntry() { Transport transport = null; AccountItem item = null; if (publicBox.isSelected()) { item = (AccountItem)accounts.getSelectedItem(); transport = item.getTransport(); } if (transport == null) { String jid = jidField.getText(); if (jid.indexOf("@") == -1) { jid = jid + "@" + SparkManager.getConnection().getServiceName(); } String nickname = nicknameField.getText(); String group = (String)groupBox.getSelectedItem(); jid = UserManager.escapeJID(jid); // Add as a new entry addEntry(jid, nickname, group); } else { String jid = jidField.getText(); if (jid.indexOf("@") == -1) { jid = jid + "@" + item.getTransport().getServiceName(); String nickname = nicknameField.getText(); String group = (String)groupBox.getSelectedItem(); addEntry(jid, nickname, group); } } }
|
private void addEntry() { Transport transport = null; AccountItem item = null; if (publicBox.isSelected()) { item = (AccountItem)accounts.getSelectedItem(); transport = item.getTransport(); } if (transport == null) { String jid = jidField.getText(); if (jid.indexOf("@") == -1) { jid = jid + "@" + SparkManager.getConnection().getServiceName(); } String nickname = nicknameField.getText(); String group = (String)groupBox.getSelectedItem(); jid = UserManager.escapeJID(jid); // Add as a new entry addEntry(jid, nickname, group); } else { String jid = jidField.getText(); if (jid.indexOf("@") == -1) { jid = jid + "@" + item.getTransport().getServiceName(); String nickname = nicknameField.getText(); String group = (String)groupBox.getSelectedItem(); addEntry(jid, nickname, group); } } }
| 3,239,260 |
private void addCloseAllButtons() { winSubMenu.add(closeAllWinSubMenuEntry); winSubMenu.addSeparator(); dropDownButton.addToMenu(closeAllDropDownButtonEntry); dropDownButton.addSeparator(); }
|
private void addCloseAllButtons() { winSubMenu.add(closeAllWinSubMenuEntry); winSubMenu.addSeparator(); dropDownButton.addToMenu(closeAllDropDownButtonEntry); dropDownButton.addSeparator(); }
| 3,239,262 |
private void clearMenus() { winSubMenu.removeAll(); winSubMenu.setEnabled(false); dropDownButton.clearMenu(); }
|
private void clearMenus() { winSubMenu.removeAll(); winSubMenu.setEnabled(false); dropDownButton.clearMenu(); }
| 3,239,263 |
private WindowConfig makeConfigFor(TopWindow window) { WindowConfig cfg = new WindowConfig(); cfg.winSubMenuEntry = new JMenuItem(); cfg.dropDownButtonEntry = new JMenuItem(); cfg.manager = new TopWindowManager(window, new AbstractButton[] {cfg.winSubMenuEntry, cfg.dropDownButtonEntry}); return cfg; }
|
private WindowConfig makeConfigFor(TopWindow window) { WindowConfig cfg = new WindowConfig(); cfg.winSubMenuEntry = new JMenuItem(); cfg.dropDownButtonEntry = new JMenuItem(); cfg.manager = new TopWindowManager(window, new AbstractButton[] {cfg.winSubMenuEntry, cfg.dropDownButtonEntry}); return cfg; }
| 3,239,264 |
private WindowConfig makeConfigFor(TopWindow window) { WindowConfig cfg = new WindowConfig(); cfg.winSubMenuEntry = new JMenuItem(); cfg.dropDownButtonEntry = new JMenuItem(); cfg.manager = new TopWindowManager(window, new AbstractButton[] {cfg.winSubMenuEntry, cfg.dropDownButtonEntry}); return cfg; }
|
private WindowConfig makeConfigFor(TopWindow window) { WindowConfig cfg = new WindowConfig(); cfg.winSubMenuEntry = new JMenuItem(); cfg.dropDownButtonEntry = new JMenuItem(); cfg.manager = new TopWindowManager(window, new AbstractButton[] {cfg.winSubMenuEntry, cfg.dropDownButtonEntry}); return cfg; }
| 3,239,265 |
public void showPopup(MouseEvent e) { final JPopupMenu popup = new JPopupMenu(); List custom = CustomMessages.load(); if (custom == null) { custom = new ArrayList(); } // Build menu from StatusList for(final StatusItem statusItem : statusList){ final Action statusAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { final String text = statusItem.getText(); final StatusItem si = getStatusItem(text); if (si == null) { // Custom status return; } SwingWorker worker = new SwingWorker() { public Object construct() { SparkManager.getSessionManager().changePresence(si.getPresence()); return "ok"; } public void finished() { setStatus(text); } }; worker.start(); } }; statusAction.putValue(Action.NAME, statusItem.getText()); statusAction.putValue(Action.SMALL_ICON, statusItem.getIcon()); // Has Children boolean hasChildren = false; Iterator customItemIterator = custom.iterator(); while (customItemIterator.hasNext()) { final CustomStatusItem cItem = (CustomStatusItem)customItemIterator.next(); String type = cItem.getType(); if (type.equals(statusItem.getText())) { hasChildren = true; } } if (!hasChildren) { // Add as Menu Item popup.add(statusAction); } else { final JMenu mainStatusItem = new JMenu(statusAction); popup.add(mainStatusItem); // Add Custom Messages customItemIterator = custom.iterator(); while (customItemIterator.hasNext()) { final CustomStatusItem customItem = (CustomStatusItem)customItemIterator.next(); String type = customItem.getType(); if (type.equals(statusItem.getText())) { // Add Child Menu Action action = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { final String text = mainStatusItem.getText(); final StatusItem si = getStatusItem(text); if (si == null) { // Custom status return; } SwingWorker worker = new SwingWorker() { public Object construct() { Presence oldPresence = si.getPresence(); Presence presence = copyPresence(oldPresence); presence.setStatus(customItem.getStatus()); presence.setPriority(customItem.getPriority()); SparkManager.getSessionManager().changePresence(presence); return "ok"; } public void finished() { String status = customItem.getType() + " - " + customItem.getStatus(); setStatus(status); } }; worker.start(); } }; action.putValue(Action.NAME, customItem.getStatus()); action.putValue(Action.SMALL_ICON, statusItem.getIcon()); mainStatusItem.add(action); } } // If menu has children, allow it to still be clickable. mainStatusItem.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { statusAction.actionPerformed(null); popup.setVisible(false); } }); } } // Add change message final JMenuItem changeStatusMenu = new JMenuItem(Res.getString("menuitem.set.status.message"), SparkRes.getImageIcon(SparkRes.BLANK_IMAGE)); popup.addSeparator(); popup.add(changeStatusMenu); changeStatusMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CustomMessages.addCustomMessage(); } }); Action editMessagesAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { CustomMessages.editCustomMessages(); } }; editMessagesAction.putValue(Action.NAME, Res.getString("menuitem.edit.status.message")); popup.add(editMessagesAction); popup.show(statusPanel, 0, statusPanel.getHeight()); }
|
public void showPopup(MouseEvent e) { final JPopupMenu popup = new JPopupMenu(); List custom = CustomMessages.load(); if (custom == null) { custom = new ArrayList(); } // Build menu from StatusList for (final StatusItem statusItem : statusList) { final Action statusAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { final String text = statusItem.getText(); final StatusItem si = getStatusItem(text); if (si == null) { // Custom status return; } SwingWorker worker = new SwingWorker() { public Object construct() { SparkManager.getSessionManager().changePresence(si.getPresence()); return "ok"; } public void finished() { setStatus(text); } }; worker.start(); } }; statusAction.putValue(Action.NAME, statusItem.getText()); statusAction.putValue(Action.SMALL_ICON, statusItem.getIcon()); // Has Children boolean hasChildren = false; Iterator customItemIterator = custom.iterator(); while (customItemIterator.hasNext()) { final CustomStatusItem cItem = (CustomStatusItem)customItemIterator.next(); String type = cItem.getType(); if (type.equals(statusItem.getText())) { hasChildren = true; } } if (!hasChildren) { // Add as Menu Item popup.add(statusAction); } else { final JMenu mainStatusItem = new JMenu(statusAction); popup.add(mainStatusItem); // Add Custom Messages customItemIterator = custom.iterator(); while (customItemIterator.hasNext()) { final CustomStatusItem customItem = (CustomStatusItem)customItemIterator.next(); String type = customItem.getType(); if (type.equals(statusItem.getText())) { // Add Child Menu Action action = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { final String text = mainStatusItem.getText(); final StatusItem si = getStatusItem(text); if (si == null) { // Custom status return; } SwingWorker worker = new SwingWorker() { public Object construct() { Presence oldPresence = si.getPresence(); Presence presence = copyPresence(oldPresence); presence.setStatus(customItem.getStatus()); presence.setPriority(customItem.getPriority()); SparkManager.getSessionManager().changePresence(presence); return "ok"; } public void finished() { String status = customItem.getType() + " - " + customItem.getStatus(); setStatus(status); } }; worker.start(); } }; action.putValue(Action.NAME, customItem.getStatus()); action.putValue(Action.SMALL_ICON, statusItem.getIcon()); mainStatusItem.add(action); } } // If menu has children, allow it to still be clickable. mainStatusItem.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { statusAction.actionPerformed(null); popup.setVisible(false); } }); } } // Add change message final JMenuItem changeStatusMenu = new JMenuItem(Res.getString("menuitem.set.status.message"), SparkRes.getImageIcon(SparkRes.BLANK_IMAGE)); popup.addSeparator(); popup.add(changeStatusMenu); changeStatusMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CustomMessages.addCustomMessage(); } }); Action editMessagesAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { CustomMessages.editCustomMessages(); } }; editMessagesAction.putValue(Action.NAME, Res.getString("menuitem.edit.status.message")); popup.add(editMessagesAction); popup.show(statusPanel, 0, statusPanel.getHeight()); }
| 3,239,266 |
public static final int random(int start, int end) { return start + ((int) (1000000.0 * java.lang.Math.random()) % end); }
|
public static final int random(int start, int end) { return start + (int) (end *java.lang.Math.random()/(Integer.MAX_VALUE+1.0)); }
| 3,239,270 |
public void testAddJarToPath() throws Exception { SystemClassPath systemClassPath = new SystemClassPath(); ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); try { systemClassLoader.loadClass("groovy.lang.GroovyShell"); fail("Class already exists"); } catch (ClassNotFoundException e) { // this should fail } URL groovyJar = new URL("http://www.ibiblio.org/maven/groovy/jars/groovy-SNAPSHOT.jar"); systemClassPath.addJarToPath(groovyJar); try { systemClassLoader.loadClass("groovy.lang.GroovyShell"); } catch (ClassNotFoundException e) { // this should fail pass fail("Class already exists"); } }
|
public void testAddJarToPath() throws Exception { SystemClassPath systemClassPath = new SystemClassPath(); ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); try { systemClassLoader.loadClass("groovy.lang.GroovyShell"); fail("Class already exists"); } catch (ClassNotFoundException e) { // this should fail } URL groovyJar = new URL("http://www.ibiblio.org/maven/groovy/jars/groovy-SNAPSHOT.jar"); systemClassPath.addJarToPath(groovyJar); try { systemClassLoader.loadClass("groovy.lang.GroovyShell"); } catch (ClassNotFoundException e) { // this should fail pass fail("Class already exists"); } }
| 3,239,272 |
public Object get(final String query) throws NotFoundException { TimedReference r; try { r = (TimedReference) _cache.get(query); } catch (NullPointerException e) { throw new NotFoundException(this + " is not initialized", e); } Object o = null; if (r != null) { o = r.get(); } if (o == null) { r = load(query); if (r != null) { _cache.put(query,r); o = r.get(); try { _log.debug("cached: " + query + " for " + r.getTimeout()); _tl.scheduleTime( new Runnable() { public void run() { _cache.remove(query); _log.debug("cache expired: " + query); } }, r.getTimeout()); } catch (Exception e) { _log.error("CachingProvider caught an exception", e); } } } return o; }
|
public Object get(final String query) throws NotFoundException { TimedReference r; try { r = (TimedReference) _cache.get(query); } catch (NullPointerException e) { throw new NotFoundException(this + " is not initialized", e); } Object o = null; if (r != null) { o = r.get(); } if (o == null) { r = load(query); if (r != null) { _cache.put(query,r); o = r.get(); try { _log.debug("cached: " + query + " for " + r.getTimeout()); _tl.scheduleTime( new Runnable() { public void run() { _cache.remove(query); _log.debug("cache expired: " + query); } }, r.getTimeout()); } catch (Exception e) { _log.error("CachingProvider caught an exception", e); } } } return o; }
| 3,239,273 |
public Object get(final String query) throws NotFoundException { TimedReference r; try { r = (TimedReference) _cache.get(query); } catch (NullPointerException e) { throw new NotFoundException(this + " is not initialized", e); } Object o = null; if (r != null) { o = r.get(); } if (o == null) { r = load(query); if (r != null) { _cache.put(query,r); o = r.get(); try { _log.debug("cached: " + query + " for " + r.getTimeout()); _tl.scheduleTime( new Runnable() { public void run() { _cache.remove(query); _log.debug("cache expired: " + query); } }, r.getTimeout()); } catch (Exception e) { _log.error("CachingProvider caught an exception", e); } } } return o; }
|
public Object get(final String query) throws NotFoundException { TimedReference r; try { r = (TimedReference) _cache.get(query); } catch (NullPointerException e) { throw new NotFoundException(this + " is not initialized", e); } Object o = null; if (r != null) { o = r.get(); } if (o == null) { r = load(query); if (r != null) { _cache.put(query,r); o = r.get(); try { _log.debug("cached: " + query + " for " + r.getTimeout()); _tl.scheduleTime( new Runnable() { public void run() { _cache.remove(query); _log.debug("cache expired: " + query); } }, r.getTimeout()); } catch (Exception e) { _log.error("CachingProvider caught an exception", e); } } } return o; }
| 3,239,274 |
public void run() { _cache.remove(query); _log.debug("cache expired: " + query); }
|
public void run() { _cache.remove(query); _log.debug("cache expired: " + query); }
| 3,239,275 |
public void init(Broker b, Properties config) throws InitException { _log = b.getLog("resource"); _cache = new Hashtable(); }
|
public void init(Broker b, Properties config) throws InitException { _log = b.getLog("resource"); _cache = new ScalableMap(1001); }
| 3,239,276 |
public boolean isReadOnly( ) { return data.get().isReadyOnly; }
|
public boolean isReadOnly( ) { return data.get().isReadOnly; }
| 3,239,277 |
public void setReadOnly( boolean isReadOnly ) { data.get().isReadyOnly = isReadOnly; }
|
public void setReadOnly( boolean isReadOnly ) { data.get().isReadOnly = isReadOnly; }
| 3,239,278 |
void fireContainerLoading() { if (selectedDisplay == null) return; Object ho = selectedDisplay.getUserObject(); int id = -1; Class nodeType = null; if (ho instanceof ProjectData) { id = ((ProjectData) ho).getId(); nodeType = ProjectData.class; } else if (ho instanceof CategoryGroupData) { id = ((ProjectData) ho).getId(); nodeType = CategoryGroupData.class; } if (nodeType != null) { currentLoader = new ContainerLoader(component, nodeType, id); currentLoader.load(); state = Browser.LOADING_DATA; } }
|
void fireContainerLoading() { if (selectedDisplay == null) return; Object ho = selectedDisplay.getUserObject(); int id = -1; Class nodeType = null; if (ho instanceof ProjectData) { id = ((CategoryGroupData) ho).getId(); nodeType = ProjectData.class; } else if (ho instanceof CategoryGroupData) { id = ((CategoryGroupData) ho).getId(); nodeType = CategoryGroupData.class; } if (nodeType != null) { currentLoader = new ContainerLoader(component, nodeType, id); currentLoader.load(); state = Browser.LOADING_DATA; } }
| 3,239,280 |
void setFoundNodes(List nodes) { foundNodes = nodes; }
|
void setFoundNodes(List nodes) { foundNodes = nodes; }
| 3,239,281 |
public Object call(final Constructor self, final String pref, final Node node) { return constructRuby(self,pref,node); }
|
public Object call(final Constructor self, final String pref, final Node node) { return constructRubyMap(self,pref,node); }
| 3,239,282 |
private void copyStackAllTimepoints(int from, int to) { int rows = numRows-1; control.copyStackAcrossT(from, to); PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; for (int j = from; j <= to; j++) { pa = control.getPlaneArea(z, j); setSelectedCell(pa, i, j); } } view.table.repaint(from*numColumns, 0, (to-from+1)*cellWidth, numRows*cellHeight); }
|
private void copyStackAllTimepoints(int from, int to) { control.copyStackAcrossT(from, to); PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; for (int j = from; j <= to; j++) { pa = control.getPlaneArea(z, j); setSelectedCell(pa, i, j); } } view.table.repaint(from*numColumns, 0, (to-from+1)*cellWidth, numRows*cellHeight); }
| 3,239,283 |
private void copyStackAllTimepoints(int from, int to) { int rows = numRows-1; control.copyStackAcrossT(from, to); PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; for (int j = from; j <= to; j++) { pa = control.getPlaneArea(z, j); setSelectedCell(pa, i, j); } } view.table.repaint(from*numColumns, 0, (to-from+1)*cellWidth, numRows*cellHeight); }
|
private void copyStackAllTimepoints(int from, int to) { int rows = numRows-1; control.copyStackAcrossT(from, to); PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; for (int j = from; j <= to; j++) { pa = control.getPlaneArea(z, j); setSelectedCell(pa, i, j); } } view.table.repaint(from*numColumns, 0, (to-from+1)*cellWidth, numRows*cellHeight); }
| 3,239,284 |
private void copyStackEndsTimepoints(int from, int to) { control.copyStack(from, to); int rows = numRows-1; PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; pa = control.getPlaneArea(z, from); setSelectedCell(pa, i, from); setSelectedCell(pa, i, to); } view.table.repaint(from*numColumns, 0, to*cellWidth, numRows*cellHeight); }
|
private void copyStackEndsTimepoints(int from, int to) { control.copyStack(from, to); int rows = numRows; PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; pa = control.getPlaneArea(z, from); setSelectedCell(pa, i, from); setSelectedCell(pa, i, to); } view.table.repaint(from*numColumns, 0, to*cellWidth, numRows*cellHeight); }
| 3,239,285 |
private void copyStackEndsTimepoints(int from, int to) { control.copyStack(from, to); int rows = numRows-1; PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; pa = control.getPlaneArea(z, from); setSelectedCell(pa, i, from); setSelectedCell(pa, i, to); } view.table.repaint(from*numColumns, 0, to*cellWidth, numRows*cellHeight); }
|
private void copyStackEndsTimepoints(int from, int to) { control.copyStack(from, to); int rows = numRows-1; PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i-1; pa = control.getPlaneArea(z, from); setSelectedCell(pa, i, from); setSelectedCell(pa, i, to); } view.table.repaint(from*numColumns, 0, to*cellWidth, numRows*cellHeight); }
| 3,239,286 |
private void copyStackEndsTimepoints(int from, int to) { control.copyStack(from, to); int rows = numRows-1; PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; pa = control.getPlaneArea(z, from); setSelectedCell(pa, i, from); setSelectedCell(pa, i, to); } view.table.repaint(from*numColumns, 0, to*cellWidth, numRows*cellHeight); }
|
private void copyStackEndsTimepoints(int from, int to) { control.copyStack(from, to); int rows = numRows-1; PlaneArea pa; int z; for (int i = 0; i < rows; i++) { z = rows-i; pa = control.getPlaneArea(z, from); setSelectedCell(pa, i, from); setSelectedCell(pa, i, to); } view.table.repaint(from*numColumns, 0, (to-from+1)*cellWidth, numRows*cellHeight); }
| 3,239,287 |
private void handleSelectionError(String msg) { cancel(); UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Invalid selection", msg); //remove the two selected planes. //setSelectedCell(oldRow, oldColumn, false); //setSelectedCell(curRow, curColumn, false); //view.table.repaint(); //setDefaultLocation(); }
|
private void handleSelectionError(String msg) { cancel(); UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Invalid selection", msg); //remove the two selected planes. //setSelectedCell(oldRow, oldColumn, false); //setSelectedCell(curRow, curColumn, false); //view.table.repaint(); //setDefaultLocation(); }
| 3,239,288 |
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
|
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
| 3,239,289 |
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
|
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
| 3,239,290 |
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
|
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
| 3,239,291 |
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
|
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
| 3,239,292 |
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
|
public PNode setToolTipNode(PInputEvent event) { PNode p = (PNode) null; PNode n = event.getInputManager().getMouseOver().getPickedNode(); double scale = camera.getViewScale(); if (scale < ToolTipHandler.SCALE_THRESHOLD) { if (n instanceof ModuleView) { String s = ((ModuleView) n).getModule().getName(); if (s.compareTo("") != 0) { PText pt = new PText(s); pt.setFont(font); p = pt; } } return p; } else if (n instanceof FormalParameter) return getParameterToolTip((FormalParameter) n); else return p; }
| 3,239,293 |
public void onSelectedDisplay() { switch (model.getState()) { case DISCARDED: case SAVE: throw new IllegalStateException("This method cannot be " + "invoked in the DISCARDED, SAVE or LOADING_THUMBNAIL " + "state"); } int editor = model.getEditorType(); if (editor != TreeViewer.CREATE_EDITOR) { removeEditor(); PropertiesCmd cmd = new PropertiesCmd(this); cmd.execute(); } else removeEditor(); }
|
public void onSelectedDisplay() { switch (model.getState()) { case DISCARDED: case SAVE: throw new IllegalStateException("This method cannot be " + "invoked in the DISCARDED, SAVE or LOADING_THUMBNAIL " + "state"); } int editor = model.getEditorType(); if (editor != TreeViewer.CREATE_EDITOR) { removeEditor(); PropertiesCmd cmd = new PropertiesCmd(this); cmd.execute(); } else removeEditor(); }
| 3,239,295 |
public void onSelectedDisplay() { switch (model.getState()) { case DISCARDED: case SAVE: throw new IllegalStateException("This method cannot be " + "invoked in the DISCARDED, SAVE or LOADING_THUMBNAIL " + "state"); } int editor = model.getEditorType(); if (editor != TreeViewer.CREATE_EDITOR) { removeEditor(); PropertiesCmd cmd = new PropertiesCmd(this); cmd.execute(); } else removeEditor(); }
|
public void onSelectedDisplay() { switch (model.getState()) { case DISCARDED: case SAVE: throw new IllegalStateException("This method cannot be " + "invoked in the DISCARDED, SAVE or LOADING_THUMBNAIL " + "state"); } int editor = model.getEditorType(); if (editor != TreeViewer.CREATE_EDITOR) { removeEditor(); PropertiesCmd cmd = new PropertiesCmd(this); cmd.execute(); } else { Browser browser = model.getSelectedBrowser(); if (browser != null) { TreeImageDisplay d = browser.getLastSelectedDisplay(); if (d != null && (d.getUserObject() instanceof ImageData)) { int index = EditorFactory.getEditorSelectedPane(); if (index == Editor.INFO_INDEX) EditorFactory.setEditorSelectedPane( Editor.PROPERTIES_INDEX); } } removeEditor(); } }
| 3,239,296 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.