file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
ZoomAction.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/view/ZoomAction.java | /*
* @(#)ZoomAction.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.actions.view;
import com.egantt.drawing.view.ViewManager;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Icon;
/**
* Zooms in to the appropriate zoom level using the ViewManager
*/
public class ZoomAction extends AbstractAction
{
private static final long serialVersionUID = 5665163388765156432L;
protected ViewManager manager;
protected int step = 0;
public ZoomAction(String name, Icon icon)
{
super(name, icon);
}
public ZoomAction(String name, Icon icon, int step, ViewManager manager) {
super(name, icon);
this.step = step;
this.manager = manager;
}
// _________________________________________________________________________
public void setManager(ViewManager manager)
{
this.manager = manager;
}
// _________________________________________________________________________
public void setStep(int step)
{
this.step = step;
}
// _________________________________________________________________________
public void actionPerformed(ActionEvent event)
{
manager.translate(step, true);
}
}
| 1,250 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
FitToAllAction.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/view/FitToAllAction.java | /*
* @(#)FitToAllAction.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.actions.view;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Icon;
import javax.swing.table.TableModel;
import com.egantt.model.drawing.axis.AxisView;
/**
* Performs a fit to all on the table
* @@broken
*/
public class FitToAllAction extends AbstractAction
{
private static final long serialVersionUID = 9217419012697785593L;
protected int column;
protected int finishRow = -1;
protected int startRow = -1;
protected AxisView axisView;
protected TableModel tableModel;
protected boolean visibleOnly;
public FitToAllAction(String name, Icon icon, int column, TableModel tableModel, AxisView axisView, boolean visibleOnly)
{
super(name, icon);
this.axisView = axisView;
this.column = column;
this.tableModel = tableModel;
this.visibleOnly = visibleOnly;
}
public void setRange(int startRow, int finishRow)
{
this.finishRow = finishRow;
this.startRow = startRow;
}
public void actionPerformed(ActionEvent event)
{
/**
long start = Long.MAX_VALUE;
long finish = Long.MIN_VALUE;
int startRow = this.startRow >= 0 ? this.startRow : 0;
int finishRow = this.finishRow >=0 ? this.finishRow : tableModel.getRowCount();
finishRow = Math.min(finishRow, tableModel.getRowCount());
for (int i=startRow; i < finishRow; i++)
{
DrawingState model = (DrawingState) tableModel.getValueAt(i, column);
for (Iterator iter = model.getEntries().iterator(); iter.hasNext();)
{
Object entry = iter.next();
LongInterval interval = (LongInterval)
model.getInterval(entry, AxisConstants.HORIZONTAL_AXIS);
if (interval.getStartValue() != Long.MIN_VALUE)
start = Math.min(interval.getStartValue(), start);
if (interval.getFinishValue() != Long.MAX_VALUE)
finish = Math.max(interval.getFinishValue(), finish);
}
}
if (start != Long.MAX_VALUE && finish != Long.MIN_VALUE)
axis.setVisible(new LongInterval(start, finish));
*/
}
}
| 2,132 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DeselectAllAction.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/table/DeselectAllAction.java | /**
* @(#)DeselectAllAction.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.actions.table;
import java.awt.Point;
import java.awt.event.ActionEvent;
import javax.swing.Icon;
import javax.swing.JComponent;
import org.jdesktop.swingx.JXTable;
/**
* <code>DeselectAllAction</code> Deselects all the rows in a table
*/
public class DeselectAllAction extends AbstractTableAction
{
private static final long serialVersionUID = 5665167758065156432L;
protected JComponent component;
public DeselectAllAction(String name, Icon icon, JComponent component)
{
super(name, icon, component);
}
// _________________________________________________________________________
protected void actionPerformed(JXTable table, Point location, ActionEvent event)
{
if (table != null)
{
table.clearSelection();
}
}
} | 912 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
SetToolAction.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/table/SetToolAction.java | /**
* @(#)SetToolAction.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.actions.table;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Icon;
import ext.egantt.actions.DrawingTool;
import ext.egantt.swing.GanttTable;
/**
* <code>SetToolAction</code> Sets the specified tool to the GanttTable component
*/
public class SetToolAction extends AbstractAction
{
private static final long serialVersionUID = 5665167758065156432L;
protected final DrawingTool tool;
protected final GanttTable table;
public SetToolAction(String name, Icon icon, DrawingTool tool, GanttTable table)
{
super(name, icon);
this.tool = tool;
this.table = table;
}
// _________________________________________________________________________
public void actionPerformed(ActionEvent event)
{
if (table != null)
{
table.setDrawingTool(tool);
}
}
} | 986 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
LinkEntryAction.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/table/LinkEntryAction.java | package ext.egantt.actions.table;
import java.awt.Point;
import java.awt.event.ActionEvent;
import org.jdesktop.swingx.JXTable;
import com.egantt.model.drawing.DrawingState;
import ext.egantt.swing.GanttEntryHelper;
public class LinkEntryAction extends AbstractDrawingAction {
private static final long serialVersionUID = 1L;
protected String colorCode;
protected transient DrawingState last;
protected GanttEntryHelper helper;
public LinkEntryAction(String name, String colorCode, GanttEntryHelper helper) {
super(name, null, null);
this.colorCode = colorCode;
this.helper = helper;
}
@Override
protected void actionPerformed(JXTable table, DrawingState drawing,
Point location, ActionEvent event) {
DrawingState current = drawing.getValueAt(location, 2, 2) != null ? drawing : null;
if (current != null && last != null && current != last) {
helper.createLinkEntry(current, last);
table.repaint();
last = null;
return;
}
last = current;
}
} | 995 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
StateEditorTool.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/table/StateEditorTool.java | package ext.egantt.actions.table;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JPanel;
import org.jdesktop.swingx.JXTable;
import javax.swing.SwingUtilities;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.DrawingState;
import com.egantt.swing.cell.editor.state.StateEditor;
import ext.egantt.actions.DrawingTool;
import ext.egantt.swing.GanttTable;
public class StateEditorTool implements DrawingTool{
protected final Object modeKey;
protected final Object axisKey;
protected transient MouseListener mouseListener;
protected transient MouseMotionListener motionListener;
protected transient LocalGlassPane glassPane;
protected transient StateEditor stateEditor;
protected GanttTable table;
public StateEditorTool(Object axisKey, Object modeKey) {
this.axisKey = axisKey;
this.modeKey = modeKey;
}
// ________________________________________________________________________
public void intialize(GanttTable table) {
this.table = table;
if (mouseListener == null) {
mouseListener = new LocalMouseListener();
motionListener = new LocalMotionListener();
glassPane = new LocalGlassPane();
table.addMouseListener(mouseListener);
table.addMouseMotionListener(motionListener);
table.add(glassPane, GanttTable.PALETTE_LAYER);
SwingUtilities.updateComponentTreeUI(table);
}
}
public void terminate() {
if (table != null)
{
table.removeMouseListener(mouseListener);
table.removeMouseMotionListener(motionListener);
table.remove(glassPane);
this.mouseListener = null;
this.motionListener = null;
this.glassPane = null;
}
this.table = null;
}
// ________________________________________________________________________
public void paintComponent(Graphics g) {
}
// ________________________________________________________________________
protected DrawingState getDrawingState(JXTable table, Point location ) {
int row = table.rowAtPoint(location);
int column = table.columnAtPoint(location);
if (row < 0 || column < 0)
return null;
Object value = table.getValueAt(row, column);
return value instanceof DrawingState ? (DrawingState) value : null;
}
protected Rectangle getCellRect(JXTable table, Point location) {
int row = table.rowAtPoint(location);
int column = table.columnAtPoint(location);
if (row < 0 || column < 0)
return null;
return table.getCellRect(row, column, true);
}
protected Rectangle getTranslatedCellRect(Rectangle cellRect) {
return new Rectangle(0, 0, cellRect.width, cellRect.height);
}
protected MouseEvent getTranslatedMouseEvent(MouseEvent evt, Rectangle cellRect) {
Point location = new Point(evt.getPoint());
location.translate(-cellRect.x, -cellRect.y);
Component component = SwingUtilities.getAncestorOfClass(GanttTable.class, evt.getComponent()) != null
? SwingUtilities.getAncestorOfClass(GanttTable.class, evt.getComponent()) : evt.getComponent();
return location != null ?
new MouseEvent(component, evt.getID(), evt.getWhen(), evt.getModifiers(),
location.x, location.y, evt.getClickCount(), evt.isPopupTrigger(), evt.getButton()) : null;
}
// ________________________________________________________________________
protected class LocalMotionListener implements MouseMotionListener {
public void mouseDragged(MouseEvent e) {
if (e.isPopupTrigger())
return;
if (stateEditor == null)
return;
Rectangle cellRect = getCellRect((JXTable) e.getComponent(), e.getPoint());
if (cellRect == null)
return;
DrawingState state = getDrawingState((JXTable) e.getComponent(), e.getPoint());
DrawingContext context = table.getDrawingContext();
MouseEvent evt = getTranslatedMouseEvent(e, cellRect);
if (state != null && context != null && evt != null)
{
stateEditor.mouseDragged(evt, getTranslatedCellRect(cellRect), state, axisKey, context);
e.getComponent().repaint();
glassPane.repaint();
}
}
/**
* Invoked when the mouse button has been moved on a component (with no
* buttons down).
*/
public void mouseMoved(MouseEvent e) {
if (e.isPopupTrigger())
return;
if (stateEditor == null)
return;
Rectangle cellRect = getCellRect((JXTable) e.getComponent(), e.getPoint());
if (cellRect == null)
return;
DrawingState state = getDrawingState((JXTable) e.getComponent(), e.getPoint());
DrawingContext context = table.getDrawingContext();
MouseEvent evt = getTranslatedMouseEvent(e, cellRect);
if (state != null && context != null && evt != null) {
stateEditor.mouseMoved(evt, getTranslatedCellRect(cellRect), state, axisKey, context);
e.getComponent().repaint();
glassPane.repaint();
}
}
}
// ________________________________________________________________________
protected StateEditor getAxisKey(DrawingContext context) {
return modeKey != null ? (StateEditor) context.get(modeKey, ContextResources.STATE_EDITOR) : null;
}
// ________________________________________________________________________
protected class LocalGlassPane extends JPanel {
private static final long serialVersionUID = 1L;
LocalGlassPane() {
super(null, true);
setOpaque(false);
}
public void paintComponent(Graphics g) {
// Point p = this.getParent().getMousePosition();
//g.setColor(Color.RED);
//g.drawString("Position:" + p, this.getWidth() - 200, this.getHeight());
}
}
protected class LocalMouseListener extends MouseAdapter {
/**
* Invoked when the mouse button has been clicked (pressed and released)
* on a component.
*/
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger())
return;
stateEditor = getAxisKey(table.getDrawingContext());
if (stateEditor == null)
return;
Rectangle cellRect = getCellRect((JXTable) e.getComponent(), e.getPoint());
if (cellRect == null)
return;
DrawingState state = getDrawingState((JXTable) e.getComponent(), e.getPoint());
DrawingContext context = table.getDrawingContext();
MouseEvent evt = getTranslatedMouseEvent(e, cellRect);
if (state != null && context != null && evt != null) {
stateEditor.mousePressed(evt, getTranslatedCellRect(cellRect), state, axisKey, context);
e.getComponent().repaint();
glassPane.repaint();
}
}
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger())
return;
if (stateEditor == null)
return;
Rectangle cellRect = getCellRect((JXTable) e.getComponent(), e.getPoint());
if (cellRect == null)
return;
DrawingState state = getDrawingState((JXTable) e.getComponent(), e.getPoint());
DrawingContext context = table.getDrawingContext();
MouseEvent evt = getTranslatedMouseEvent(e, cellRect);
if (state != null && context != null && evt != null) {
stateEditor.mouseReleased(evt, getTranslatedCellRect(cellRect), state, axisKey, context);
e.getComponent().invalidate();
glassPane.repaint();
}
}
}
} | 7,343 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ClickDrawingToolAdapter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/table/ClickDrawingToolAdapter.java | package ext.egantt.actions.table;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.AbstractAction;
import org.jdesktop.swingx.JXTable;
import ext.egantt.actions.DrawingTool;
import ext.egantt.swing.GanttTable;
public class ClickDrawingToolAdapter implements DrawingTool {
protected final AbstractAction action;
protected final String actionCommand;
protected transient GanttTable table;
protected LocalMouseListener listener = new LocalMouseListener();
public ClickDrawingToolAdapter(AbstractAction action) {
this (action, ClickDrawingToolAdapter.class.getName());
}
public ClickDrawingToolAdapter(AbstractAction action, String actionCommand) {
this.action = action;
this.actionCommand = actionCommand;
}
// ________________________________________________________________________
public void intialize(GanttTable table) {
if (this.table != null)
terminate();
if (this.action != null) {
this.table = table;
table.addMouseListener(listener);
}
}
public void terminate() {
if (this.action != null) {
table.removeMouseListener(listener);
}
this.table = null;
}
// ________________________________________________________________________
public void paintComponent(Graphics g) {
}
// ________________________________________________________________________
protected class LocalMouseListener extends MouseAdapter {
public void mouseClicked(MouseEvent e)
{
if (!(e.getComponent() instanceof JXTable))
return;
if (action instanceof AbstractDrawingAction)
{
((AbstractDrawingAction)action).actionPerformed((JXTable) e.getComponent(), e.getPoint(),
new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, actionCommand));
}
else
{
action.actionPerformed(new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, actionCommand));
}
}
}
} | 2,016 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
SelectAllAction.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/table/SelectAllAction.java | /**
* @(#)SelectAllAction.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.actions.table;
import java.awt.Point;
import java.awt.event.ActionEvent;
import javax.swing.Icon;
import javax.swing.JComponent;
import org.jdesktop.swingx.JXTable;
/**
* <code>SelectAllAction</code> Selects all the rows in a table
*/
public class SelectAllAction extends AbstractTableAction
{
private static final long serialVersionUID = 5665167758065156432L;
public SelectAllAction(String name, Icon icon, JComponent component)
{
super(name, icon, component);
}
// _________________________________________________________________________
protected void actionPerformed(JXTable table, Point location, ActionEvent event)
{
if (table != null)
{
table.selectAll();
}
}
} | 863 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AbstractDrawingAction.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/table/AbstractDrawingAction.java | package ext.egantt.actions.table;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import javax.swing.Icon;
import javax.swing.JComponent;
import org.jdesktop.swingx.JXTable;
import com.egantt.model.drawing.DrawingState;
public abstract class AbstractDrawingAction extends AbstractTableAction{
private static final long serialVersionUID = 1L;
public AbstractDrawingAction(String name, Icon icon, JComponent component) {
super(name, icon, component);
}
// ________________________________________________________________________
@Override
protected final void actionPerformed(JXTable table, Point location, ActionEvent event) {
if (location == null)
return;
int row = table.rowAtPoint(location);
int column = table.columnAtPoint(location);
if (row < 0 || column < 0)
return;
Rectangle cellRect = table.getCellRect(row, column, true);
Point cellLocation = new Point(location);
cellLocation.translate(-cellRect.x, -cellRect.y);
Object value = table.getValueAt(row, column);
if (value instanceof DrawingState) {
actionPerformed(table, (DrawingState) value, cellLocation, event);
}
}
// ________________________________________________________________________
protected abstract void actionPerformed(JXTable table, DrawingState drawing, Point location, ActionEvent event);
} | 1,370 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AbstractTableAction.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/actions/table/AbstractTableAction.java | /**
* @(#) AbstractTableAction.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.actions.table;
import java.awt.Component;
import java.awt.Container;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.lang.reflect.Field;
import javax.swing.AbstractAction;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JPopupMenu;
import org.jdesktop.swingx.JXTable;
import javax.swing.SwingUtilities;
public abstract class AbstractTableAction extends AbstractAction
{
private static final long serialVersionUID = 566516734580651432L;
protected JComponent component;
public AbstractTableAction(String name, Icon icon, JComponent component)
{
super(name, icon);
setComponent(component);
}
// _________________________________________________________________________
public void setComponent(JComponent component)
{
this.component = component;
}
// _________________________________________________________________________
public final void actionPerformed(ActionEvent event)
{
Component component = null;
Point location = null;
if (this.component != null) {
component = this.component;
}
else if (SwingUtilities.getAncestorOfClass(JPopupMenu.class,
(Component) event.getSource()) != null);
{
JPopupMenu parent = (JPopupMenu) SwingUtilities.getAncestorOfClass(JPopupMenu.class,
(Component) event.getSource());
while (parent.getInvoker() instanceof JMenu)
{
parent = (JPopupMenu) SwingUtilities.getAncestorOfClass(JPopupMenu.class,
parent.getInvoker());
}
component = (JComponent) parent.getInvoker();
Point screenPoint = getPreferredLocation(parent);
if (screenPoint != null)
{
location = screenPoint;
SwingUtilities.convertPointFromScreen(location, component);
}
}
if (component == null)
return;
JXTable table = (JXTable) SwingUtilities.getAncestorOfClass(JXTable.class, component);
table = table != null ? table : findTable(component) ;
if (table != null)
actionPerformed(table, location, event);
}
// ________________________________________________________________________
protected abstract void actionPerformed(JXTable table, Point location, ActionEvent event);
// ________________________________________________________________________
protected JXTable findTable(Component component) {
if (component instanceof JXTable)
return (JXTable) component;
if (!(component instanceof Container))
return null;
Container container = (Container) component;
for (int i=0; i < container.getComponentCount(); i++) {
JXTable result = findTable(container.getComponent(i));
if (result != null)
return result;
}
return null;
}
private Point getPreferredLocation(final JPopupMenu menu) {
try
{
int desiredLocationX = -1 ,desiredLocationY = -1;
final Field fields[] = JPopupMenu.class.getDeclaredFields();
for (int i = 0; i < fields.length; ++i) {
if ("desiredLocationX".equals(fields[i].getName())) {
fields[i].setAccessible(true);
desiredLocationX = fields[i].getInt(menu);
}
if ("desiredLocationY".equals(fields[i].getName())) {
fields[i].setAccessible(true);
desiredLocationY = fields[i].getInt(menu);
}
}
return desiredLocationX != -1 && desiredLocationY != -1
? new Point(desiredLocationX, desiredLocationY) : null;
}
catch (IllegalAccessException ex) {
return null;
}
}
} | 3,604 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
JFrameLauncher.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/launcher/JFrameLauncher.java | /*
* @(#)JFrameLauncher.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.launcher;
//import demo.egantt.component.ComponentExample;
//import demo.egantt.component.example.mdi.BasicMDIExample;
import ext.egantt.util.Hive;
import ext.egantt.util.hive.ClassHive;
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* Starts up E-Gantt in a frame basically a launch pad with the void main()
*/
public class JFrameLauncher extends JFrame
{
private static final long serialVersionUID = 2949878372216003309L;
public JFrameLauncher(String imagePath)
{
// initialise the hive
Hive.setHiveImpl(new ClassHive(getClass().getClassLoader()));
Image image = new ImageIcon(Hive.getURL(imagePath)).getImage();
if (image != null)
setIconImage(image);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new LocalWindowAdapter());
}
// __________________________________________________________________________
public void initialise(String arguments[])
{
/*ComponentExample example = new BasicMDIExample();
example.setArguments(arguments);
example.setContainer (getContentPane());
example.show();*/
}
// __________________________________________________________________________
public static void main(String args[])
{
// create a frame get it ready for us to use
JFrameLauncher frame = new JFrameLauncher("images/eGanttSTD.gif");
frame.setSize(800, 500);
frame.setTitle("EGantt: Enterprise Gantt: [release] @see egantt.wikispaces.com");
// add to the content pane
frame.initialise(args);
// set the frame visible
frame.setVisible(true);
}
// __________________________________________________________________________
protected static class LocalWindowAdapter extends WindowAdapter
{
public void windowClosed (WindowEvent e)
{
System.exit(0);
}
}
}
| 1,995 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GanttDrawingPartHelper.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/swing/GanttDrawingPartHelper.java | package ext.egantt.swing;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.egantt.model.drawing.DrawingPart;
import com.egantt.model.drawing.DrawingState;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.axis.interval.DrawingStateInterval;
import com.egantt.model.drawing.axis.interval.LongInterval;
import com.egantt.model.drawing.part.ListDrawingPart;
import com.egantt.model.drawing.state.BasicDrawingState;
import ext.egantt.drawing.module.BoundedPainterModule;
import ext.egantt.drawing.module.FilledPainterModule;
import ext.egantt.drawing.module.GanttDrawingModule;
import ext.egantt.drawing.module.GradientColorModule;
import ext.egantt.drawing.module.StandardDrawingModule;
public class GanttDrawingPartHelper {
protected final ListDrawingPart linkDrawingPart = new ListDrawingPart(GanttTable.axises, StandardDrawingModule.DEFAULT_PART_PAINTER, true);
// ________________________________________________________________________
public BasicDrawingState createDrawingState() {
BasicDrawingState drawingState = new BasicDrawingState();
drawingState.addDrawingPart(linkDrawingPart);
return drawingState;
}
public ListDrawingPart createDrawingPart(boolean summaryPart) {
// register the part with the state
ListDrawingPart drawingPart = new ListDrawingPart(GanttTable.axises, StandardDrawingModule.DEFAULT_PART_PAINTER, summaryPart);
return drawingPart;
}
// ________________________________________________________________________
public void createActivityEntry(Object key, Date startDate, Date endDate, ListDrawingPart part) {
createActivityEntry(key, startDate, endDate, GradientColorModule.RED_GRADIENT_CONTEXT, part);
}
public void createActivityEntry(Object key, Date startDate, Date endDate, String context, ListDrawingPart part) {
createActivityEntry(key, startDate, endDate, FilledPainterModule.FILLED_RECTANGLE_PAINTER, context, part);
}
public DrawingPart createActivityEntry(Object key, Date startDate, Date endDate, String painter, String context, ListDrawingPart part) {
AxisInterval intervals [] = new AxisInterval [2];
intervals[0] = new LongInterval(startDate.getTime(), endDate.getTime());
intervals[1] = new LongInterval(5, 95);
part.add(key, intervals, painter , StandardDrawingModule.DEFAULT_PAINTER_STATE, context);
return part;
}
// ________________________________________________________________________
public void createLinkEntry(DrawingState start, DrawingState finish) {
createLinkEntry(start, finish, GradientColorModule.GREEN_GRADIENT_CONTEXT);
}
public void createLinkEntry(DrawingState start, DrawingState finish, String context) {
{
ArrayList <DrawingState>drawingStates = new ArrayList<DrawingState>(2);
drawingStates.add(start);
drawingStates.add(finish);
AxisInterval intervals [] = new AxisInterval [3];
intervals[0] = null;
intervals[1] = new LongInterval(0, 100);
intervals[2] = new DrawingStateInterval("xAxis", drawingStates);
linkDrawingPart.add(new Object(), intervals, GanttDrawingModule.LINK_ENTRY_PLOTTER, StandardDrawingModule.DEFAULT_PAINTER_STATE, context);
}
}
// ________________________________________________________________________
public void createShiftEntry(Object key, List <DrawingState> drawingState, ListDrawingPart part) {
createShiftEntry(key, drawingState, GradientColorModule.BLACK_GRADIENT_CONTEXT, part);
}
public void createShiftEntry(Object key, List <DrawingState> drawingState, String context, ListDrawingPart part) {
AxisInterval intervals [] = new AxisInterval [2];
intervals[0] = new DrawingStateInterval("xAxis", drawingState);
intervals[1] = new LongInterval(5, 95);
part.add(key, intervals, GanttDrawingModule.SHIFT_ENTRY_PLOTTER, StandardDrawingModule.DEFAULT_PAINTER_STATE, context);
}
// ________________________________________________________________________
public void createMilestoneEntry(Object key, Date date, ListDrawingPart part) {
createMilestoneEntry(key, date, BoundedPainterModule.BOUNDED_DIAMOND_PAINTER, part);
}
public void createMilestoneEntry(Object key, Date date, String painter, ListDrawingPart part) {
createMilestoneEntry(key, date, painter, GradientColorModule.BLUE_GRADIENT_CONTEXT, part);
}
public void createMilestoneEntry(Object key, Date date, String painter, String context, ListDrawingPart part) {
AxisInterval intervals [] = new AxisInterval [2];
intervals[0] = new LongInterval(date.getTime(), Long.MAX_VALUE);
intervals[1] = new LongInterval(17, 83);
part.add(key, intervals, painter, StandardDrawingModule.DEFAULT_PAINTER_STATE, context);
}
// ________________________________________________________________________
public void createPercentageEntry(Object key, int i, Date date, Date date2, ListDrawingPart part) {
createPercentageEntry(key, i, date, date2, GradientColorModule.ORANGE_GRADIENT_CONTEXT, part);
}
public void createPercentageEntry(Object key, int i, Date date, Date date2, String context, ListDrawingPart part) {
AxisInterval intervals [] = new AxisInterval [3];
intervals[0] = new LongInterval(date.getTime(), date2.getTime());
intervals[1] = new LongInterval(17, 83);
intervals[2] = new LongInterval(0, i);
part.add(new Object(), intervals, GanttDrawingModule.AXIS_PERCENTAGE_PAINTER, StandardDrawingModule.DEFAULT_PAINTER_STATE, context);
}
} | 5,440 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
JTableHelper.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/swing/JTableHelper.java | package ext.egantt.swing;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
public class JTableHelper {
/**
* Immitate the same behaviour as JXTable it is ugly but people seem to like it!:(
*/
public static TableModel createTableModel(final Object[][] rowData, final Object[][] columnNames) {
final DefaultTableModel model = new LocalTableModel();
for (int a=0; a < columnNames.length; a++) {
for (int b=0; b < columnNames[a].length; b++) {
model.addColumn(columnNames[a][b]);
}
}
for (int a=0; a < rowData.length; a++) {
model.addRow(rowData[a]);
}
return model;
}
/**
* Generate the column names from the table model assuming the split between
* the column names is the last column is second table all other column in
* the first table.
*
* I know that this is not very re-usable but makes a very good default for users
* looking to get started.
*/
public static Object[][] createColumnNames(TableModel model) {
Object[][] rowValues = new Object[2][0];
rowValues[0] = new Object[model.getColumnCount() == 0 ? 0 : model.getColumnCount() -1];
rowValues[1] = new Object[model.getColumnCount() == 0 ? 0 : 1];
for (int a = 0; a < model.getColumnCount() -1; a++ )
rowValues[0][a] = (Object) model.getColumnName(a);
if (rowValues[1].length != 0)
rowValues[1][0] = model.getColumnName(model.getColumnCount() -1);
return rowValues;
}
protected static class LocalTableModel extends DefaultTableModel {
private static final long serialVersionUID = -6461426413301785033L;
@Override
public Class<?> getColumnClass(int columnIndex) {
for (int i=0; i < this.getRowCount(); i++) {
Object value = this.getValueAt(i, columnIndex);
if (value != null)
return value.getClass();
}
return super.getColumnClass(columnIndex);
}
}
} | 1,876 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GanttToolBar.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/swing/GanttToolBar.java | package ext.egantt.swing;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JToolBar;
import com.egantt.drawing.view.ViewManager;
import ext.egantt.actions.view.ZoomAction;
import ext.egantt.util.Hive;
public class GanttToolBar extends JToolBar {
private static final long serialVersionUID = 4446944839918343841L;
public GanttToolBar(ViewManager manager) {
ZoomAction action = new ZoomAction("ZOOM IN", getIcon("images/zoomIn.gif"));
action.setStep(-10);
action.setManager(manager);
add(action);
action = new ZoomAction("ZOOM OUT", getIcon("images/zoomOut.gif"));
action.setStep(+20);
action.setManager(manager);
add(action);
addSeparator();
}
// __________________________________________________________________________
private static final ImageIcon getIcon(String path)
{
URL url = Hive.getURL(path);
return url != null ? new ImageIcon(url) : new ImageIcon(path);
}
} | 933 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GanttTable.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/swing/GanttTable.java | package ext.egantt.swing;
import com.egantt.drawing.view.ViewManager;
import com.egantt.model.component.ComponentList;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.DrawingPart;
import com.egantt.model.drawing.axis.interval.LongInterval;
import com.egantt.model.drawing.state.BasicDrawingState;
import com.egantt.swing.table.list.BasicJTableList;
import com.egantt.swing.table.model.column.ColumnManager;
import com.egantt.swing.table.model.column.manager.BasicColumnManager;
import ext.egantt.actions.DrawingTool;
import ext.egantt.component.holder.SplitLayeredHolder;
import ext.egantt.drawing.GanttComponentUtilities;
import org.jdesktop.swingx.JXTable;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.stream.IntStream;
public class GanttTable extends SplitLayeredHolder {
private static final long serialVersionUID = 198427067966485637L;
public final static String axises[] = new String[] {"xAxis", "yAxis", "percentageAxis"};
public final static String X_AXIS = axises[0];
public final static String Y_AXIS = axises[1];
public final static String TIME_AXIS = axises[0];
public final static String HEIGHT_AXIS = axises[1];
public final static String PERCENTAGE_AXIS = axises[2];
protected ColumnManager columnManager;
protected ComponentList componentList;
protected GanttComponentUtilities componentUtils;
protected LocalPopupMouseListener mouseListener;
protected DrawingTool drawingTool;
private JPopupMenu popup;
/**
* Simulate JXTable row, column interface
* @param rowData
* @param columnNames
*/
public GanttTable(final Object[][] rowData, final Object[][] columnNames)
{
this(rowData, columnNames, new BasicJTableList());
}
public GanttTable(final Object[][] rowData, final Object[][] columnNames, ComponentList componentList)
{
this(JTableHelper.createTableModel(rowData, columnNames), componentList, columnNames);
}
public GanttTable(Object rowData[][], Object columnNames[][], ComponentList componentList, java.util.List eventList)
{
this(JTableHelper.createTableModel(rowData, columnNames), componentList, columnNames, eventList);
}
public GanttTable(TableModel model, ComponentList componentList) {
this (model, componentList, JTableHelper.createColumnNames(model));
}
public GanttTable(TableModel model) {
this (model, new BasicJTableList(), JTableHelper.createColumnNames(model));
}
public GanttTable(TableModel model, String columnNames[][]) {
this (model, new BasicJTableList(), columnNames);
}
public GanttTable(TableModel model, ComponentList componentList, final Object[][] columnNames) {
this.setDoubleBuffered(false);
this.componentList = componentList;
this.componentUtils = new GanttComponentUtilities(axises);
this.columnManager = new BasicColumnManager(model, columnNames);
componentList.setColumnManager(columnManager);
componentList.setComponentManager(componentUtils.getManager());
setComponentList(componentList);
setRangeModel(componentUtils.getScrollManager(0));
}
public GanttTable(TableModel model, ComponentList componentList, Object columnNames[][], List eventList)
{
this.componentList = componentList;
componentUtils = new GanttComponentUtilities(axises, eventList);
columnManager = new BasicColumnManager(model, columnNames);
componentList.setColumnManager(columnManager);
componentList.setComponentManager(componentUtils.getManager());
setComponentList(componentList);
setRangeModel(componentUtils.getScrollManager(0));
setComparatorActivity();
}
private void setComparatorActivity() {
TableRowSorter<TableModel> rowSorter = new TableRowSorter<>(getJXTable().getModel());
getJXTable().setRowSorter(rowSorter);
rowSorter.setComparator(0, (Comparator<BasicDrawingState>) (o1, o2) -> {
StringBuffer values1 = null;
StringBuffer values2 = null;
for (Iterator iterator = o1.parts(); iterator.hasNext();) {
DrawingPart part1 = (DrawingPart) iterator.next();
if (part1.getInterval() != null) {
for (Iterator iteratorInter = part1.values(part1.getInterval()); iteratorInter.hasNext();) {
values1 = (StringBuffer) iteratorInter.next();
}
}
}
for (Iterator iterator = o2.parts(); iterator.hasNext();) {
DrawingPart part2 = (DrawingPart) iterator.next();
if (part2.getInterval() != null) {
for (Iterator iteratorInter = part2.values(part2.getInterval()); iteratorInter.hasNext();) {
values2 = (StringBuffer) iteratorInter.next();
}
}
}
double value1 = Double.parseDouble(values1.toString().replace("%",""));
double value2 = Double.parseDouble(values2.toString().replace("%",""));
return Double.compare(value1,value2);
});
// Comparator for 2/3 column (String and Integer are differ)
//setComparatorForColumn(rowSorter, 1);
//setComparatorForColumn(rowSorter, 2);
IntStream.range(1, getJXTable().getModel().getColumnCount())
.forEach(e -> setComparatorForColumn(rowSorter, e));
}
private void setComparatorForColumn(TableRowSorter tableRowSorter, int column){
tableRowSorter.setComparator(column, (Comparator<String>) (o1, o2) -> {
if (!isNumeric(o1) || !isNumeric(o2)){
return o1.toString().compareToIgnoreCase(o2.toString());
} else {
return Long.compare(Long.parseLong(o1.toString()), Long.parseLong(o2.toString()));
}
});
}
// ________________________________________________________________________
public void paint(Graphics g) {
super.paint(g);
if (drawingTool != null)
drawingTool.paintComponent(g);
}
// ________________________________________________________________________
public void addMouseListener(MouseListener adapter) {
if (componentList == null)
return;
for (int i=0; i < componentList.size(); i++) {
JXTable table = (JXTable) componentList.get(i);
table.addMouseListener(adapter);
}
}
public void removeMouseListener(MouseListener adapter) {
if (componentList == null)
return;
for (int i=0; i < componentList.size(); i++) {
JXTable table = (JXTable) componentList.get(i);
table.removeMouseListener(adapter);
}
}
// ________________________________________________________________________
public void addMouseMotionListener(MouseMotionListener adapter) {
if (componentList == null)
return;
for (int i=0; i < componentList.size(); i++) {
JXTable table = (JXTable) componentList.get(i);
table.addMouseMotionListener(adapter);
}
}
public void removeMouseMotionListener(MouseMotionListener adapter) {
if (componentList == null)
return;
for (int i=0; i < componentList.size(); i++) {
JXTable table = (JXTable) componentList.get(i);
table.removeMouseMotionListener(adapter);
}
}
public void setComponentPopupMenu(JPopupMenu popup) {
if (componentList == null)
return;
if (mouseListener != null)
removeMouseListener(mouseListener);
this.popup = popup;
if (popup != null) {
this.mouseListener = new LocalPopupMouseListener();
addMouseListener(mouseListener);
}
}
// ________________________________________________________________________
public DrawingTool getDrawingTool() {
return drawingTool;
}
public void setDrawingTool(DrawingTool drawingTool) {
if (this.drawingTool != null)
this.drawingTool.terminate();
this.drawingTool = drawingTool;
if (this.drawingTool != null)
drawingTool.intialize(this);
}
public int getRowCount() {
return getModel().getRowCount();
}
public int getColumnCount() {
return getModel().getColumnCount();
}
public TableModel getModel() {
return columnManager.getModel();
}
public JXTable getTableComponent(int index) {
return (JXTable) componentList.get(index);
}
public TableColumnModel getColumnModel(int index) {
return columnManager.get(index);
}
public TableCellEditor getDefaultEditor(int index, Class columnClass) {
JXTable table = getTableComponent(index);
return table != null ? table.getDefaultEditor(columnClass) : null;
}
public TableCellRenderer getDefaultRenderer(int index, Class columnClass) {
JXTable table = getTableComponent(index);
return table != null ? table.getDefaultRenderer(columnClass) : null;
}
public int getColumnModelCount() {
return columnManager.size();
}
public JTableHeader getTableHeader(int index) {
JXTable table = getTableComponent(index);
return table != null ? table.getTableHeader() : null;
}
public DrawingContext getDrawingContext() {
return componentUtils.getContext();
}
/**
public DrawingComponent getDefaultDrawingComponent(int index) {
JXTable table = getTableComponent(index);
TableCellRenderer renderer = table.getDefaultRenderer(AbstractDrawingState.class);
if (renderer instanceof JTableRendererAdapter) {
}
return c != null ? SwingUtilities.test() : null;
}*/
public ViewManager getViewManager(String axis) {
DrawingContext context = getDrawingContext();
return (ViewManager) context.get(axis, ContextResources.VIEW_MANAGER);
}
public JXTable getJXTable(){
return (JXTable)componentList.get(0);
}
// ________________________________________________________________________
/**
* This code is used to set the start and end points of the time line
*/
public boolean setTimeRange(Date start, Date finish) {
if (start == null || finish == null)
return false;
if (start.equals(finish) || start.after(finish))
return false;
LongInterval interval = new LongInterval(start.getTime(), finish.getTime());
ViewManager viewManager = getViewManager(GanttTable.TIME_AXIS);
viewManager.getAxis().setInterval(interval);
return true;
}
public void cancelEditing() {
if (componentList == null)
return;
for (int i=0; i < componentList.size(); i++) {
JXTable table = (JXTable) componentList.get(i);
if (table.isEditing()) {
// try to stop cell editing, and failing that, cancel it
if (!table.getCellEditor().stopCellEditing()) {
table.getCellEditor().cancelCellEditing();
}
}
}
}
public void setRowHeightForJtable(int rowHeightForJtable)
{
if(componentList == null)
return;
for(int i = 0; i < componentList.size(); i++)
{
JXTable table = (JXTable)componentList.get(i);
table.setRowHeight(rowHeightForJtable);
}
}
/*
public void setLongComparatorByColumn(int columnIndex){
TableRowSorter<TableModel> rowSorter = new TableRowSorter<>(getJXTable().getModel());
getJXTable().setRowSorter(rowSorter);
rowSorter.setComparator(columnIndex, (Comparator<String>) (o1, o2) -> {
System.out.println(Long.parseLong(o1.toString()));
System.out.println(Long.parseLong(o2.toString()));
return Long.compare(Long.parseLong(o1.toString()), Long.parseLong(o2.toString()));
});
}*/
// ________________________________________________________________________
protected class LocalPopupMouseListener extends MouseAdapter {
public void mousePressed(MouseEvent e) {
maybeShowPopup(e);
}
public void mouseReleased(MouseEvent e) {
maybeShowPopup(e);
}
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger())
{
popup.show(e.getComponent(),
e.getX(), e.getY());
}
}
}
public static boolean isNumeric(String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (Character.isDigit(str.charAt(i)) == false) {
return false;
}
}
return true;
}
} | 11,928 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GanttEntryHelper.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/swing/GanttEntryHelper.java | package ext.egantt.swing;
import java.util.Date;
import java.util.List;
import com.egantt.model.drawing.DrawingState;
import com.egantt.model.drawing.part.ListDrawingPart;
import com.egantt.model.drawing.state.BasicDrawingState;
import ext.egantt.drawing.state.CalendarDrawingState;
public class GanttEntryHelper {
protected final GanttDrawingPartHelper helper;
public GanttEntryHelper() {
this(null);
}
public GanttEntryHelper(GanttDrawingPartHelper helper) {
this.helper = helper != null ? helper : new GanttDrawingPartHelper();
}
// ________________________________________________________________________
public DrawingState createCalendar() {
return new CalendarDrawingState(GanttTable.axises);
}
// ________________________________________________________________________
public DrawingState createActivityEntry(Date startDate, Date endDate) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createActivityEntry(drawingState, startDate, endDate, part);
drawingState.addDrawingPart(part);
return drawingState;
}
public DrawingState createActivityEntry(Date startDate, Date endDate,
String context) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createActivityEntry(drawingState, startDate, endDate, context,
part);
drawingState.addDrawingPart(part);
return drawingState;
}
public DrawingState createActivityEntry(Date startDate, Date endDate,
String painter, String context) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createActivityEntry(drawingState, startDate, endDate, painter,
context, part);
drawingState.addDrawingPart(part);
return drawingState;
}
// ________________________________________________________________________
public void createLinkEntry(DrawingState start, DrawingState finish) {
helper.createLinkEntry(start, finish);
}
public void createLinkEntry(DrawingState start, DrawingState finish,
String context) {
helper.createLinkEntry(start, finish, context);
}
// ________________________________________________________________________
public DrawingState createShiftEntry(List<DrawingState> drawingStates) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createShiftEntry(drawingState, drawingStates, part);
drawingState.addDrawingPart(part);
return drawingState;
}
public DrawingState createShiftEntry(List<DrawingState> drawingStates,
String context) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createShiftEntry(drawingState, drawingStates, context, part);
drawingState.addDrawingPart(part);
return drawingState;
}
// ________________________________________________________________________
public Object createMilestoneEntry(Date date) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createMilestoneEntry(drawingState, date, part);
drawingState.addDrawingPart(part);
return drawingState;
}
public Object createMilestoneEntry(Date date, String painter) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createMilestoneEntry(drawingState, date, painter, part);
drawingState.addDrawingPart(part);
return drawingState;
}
public Object createMilestoneEntry(Date date, String painter, String context) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createMilestoneEntry(drawingState, date, painter, context, part);
drawingState.addDrawingPart(part);
return drawingState;
}
// ________________________________________________________________________
public Object createPercentageEntry(int i, Date date, Date date2) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createPercentageEntry(drawingState, i, date, date2, part);
drawingState.addDrawingPart(part);
return drawingState;
}
public Object createPercentageEntry(int i, Date date, Date date2,
String context) {
BasicDrawingState drawingState = helper.createDrawingState();
ListDrawingPart part = helper.createDrawingPart(false);
helper.createPercentageEntry(drawingState, i, date, date2, context,
part);
drawingState.addDrawingPart(part);
return drawingState;
}
} | 4,757 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ComponentHolder.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/component/ComponentHolder.java | /*
* @(#)ComponentHolder.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.component;
import java.awt.Component;
/**
* A TableComponent takes in a TableState in-order to provide it with it's
* underlying data that it requires
*/
public interface ComponentHolder
{
/**
* Returns a component based on the specified model
*/
Component getComponent();
}
| 451 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DefaultFieldManager.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/component/field/manager/DefaultFieldManager.java | /**
* @(#)DefaultFieldManager.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.component.field.manager;
import com.egantt.awt.graphics.GraphicsState;
import com.egantt.drawing.component.DrawingComponent2D;
import com.egantt.drawing.component.painter.state.BasicStatePainter;
import com.egantt.model.component.ComponentManager;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.state.AbstractDrawingState;
import com.egantt.model.drawing.state.BasicDrawingState;
import com.egantt.model.drawing.state.SingletonDrawingState;
import com.egantt.swing.cell.CellEditor;
import com.egantt.swing.cell.editor.adapter.JTableEditorAdapter;
import com.egantt.swing.cell.editor.state.ManagedStateEditor;
import com.egantt.swing.cell.renderer.adapter.JTableRendererAdapter;
import com.egantt.swing.cell.renderer.state.ManagedStateRenderer;
import com.egantt.swing.component.ComponentContext;
import com.egantt.swing.component.repaint.manager.DrawingRepaintManager;
import org.jdesktop.swingx.JXTable;
import javax.swing.*;
/**
* An intermediate solution until a proper FieldManager can be written
* and dealt with.
*/
public class DefaultFieldManager implements ComponentManager
{
protected final DrawingContext context;
protected final DrawingRepaintManager stateManager = new DrawingRepaintManager();
protected final GraphicsState state;
public DefaultFieldManager(GraphicsState state, DrawingContext context)
{
this.state = state;
this.context = context;
}
// __________________________________________________________________________
public void registerComponent(JComponent component, ComponentContext componentContext)
{
stateManager.registerComponent(component, componentContext);
if (component instanceof JXTable)
setFields((JXTable) component, componentContext);
}
public void unregisterComponent(JComponent component)
{
}
// __________________________________________________________________________
protected void setFields(JXTable table, ComponentContext componentContext)
{
{
ManagedStateRenderer renderer = createStateRenderer(state, context, stateManager, componentContext);
table.getTableHeader().setDefaultRenderer(new JTableRendererAdapter(renderer, false, true));
table.getTableHeader().setPreferredSize(new java.awt.Dimension(0, 30));
table.setDefaultRenderer(AbstractDrawingState.class, new JTableRendererAdapter(renderer, false, false));
}
{
ManagedStateRenderer renderer = createStateRenderer(state, context, stateManager, componentContext);
ManagedStateEditor editor = new ManagedStateEditor(renderer, stateManager, context);
JTableEditorAdapter editorAdapter = new JTableEditorAdapter(editor);
table.setDefaultEditor(SingletonDrawingState.class, editorAdapter);
table.setDefaultEditor(BasicDrawingState.class, editorAdapter);
table.setDefaultEditor(AbstractDrawingState.class, editorAdapter);
}
}
// __________________________________________________________________________
protected CellEditor createStateEditor(GraphicsState state, DrawingContext context,
DrawingRepaintManager repaintManager, ComponentContext componentContext)
{
return new ManagedStateEditor(createStateRenderer(state, context, repaintManager, componentContext), repaintManager, context);
}
// protected static final DrawingComponent2D drawing = new DrawingComponent2D();
private ManagedStateRenderer createStateRenderer(GraphicsState state, DrawingContext context,
DrawingRepaintManager repaintManager, ComponentContext componentContext)
{
// create the drawingComponent with the appropriate context + graphicsDevice
DrawingComponent2D component = new DrawingComponent2D();
component.setGraphicsState(state);
// component height is used by the header-renderer width is of no importance
component.setPreferredSize(new java.awt.Dimension(0, 30)); // 18
// a managed state cell renderer, will update the StateManager with the last
// known state to listenTo: note this is not ideal but the lack of a complete
// model of all states makes this neccesary for now.
ManagedStateRenderer cellRenderer = new ManagedStateRenderer(
component, repaintManager, componentContext);
cellRenderer.setComponentPainter(new BasicStatePainter(context));
return cellRenderer;
}
} | 4,398 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
SplitComponentHolder.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/component/holder/SplitComponentHolder.java | /*
* @(#)SplitComponentHolder.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.component.holder;
import java.awt.Component;
import javax.swing.BoundedRangeModel;
import com.egantt.model.component.ComponentList;
import com.egantt.swing.pane.basic.SplitScrollPane;
import ext.egantt.component.ComponentHolder;
/**
* The most basic implementation of the split table thing
*/
public class SplitComponentHolder extends SplitScrollPane implements ComponentHolder
{
private static final long serialVersionUID = 7207030660661282954L;
public SplitComponentHolder()
{
super(SplitScrollPane.HORIZONTAL_SPLIT);
}
// __________________________________________________________________________
public void setComponentList(ComponentList list)
{
setLeftComponent(list.get(0));
setRightComponent(list.get(1));
}
public void setRangeModel(BoundedRangeModel model)
{
super.setRangeModel(model);
}
// __________________________________________________________________________
public Component getComponent()
{
return this;
}
}
| 1,136 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
SplitLayeredHolder.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/component/holder/SplitLayeredHolder.java | /**
* @(#)SplitLayeredHolder.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.component.holder;
import java.awt.Component;
import javax.swing.BoundedRangeModel;
import javax.swing.JLayeredPane;
import javax.swing.OverlayLayout;
import com.egantt.model.component.ComponentList;
public class SplitLayeredHolder extends JLayeredPane{
private static final long serialVersionUID = -3211706232794493344L;
protected final SplitComponentHolder holder;
public SplitLayeredHolder() {
holder = new SplitComponentHolder();
this.setLayout(new OverlayLayout(this));
this.add(holder.getComponent(), JLayeredPane.DEFAULT_LAYER);
}
// ________________________________________________________________________
public void setComponentList(ComponentList list)
{
holder.setComponentList(list);
}
public void setRangeModel(BoundedRangeModel model)
{
holder.setRangeModel(model);
}
// _________________________________________________________________________
public void setDividerLocation(double proportionalLocation) {
holder.setDividerLocation(proportionalLocation);
}
public void setDividerLocation(int location) {
holder.setDividerLocation(location);
}
public void setDividerSize(int newSize) {
holder.setDividerSize(newSize);
}
// _________________________________________________________________________
public Component getComponent()
{
return this;
}
} | 1,490 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
Hive.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/Hive.java | /*
* @(#)Hive.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util;
import ext.egantt.util.hive.HiveImpl;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
/**
* The hive is not as such a requirement to use the library, but has become
* a very useful utility class for the examples and server frameworks.
*
* The purpose of a hive is to resolve relative paths into absolute paths
* with-in user-space. The advantages that this can have is that the same
* code to access files with-in an application can be easily ported to use
* another set of paths in an application or applet.
*
* When using the E-Gantt SDK you are advised "against" using the Hive the
* alternative is true if you are extending E-Gantt Server edition.
*/
public final class Hive
{
protected static HiveImpl hiveImpl; /** implementation of the hive */
// __________________________________________________________________________
/**
* Set the hive implementation:
* note: for consistency reasons set once "it should be enough"
*/
public static void setHiveImpl(HiveImpl hiveImpl)
{
Hive.hiveImpl = hiveImpl;
}
// __________________________________________________________________________
/**
* A convenience method to generate a reader from the URL
*/
public static BufferedReader getReader(String urlFragment) throws IOException
{
URL url = getURL(urlFragment);
if (url == null)
return null;
InputStream inputStream = url.openStream();
return new BufferedReader(new InputStreamReader(inputStream));
}
/**
* A forwarder method calls HiveImpl.getURL()
*/
public static URL getURL(String urlFragment)
{
return hiveImpl != null ? hiveImpl.getURL(urlFragment) : null;
}
}
| 1,903 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicTraceImpl.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/trace/BasicTraceImpl.java | /*
* @(#)BasicTraceImpl.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.trace;
import com.egantt.util.trace.TraceImpl;
import ext.egantt.util.Hive;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.URL;
import java.util.HashMap;
import java.util.ResourceBundle;
/**
* This class should be made into Abstract Class the implementor of which should register
* itself with this class to make it the default
*/
public class BasicTraceImpl implements TraceImpl
{
private static String THIS = BasicTraceImpl.class.getName();
private static boolean TRACE = false; // value will be setup at the end of the static constructor
public static final String DELIMITER = "=";
public static final String TRACE_CONFIG = "trace.cfg";
public PrintStream out = System.out;
protected HashMap <String, Boolean> traceEnable = new HashMap<String, Boolean>();
protected ResourceBundle bundle;
public BasicTraceImpl()
{
URL url = Hive.getURL(TRACE_CONFIG);
if (url != null)
{
try
{
InputStream input = url.openStream();
BufferedReader in = new BufferedReader(new InputStreamReader(input));
for (String line = line = in.readLine(); line != null; line = in.readLine())
{
// split based on the delimiter
int i = line.indexOf(DELIMITER);
if (i <= 0)
continue;
// line is something like test.jclass=true; name becomes something like test.jclass
// value becomes true or false
String name = line.substring(0, i).trim();
String value = line.substring(i + 1).trim();
traceEnable.put(name, Boolean.valueOf(value).booleanValue() ? Boolean.TRUE : Boolean.FALSE);
}
input.close();
}
catch (IOException io)
{ // this exception is not expecting so we must trace :(
System.out.println(io);
}
}
// update the Tracing for this class based on the configuration
TRACE = getEnable(THIS);
}
//___________________________________________________________________________
public boolean getEnable(String s)
{
if (TRACE) out.println(THIS + ".getEnable() preforming lookup on key " + s);
for (int i=0; i >=0; i=s.lastIndexOf('.'))
{
Boolean value = (Boolean) traceEnable.get(s);
if (value != null)
return value.booleanValue();
// next element
s = s.substring(0, i);
}
return false;
}
public PrintStream getPrintStream()
{
return out;
}
//___________________________________________________________________________
/**
* Method has to be synchronized just in case something else could be
* writing out to the trace
*/
public synchronized void setOut(PrintStream newOut)
{
out = newOut;
}
}
| 2,860 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
HiveImpl.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/hive/HiveImpl.java | /*
* @(#)HiveImpl.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.hive;
import java.net.URL;
/**
* The HiveImpl interface is an exception ot the naming rule used by E-Gantt.
* The exception is caused because Hive itself is a static class.
*
* note: Hive is a static class for convenience reasons, HiveImpl does all
* of the work for Hive i.e. an implementation for Hive.
*/
public interface HiveImpl
{
/**
* creates an absolute URL from a relative path
*/
URL getURL(String path);
}
| 596 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
URLHive.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/hive/URLHive.java | /*
* @(#)URLHive.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.hive;
import java.net.URI;
import java.net.URL;
/**
* This class is designed for use by applets that are executing on a remote host
* because of the design of java.net.URI this will not work properly under
* windows systems that have more than one physical disk. It will use the
* default drive in this situation, there is no clean work-around
* for this. The best solution is not to be using this implementation of the
* hive for referencing local files.
*
* <p>JDK1.4.x+ is required to compile this file
*/
public class URLHive extends AbstractHive
{
/** not required for local use */
protected final String host;
/** not required for local use */
protected final int port;
/** not required for local use */
protected final String path;
/** the protocol type used not nullable*/
protected final String protocol;
/** not required for local use */
protected final String query;
/** not required for local use */
protected final String userInfo;
public URLHive(URL documentBase)
{
this.host = documentBase.getHost();
this.port = documentBase.getPort();
this.query = documentBase.getQuery();
this.protocol = documentBase.getProtocol();
this.userInfo = documentBase.getUserInfo();
String path = documentBase.getPath();
this.path = path.substring(path.indexOf("/"), path.lastIndexOf("/") + 1);
}
// _________________________________________________________________________
/**
* Does the parsing using the JDK1.4.x + java.net.URI
*/
protected URL createURL(String relativePath) throws Throwable
{
URI uri = new URI(protocol, userInfo, host, port, path + relativePath, query, null);
return uri.toURL();
}
}
| 1,952 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicHive.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/hive/BasicHive.java | /*
* @(#)BasicHive.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.hive;
import java.net.URL;
/**
* The most basic implementation just relies on the contents of the ClassPath
*/
public class BasicHive extends AbstractHive
{
protected final URL url;
public BasicHive(URL url)
{
this.url = url;
}
// _________________________________________________________________________
protected URL createURL(String relativePath) throws Throwable
{
return new URL(url, relativePath);
}
}
| 589 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AbstractHive.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/hive/AbstractHive.java | /*
* @(#)AbstractHive.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.hive;
import com.egantt.util.Trace;
import java.io.InputStream;
import java.net.URL;
/**
* The base class for all hive implementations
*/
public abstract class AbstractHive implements HiveImpl
{
// __________________________________________________________________________
public URL getURL(String fragment)
{
try
{
URL url = createURL(fragment);
if (url == null)
return null;
InputStream is = url.openStream();
if (is != null)
{
is.close();
return url;
}
}
catch (Throwable throwable)
{
throwable.printStackTrace(Trace.out);
}
return null;
}
/**
* Generates a new URL from the fragment i.e. data/test1.dat -break
* to file://C:/mydata/data/test1.dat
*/
protected abstract URL createURL(String fragment) throws Throwable;
}
| 966 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ClassHive.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/hive/ClassHive.java | /*
* @(#)ClassHive.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.hive;
import java.net.URL;
/**
* Utilises the ClassLoader, expects the contents to be contained with-in the jar
*/
public class ClassHive extends AbstractHive
{
protected final ClassLoader classLoader;
public ClassHive(ClassLoader classLoader)
{
this.classLoader = classLoader;
}
// _________________________________________________________________________
/**
* Gets the URL as a resource from with-in the jar
* <code>classLoader.getResource(relativePath);</code>
*/
protected URL createURL(String relativePath) throws Throwable
{
return classLoader.getResource(relativePath);
}
}
| 775 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
LocalHive.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/hive/LocalHive.java | /*
* @(#)LocalHive.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.hive;
import com.egantt.util.Trace;
import java.io.File;
import java.net.URL;
/**
* This is a utility class used to find the CLASSDATA directory for this project,
* from the CLASSPATH
*/
public class LocalHive extends AbstractHive
{
/**
* As this instance of the hive may or may not be initialised it is safest to
* just set this flag in the code if you need to debug what is going wrong
*/
private static final String THIS = LocalHive.class.getName();
private static final boolean TRACE = true;
/**
* this the order of precedence of the keys of which to retrieve the file
*/
protected String path;
/**
* this is the file that we are looking for by iterating through
* the ClassPath directories. This file will be located in the root
* directory relative to other important items, like images. When we
* find this file, we find the root for the project really.
*/
public LocalHive(String baseFile, String protocol)
{
this.path = protocol + "://" +getLocation(baseFile, System.getProperty("java.class.path"));
this.path = path.replace('\\', '/');
}
/**
* Construct the hive using the local file protocol
*/
public LocalHive(String baseFile)
{
this (baseFile, "file");
}
// __________________________________________________________________________
protected URL createURL(String fragment) throws Throwable
{
return new URL(path + "/" + fragment);
}
// __________________________________________________________________________
/**
* Gets a complete listing of the ClassPath. This is used to build the URL which
* will be returned by getURL
*/
protected String getLocation(String filename, String classPath)
{
for (int i=0; i >= 0;)
{
// position of the seperator character in the classpath
int j = classPath.indexOf(File.pathSeparatorChar, i);
String item = (j < 0) ? classPath.substring(i) : classPath.substring(i, j);
i = (j < 0) ? -1 : j +1;
if (TRACE) Trace.out.println(item);
// attempt to locate a file that matches the item
File f = new File(item);
if (f.isDirectory())
{
// the classpath specifies a directory, try to open the file
// CLASSDATA_INFO, relative to the directory
if (new File(f, filename).isFile())
{
if (TRACE) Trace.out.println(THIS + ".getLocation " +
"found file: " + item + "/" + filename);
return item; // File found success
}
}
}
return null; // we did not find the CLASSDATA_INFO file, give up
}
}
| 2,664 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ClassLoader.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/reflect/ClassLoader.java | /**
* @(#)ClassLoader.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.reflect;
import com.egantt.util.Trace;
import java.lang.reflect.Constructor;
/**
* A very basic ClassLoader: should be used as little as possible
*/
public class ClassLoader
{
// __________________________________________________________________________
/**
* Invoke a class that takes no parameters in it's contructor
*/
public static Object invoke(String clazzName)
{
Object value = null;
try
{
Class clazz = Class.forName(clazzName);
value = clazz != null ? clazz.newInstance() : null;
}
catch (Exception e)
{
e.printStackTrace(Trace.out);
}
return value;
}
/**
* Invoke a class that taks parameters, this code requires the parameters to
* to be in the correct order for the required constructor. For efficiency
* as well as other reasons a best match is not really suitable.
*/
public static Object invoke(String clazzName, Object params [])
{
try
{
Class clazz = Class.forName(clazzName);
Constructor constructors [] = clazz.getConstructors();
Class params2 [] = new Class [params.length];
for (int z =0; z < params.length; z++)
params2 [z] = params[z] != null ? params[z].getClass() : null;
for (int i=0; i < constructors.length; i++)
{
Class[] params1 = constructors[i].getParameterTypes();
if (params1.length != params2.length)
continue;
boolean result = true;
for (int z=0; z < params1.length && result; z++)
if (params[z] != null && !params1[z].isAssignableFrom(params2[z]))
result = false;
if (!result)
continue;
return constructors[i].newInstance(params);
}
}
catch (Exception e)
{
e.printStackTrace(Trace.out);
}
return null;
}
}
| 1,867 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ReflectionHelper.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/util/reflect/ReflectionHelper.java | /*
* @(#)ReflectionHelper.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.util.reflect;
import com.egantt.util.Trace;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ReflectionHelper
{
public static Iterator fields(Class clazz)
{
Field fields [] = clazz.getFields();
List <Object> list = new ArrayList<Object>(fields.length);
for (int i=0; i < fields.length; i++)
{
String a = null;
try
{
a = (String) fields[i].get(new Object());
}
catch (Throwable tr)
{
tr.printStackTrace(Trace.out);
}
if (a != null)
list.add(a);
}
return list.iterator();
}
// __________________________________________________________________________
public static void set(Object o, String field, Object value)
{
Method method = findMethod(o.getClass(), "set" + field);
if (method == null)
return;
Object values[] = new Object [1];
values[0] = value;
try
{
method.invoke(o, values);
}
catch (Exception ex)
{
ex.printStackTrace(Trace.out);
}
}
// __________________________________________________________________________
protected static Method findMethod(Class clazz, String method)
{
Method methods [] = clazz.getMethods();
for (int z=0; z < methods.length; z++)
{
if (!methods[z].getName().equals(method))
continue;
Class params [] = methods[z].getParameterTypes();
if (params.length == 1)
return methods[z];
}
return null;
}
}
| 1,648 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ChartModel.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/chart/ChartModel.java | package ext.egantt.chart;
import java.util.Iterator;
import com.egantt.model.drawing.axis.AxisInterval;
public interface ChartModel
{
//Iterator axises();
/**
* Returns the set of keys to query
*/
Iterator keys();
/**
* Returns the <code>AxisInterval</code> for the
* underlying key
*/
AxisInterval getInterval(Object axis, Object key);
} | 361 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ChartGenerator.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/chart/ChartGenerator.java | package ext.egantt.chart;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.DrawingPart;
public interface ChartGenerator
{
/**
* Generates a <code>DrawingContext</code> from the scheme
*/
DrawingContext getDrawingContext();
/**
* Generates a <code>DrawingPart</code> from the scheme
*/
DrawingPart getDrawingPart(ChartModel model, DrawingContext context);
} | 405 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ChartFactory.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/chart/ChartFactory.java | package ext.egantt.chart;
import javax.swing.JComponent;
/**
* <code>ChartFactory</code> Contains many utility methods for
* quickly creating stack auto-resixing charts.
*/
public interface ChartFactory
{
/**
* Generates a line chart
*/
JComponent createLineChart(String title, ChartModel model);
/**
* Generates a pie chart
*/
JComponent createPieChart(String title, ChartModel model);
JComponent createAreaChart();
JComponent createBarChart();
JComponent createGanttChart();
JComponent createXYChart();
JComponent createStackBarChart();
} | 573 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ChartFactory2D.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/chart/factory/ChartFactory2D.java | package ext.egantt.chart.factory;
import javax.swing.JComponent;
import com.egantt.awt.graphics.state.GraphicsState2D;
import com.egantt.drawing.component.DrawingComponent2D;
import com.egantt.drawing.component.painter.state.BasicStatePainter;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.DrawingState;
import com.egantt.model.drawing.state.SingletonDrawingState;
import com.egantt.swing.cell.CellState;
import com.egantt.swing.cell.state.BasicCellState;
import ext.egantt.chart.ChartFactory;
import ext.egantt.chart.ChartGenerator;
import ext.egantt.chart.ChartModel;
import ext.egantt.chart.generator.LineGenerator2D;
import ext.egantt.chart.generator.PieGenerator2D;
public class ChartFactory2D implements ChartFactory
{
public ChartFactory2D()
{
}
/**
* @see ext.egantt.chart.ChartFactory#createAresChart()
*/
public JComponent createAreaChart()
{
return null;
}
/**
* @see ext.egantt.chart.ChartFactory#createBarChart()
*/
public JComponent createBarChart()
{
return null;
}
/**
* @see ext.egantt.chart.ChartFactory#createGanttChart()
*/
public JComponent createGanttChart()
{
return null;
}
/**
* @see ext.egantt.chart.ChartFactory#createLineChart()
*/
public JComponent createLineChart(String title, ChartModel model)
{
LineGenerator2D generator = new LineGenerator2D();
return generateChart(generator, model);
}
/**
* @see ext.egantt.chart.ChartFactory#createPieChart()
*/
public JComponent createPieChart(String title, ChartModel model)
{
PieGenerator2D generator = new PieGenerator2D();
return generateChart(generator, model);
}
/**
* @see ext.egantt.chart.ChartFactory#createStackBarChart()
*/
public JComponent createStackBarChart() {
return null;
}
/**
* @see ext.egantt.chart.ChartFactory#createXYChart()
*/
public JComponent createXYChart() {
return null;
}
// ___________________________________________________________________________
protected JComponent generateChart(ChartGenerator generator, ChartModel model)
{
DrawingContext context = generator.getDrawingContext();
DrawingState state = new SingletonDrawingState(
generator.getDrawingPart(model, context));
BasicStatePainter painter = new BasicStatePainter(context);
CellState cellState = new BasicCellState(state);
DrawingComponent2D component = new DrawingComponent2D();
component.setComponentPainter(painter);
component.setGraphicsState(new GraphicsState2D());
component.setCellState(cellState);
return component;
}
} | 2,574 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicPaintScheme.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/chart/scheme/BasicPaintScheme.java | package ext.egantt.chart.scheme;
import java.awt.Color;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.painter.PainterResources;
import ext.egantt.drawing.painter.context.BasicPainterContext;
public class BasicPaintScheme extends BasicPainterContext
{
public Object get(Object key, String type)
{
if (type != PainterResources.PAINT || !(key instanceof AxisInterval))
return super.get(key, type);
AxisInterval interval = (AxisInterval) key;
int value = ((Long)interval.getFinish()).intValue() * 150;
return new Color(value);
}
} | 585 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
PieGenerator2D.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/chart/generator/PieGenerator2D.java | package ext.egantt.chart.generator;
import java.awt.Color;
import java.awt.geom.Arc2D;
import java.util.Iterator;
import com.egantt.drawing.component.painter.part.BasicPartPainter;
import com.egantt.drawing.painter.filled.FilledArcPainter;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.DrawingPart;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.axis.AxisView;
import com.egantt.model.drawing.axis.LongAxis;
import com.egantt.model.drawing.axis.interval.LongInterval;
import com.egantt.model.drawing.context.BasicDrawingContext;
import com.egantt.model.drawing.painter.PainterResources;
import com.egantt.model.drawing.painter.state.BasicPainterState;
import com.egantt.model.drawing.part.ListDrawingPart;
import ext.egantt.chart.ChartGenerator;
import ext.egantt.chart.ChartModel;
import ext.egantt.chart.scheme.BasicPaintScheme;
import ext.egantt.drawing.painter.context.BasicPainterContext;
public class PieGenerator2D implements ChartGenerator
{
protected BasicDrawingContext context;
public PieGenerator2D()
{
}
/**
* @see ext.egantt.chart.ChartGenerator#getDrawingContext()
*/
public DrawingContext getDrawingContext()
{
BasicDrawingContext context = new BasicDrawingContext();
context.put("painter", ContextResources.DRAWING_PAINTER, new FilledArcPainter(Arc2D.PIE));
// context.put("painter", ContextResources.DRAWING_PAINTER, new BasicArcPainter(Arc2D.PIE));
BasicPainterContext painterContext = new BasicPaintScheme();
context.put("context", ContextResources.GRAPHICS_CONTEXT, painterContext);
painterContext = new BasicPainterContext();
painterContext.put(PainterResources.PAINT, Color.black);
context.put("context", ContextResources.GRAPHICS_CONTEXT, painterContext);
BasicPartPainter partPainter = new BasicPartPainter();
context.put("painter", ContextResources.PART_PAINTER, partPainter);
context.put("state", ContextResources.PAINTER_STATE, new BasicPainterState());
return context;
}
/**
* @see ext.egantt.chart.ChartGenerator#getDrawingPart()
*/
public DrawingPart getDrawingPart(ChartModel model, DrawingContext context)
{
Object keys[] = new String[2];
keys[0] = "xAxis";
keys[1] = "yAxis";
LongAxis axis = new LongAxis();
axis.setInterval(new LongInterval(0, 100));
context.put(keys[0], ContextResources.AXIS_VIEW, AxisView.HORIZONTAL);
axis = new LongAxis();
axis.setInterval(new LongInterval(0, 100));
context.put(keys[1], ContextResources.AXIS_VIEW, AxisView.VERTICAL);
ListDrawingPart part = new ListDrawingPart(keys, "painter");
AxisInterval intervals [] = new AxisInterval[2];
intervals[0] = new LongInterval(10, 90);
intervals[1] = new LongInterval(10, 90);
for (Iterator iter = model.keys(); iter.hasNext();)
part.add(model.getInterval(null, iter.next()), intervals, "painter", "state", "context");
return part;
}
} | 2,971 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
LineGenerator2D.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/chart/generator/LineGenerator2D.java | package ext.egantt.chart.generator;
import java.awt.Color;
import com.egantt.drawing.component.painter.part.BasicPartPainter;
import com.egantt.drawing.painter.generator.PathGeneratorPainter;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingContext;
import com.egantt.model.drawing.DrawingPart;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.axis.AxisView;
import com.egantt.model.drawing.axis.LongAxis;
import com.egantt.model.drawing.axis.interval.LongInterval;
import com.egantt.model.drawing.context.BasicDrawingContext;
import com.egantt.model.drawing.painter.PainterResources;
import com.egantt.model.drawing.painter.state.BasicPainterState;
import com.egantt.model.drawing.part.ListDrawingPart;
import ext.egantt.chart.ChartGenerator;
import ext.egantt.chart.ChartModel;
import ext.egantt.chart.scheme.BasicPaintScheme;
import ext.egantt.drawing.painter.context.BasicPainterContext;
public class LineGenerator2D implements ChartGenerator
{
protected BasicDrawingContext context;
/**
* @see ext.egantt.chart.ChartGenerator#getDrawingContext()
*/
public DrawingContext getDrawingContext()
{
BasicDrawingContext context = new BasicDrawingContext();
context.put("painter", ContextResources.DRAWING_PAINTER, new PathGeneratorPainter(1, 100));
//context.put("painter", ContextResources.DRAWING_PAINTER, new BasicShapePainter());
BasicPainterContext painterContext = new BasicPaintScheme();
context.put("context", ContextResources.GRAPHICS_CONTEXT, painterContext);
painterContext = new BasicPainterContext();
painterContext.put(PainterResources.PAINT, Color.black);
context.put("context", ContextResources.GRAPHICS_CONTEXT, painterContext);
BasicPartPainter partPainter = new BasicPartPainter();
context.put("painter", ContextResources.PART_PAINTER, partPainter);
context.put("state", ContextResources.PAINTER_STATE, new BasicPainterState());
return context;
}
/**
* @see ext.egantt.chart.ChartGenerator#getDrawingPart()
*/
public DrawingPart getDrawingPart(ChartModel model, DrawingContext context)
{
Object keys[] = new String[2];
keys[0] = "xAxis";
keys[1] = "yAxis";
LongAxis axis = new LongAxis();
axis.setInterval(new LongInterval(0, 100));
context.put(keys[0], ContextResources.AXIS_VIEW, axis.getView(AxisView.HORIZONTAL));
axis = new LongAxis();
axis.setInterval(new LongInterval(0, 100));
context.put(keys[1], ContextResources.AXIS_VIEW, axis.getView(AxisView.VERTICAL));
ListDrawingPart part = new ListDrawingPart(keys, "painter");
AxisInterval intervals [] = new AxisInterval[2];
intervals[0] = new LongInterval(10, 90);
intervals[1] = new LongInterval(10, 90);
Object values [] = new Object [10000];
for (int i=0; i < 9999; i = i +2)
{
values[i] = new Long( (long) i);
values[i+1] = new Long( (long) i * 5);
}
values[10] = new Long(999);
part.add(values, intervals, "painter", "state", "context");
return part;
}
} | 3,026 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicPieModel.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/chart/model/BasicPieModel.java | package ext.egantt.chart.model;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.axis.interval.DoubleInterval;
import com.egantt.model.drawing.axis.interval.LongInterval;
import ext.egantt.chart.ChartModel;
/**
* In the pie chart implementation values must be in the range [0..360] inclusive
*/
public class BasicPieModel implements ChartModel
{
protected Map <Object, AxisInterval> map = new HashMap<Object, AxisInterval>();
// ------------------------------------------------------------------------
public Iterator keys()
{
return map.keySet().iterator();
}
public AxisInterval getInterval(Object axis, Object key)
{
return (AxisInterval) map.get(key);
}
// ------------------------------------------------------------------------
public Object put(Object key, long offset)
{
long start = 0;
for (Iterator iter = map.values().iterator(); iter.hasNext();)
{
Number finish = (Number) ((AxisInterval) iter.next()).getFinish();
start = Math.max(start, finish.longValue());
}
return put(key, new LongInterval(start, start + offset));
}
public Object put(Object key, double offset)
{
double start = 0;
for (Iterator iter = map.values().iterator(); iter.hasNext();)
{
Number finish = (Number) ((AxisInterval) iter.next()).getFinish();
start = Math.max(start, finish.doubleValue());
}
return put(key, new DoubleInterval(start, start + offset));
}
// ------------------------------------------------------------------------
public Object put(Object key, AxisInterval interval)
{
return map.put(key, interval);
}
} | 1,700 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ComponentUtilities.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/model/drawing/ComponentUtilities.java | /*
* @(#)ComponentUtilities.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.model.drawing;
import com.egantt.swing.scroll.ScrollManager;
import com.egantt.model.component.ComponentManager;
/**
* A holder for a ComponentManager
*/
public interface ComponentUtilities
{
/**
* Returns a ComponentManager
*/
ComponentManager getManager();
ScrollManager getScrollManager(int index);
}
| 484 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicDrawingState.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/model/drawing/state/BasicDrawingState.java | package ext.egantt.model.drawing.state;
/**
* Created with IntelliJ IDEA.
* User: XTender
* Date: 01.11.13
* Time: 2:22
* To change this template use File | Settings | File Templates.
*/
public class BasicDrawingState extends com.egantt.model.drawing.state.BasicDrawingState
{
private String textValue;
public synchronized void setTextValue(String textValue)
{
this.textValue = textValue;
}
@Override
public String toString()
{
return this.textValue;
}
}
| 520 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
CachedCalendarGranularity.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/model/drawing/granularity/CachedCalendarGranularity.java | /*
* @(#)CachedCalendarGranularity.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.model.drawing.granularity;
import com.egantt.model.drawing.DrawingGranularity;
import com.egantt.model.drawing.DrawingTransform;
import ext.egantt.model.drawing.granularity.iterator.CalendarIterator;
import com.egantt.model.drawing.granularity.iterator.ArrayIterator;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
public class CachedCalendarGranularity implements DrawingGranularity
{
protected Object granularities [];
protected boolean round;
protected int step;
public CachedCalendarGranularity(int step, Object granularities[])
{
this (step, true, granularities);
}
protected CachedCalendarGranularity(int step, boolean round, Object granularities[])
{
this.round = round;
this.step = step;
this.granularities = granularities;
}
//___________________________________________________________________________
public long width(Object granularity, DrawingTransform transform, long width)
{
long startTime = ((Long) transform.inverseTransform(0, width)).longValue();
int field = ((Integer) granularity).intValue();
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(startTime));
calendar.add(field, step);
long resultPixelsFromZero = transform.transform(new Long(calendar.getTime().getTime()), width);
calendar.setTime(new Date(startTime));
for (int i=field + 1; i < 14; i++)
calendar.clear(i);
long resultDeadPixels = transform.transform(new Long(calendar.getTime().getTime()), width);
return resultPixelsFromZero - resultDeadPixels;
}
//___________________________________________________________________________
public Iterator keys()
{
return new ArrayIterator(granularities, 1); // one element at a time
}
public Iterator values(Object granularity, DrawingTransform transform, long width)
{
return new CalendarIterator(transform, ((Integer) granularity).intValue(), step, width, round);
}
}
| 2,101 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicCalendarGranularity.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/model/drawing/granularity/BasicCalendarGranularity.java | /*
* @(#)BasicCalendarGranularity.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.model.drawing.granularity;
import com.egantt.model.drawing.DrawingGranularity;
import com.egantt.model.drawing.DrawingTransform;
import ext.egantt.model.drawing.granularity.iterator.CalendarIterator;
import com.egantt.model.drawing.granularity.iterator.ArrayIterator;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
public class BasicCalendarGranularity implements DrawingGranularity
{
protected final Object granularities[];
protected final boolean round;
protected final int step;
public BasicCalendarGranularity(int step, Object granularities[])
{
this (step, true, granularities);
}
protected BasicCalendarGranularity(int step, boolean round, Object granularities[])
{
this.granularities = granularities;
this.round = round;
this.step = step;
}
//___________________________________________________________________________
public long width(Object granularity, DrawingTransform transform, long width)
{
long start = ((Long) transform.inverseTransform(0, width)).longValue();
Calendar cal = Calendar.getInstance();
cal.setTime( new Date(start) );
cal.add(((Integer) granularity).intValue(), step);
return transform.transform(new Long(cal.getTime().getTime()), width);
}
//___________________________________________________________________________
public Iterator keys()
{
return new ArrayIterator(granularities, 1); // one element at a time
}
public Iterator values(Object granularity, DrawingTransform transform, long width)
{
return new CalendarIterator(transform, ((Integer) granularity).intValue(), step, width, round);
}
}
| 1,789 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
CalendarConstants.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/model/drawing/granularity/CalendarConstants.java | /*
* @(#)CalendarConstants.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.model.drawing.granularity;
import java.util.Calendar;
/**
* Easy to use constants for the Calendar based granularities
*/
public interface CalendarConstants
{
Object FORMAT_KEYS [] = new Object []
{
new Integer(Calendar.YEAR),
new Integer(Calendar.MONTH),
new Integer(Calendar.DAY_OF_MONTH),
new Integer(Calendar.HOUR),
new Integer(Calendar.MINUTE),
new Integer(Calendar.SECOND),
new Integer(Calendar.MILLISECOND)
};
}
| 607 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
CalendarIterator.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/model/drawing/granularity/iterator/CalendarIterator.java | /*
* @(#)CalendarIterator.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.model.drawing.granularity.iterator;
import com.egantt.model.drawing.DrawingTransform;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
public class CalendarIterator implements Iterator
{
protected Calendar position = Calendar.getInstance();
protected DrawingTransform transform;
protected boolean returnValue = true;
protected int field;
protected int step;
protected long finish;
/** field is Calendar.field */
public CalendarIterator(DrawingTransform transform, int field, int step,
long width, boolean needsRounding)
{
this.field = field;
this.step = step;
this.transform = transform;
// calculate the start & finish of the interval from the transform
long start = ((Long) transform.inverseTransform(0, width)).longValue();
this.finish = ((Long) transform.inverseTransform(width, width)).longValue();
// update the position
// position.setTimeInMillis(start); // 1.4.x SDK Only
position.setTime(new Date(start)); // 1.3.x SDK+
// performing rounding is the norm so that a month starts at a month not where the interval starts
if (needsRounding)
for (int i=field + 1; i < 14; i++)
position.clear(i);
}
// __________________________________________________________________________
public boolean hasNext()
{
return returnValue;
}
public Object next()
{
// long value = position.getTimeInMillis(); // 1.4.x SDK Only
long value = position.getTime().getTime(); // 1.3.x SDK+
this.returnValue = value < finish;
position.add(field, step); // next element
return new Long(value);
}
// __________________________________________________________________________
public void remove()
{
}
}
| 1,864 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ColumnUtilities.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/ext/egantt/model/table/ColumnUtilities.java | /*
* @(#)ColumnUtilities.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package ext.egantt.model.table;
import com.egantt.swing.table.model.column.ColumnManager;
/**
* Brought into effect to provide a seperation of data, for the different
* charting types that E-Gantt utilises.
*/
public interface ColumnUtilities
{
/**
* Returns a ColumnManager
*/
ColumnManager getColumnManager();
}
| 471 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
Filter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/data/Filter.java | /*
* @(#)Filter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.data;
/**
* A Filter provides the mechanism to wade through a list of objects with ease
*/
public interface Filter
{
boolean include(Object o);
}
| 304 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
Navigator.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/data/Navigator.java | /*
* @(#)Navigator.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.data;
/**
* A Navigator is a way to work through a list of objects:
* it works by storing a current position and will move through the list
* based on the position that you give it
*/
public interface Navigator
{
/**
* Returns the value at the current element
*/
Object current();
/**
* Moves the cursor forward +1 to the next element and returns it's value
*/
Object next();
/**
* Moves the cursor back -1 to the previous element and returns it's value
*/
Object previous();
// _________________________________________________________________________
/**
* Moves to the first element in the list
*/
Object first();
/**
* Moves to the last element in the list
*/
Object last();
}
| 891 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
CrimsonTreeNavigator.javax | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/data/navigator/CrimsonTreeNavigator.javax | /*
* @(#)CrimsonTreeNavigator.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.data.navigator;
import com.egantt.data.Navigator;
import org.apache.crimson.tree.TreeWalker;
import org.w3c.dom.Node;
public class CrimsonTreeNavigator implements Navigator
{
protected final TreeWalker walker;
protected Object previous;
public CrimsonTreeNavigator(TreeWalker walker)
{
this.walker = walker;
}
// _________________________________________________________________________
public Object current()
{
return walker.getCurrent();
}
// _________________________________________________________________________
public Object first()
{
walker.reset();
this.previous = null;
return walker.getCurrent();
}
public Object last()
{
while (walker.getNext() != null)
{
previous = walker.getCurrent();
}
return walker.getCurrent();
}
// _________________________________________________________________________
public Object previous()
{
if (previous == null)
return null;
walker.reset();
for (Node node = walker.getCurrent(); node != previous; node = walker.getNext())
continue;
return previous;
}
public Object next()
{
Object previous = walker.getCurrent();
if (previous == null)
return null;
this.previous = previous;
return walker.getNext();
}
}
| 1,403 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicFilteredNavigator.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/data/navigator/BasicFilteredNavigator.java | /*
* @(#)BasicFilteredNavigator.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.data.navigator;
import com.egantt.data.Filter;
import com.egantt.data.Navigator;
public class BasicFilteredNavigator implements Navigator
{
protected final Navigator navigator;
protected Filter filter;
public BasicFilteredNavigator(Navigator navigator)
{
this.navigator = navigator;
}
// _________________________________________________________________________
public void setFilter(Filter filter)
{
this.filter = filter;
}
// _________________________________________________________________________
public Object current()
{
Object current = navigator.current();
return filter.include(current) ? current : next();
}
// _________________________________________________________________________
public Object first()
{
Object first = navigator.first();
return filter.include(first) ? first : next();
}
public Object last()
{
Object last = navigator.last();
return filter.include(last) ? last : previous();
}
// _________________________________________________________________________
public Object next()
{
Object next = navigator.next();
while (next != null && !(filter.include(next)))
next = navigator.next();
return next;
}
public Object previous()
{
Object prev = navigator.next();
while (prev != null && !(filter.include(prev)))
prev = navigator.next();
return prev;
}
}
| 1,521 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicListFilter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/data/filter/basic/BasicListFilter.java | /*
* @(#)BasicListFilter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.data.filter.basic;
import com.egantt.data.Filter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class BasicListFilter implements Filter
{
protected final boolean requireAll;
protected List <Filter>filters = new ArrayList<Filter>(5);
public BasicListFilter(boolean requireAll)
{
this.requireAll = requireAll;
}
// _________________________________________________________________________
public void add(Filter filter)
{
filters.add(filter);
}
public void remove(Filter filter)
{
filters.remove(filter);
}
// _________________________________________________________________________
public boolean include(Object o)
{
for (Iterator iter = filters.iterator(); iter.hasNext();)
if (!((Filter) iter.next()).include(o))
return !requireAll;
return requireAll;
}
}
| 1,002 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
EmptyElementFilter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/data/filter/dom/EmptyElementFilter.java | /*
* @(#)EmptyElementFilter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.data.filter.dom;
import com.egantt.data.Filter;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class EmptyElementFilter implements Filter
{
// _________________________________________________________________________
public boolean include(Object o)
{
Node node = (Node) o;
if (!(node instanceof Element))
return false;
return node.getAttributes().getLength() > 0;
}
}
| 565 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicElementFilter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/data/filter/dom/BasicElementFilter.java | /*
* @(#)BasicElementFilter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.data.filter.dom;
import com.egantt.data.Filter;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class BasicElementFilter implements Filter
{
protected final String key;
protected final String value;
public BasicElementFilter(String key, String value)
{
this.key = key;
this.value = value;
}
// _________________________________________________________________________
public boolean include(Object o)
{
Node node = (Node) o;
if (!(node instanceof Element))
return false;
if (!(node.getParentNode() instanceof Element))
return true;
Element element = (Element) node.getParentNode();
if (element.getAttributes().getLength() == 0)
return true;
String value = element.getAttribute(key);
return value.equals(this.value)&& include(element);
}
}
| 962 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
HorizontalGradientPaint.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/paint/HorizontalGradientPaint.java | package com.egantt.awt.paint;
import java.awt.Color;
import java.awt.PaintContext;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;
public class HorizontalGradientPaint extends AbstractGradientPaint
{
public HorizontalGradientPaint(Color color1, Color color2)
{
super (color1, color2);
}
// _________________________________________________________________________
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)
{
Rectangle bounds = userBounds instanceof Rectangle
? (Rectangle) userBounds : userBounds.getBounds();
// create the paint object
java.awt.GradientPaint gp = new java.awt.GradientPaint(bounds.x, bounds.y,
color1, bounds.x + bounds.width, bounds.y, color2, cyclic);
return gp.createContext(cm, deviceBounds, userBounds, xform, hints);
}
}
| 1,002 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
VerticalGradientPaint.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/paint/VerticalGradientPaint.java | package com.egantt.awt.paint;
import java.awt.Color;
import java.awt.PaintContext;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.image.ColorModel;
public class VerticalGradientPaint extends AbstractGradientPaint
{
public VerticalGradientPaint(Color color1, Color color2)
{
super (color1, color2);
}
// _________________________________________________________________________
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)
{
Rectangle bounds = userBounds instanceof Rectangle
? (Rectangle) userBounds : userBounds.getBounds();
// create the paint object
java.awt.GradientPaint gp = new java.awt.GradientPaint(bounds.x, bounds.y,
color1, bounds.x, bounds.y + bounds.height, color2, cyclic);
return gp.createContext(cm, deviceBounds, userBounds, xform, hints);
}
}
| 999 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AbstractGradientPaint.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/paint/AbstractGradientPaint.java | /*
* @(#)AbstractGradientPaint.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.paint;
import com.egantt.drawing.DrawingPaint;
import java.awt.Color;
public abstract class AbstractGradientPaint implements DrawingPaint
{
protected final Color color1;
protected final Color color2;
protected boolean cyclic;
public AbstractGradientPaint(Color color1, Color color2)
{
this.color1 = color1;
this.color2 = color2;
}
// _________________________________________________________________________
public void setCyclic(boolean cyclic)
{
this.cyclic = cyclic;
}
// __________________________________________________________________________
/**
* Returns the transparency mode for this <code>GradientPaint</code>.
* @return an integer value representing this <code>GradientPaint</code>
* object's transparency mode.
* @see Transparency
*/
public int getTransparency()
{
return (((color1.getAlpha() & color2.getAlpha()) == 0xff) ? OPAQUE : TRANSLUCENT);
}
}
| 1,104 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ImageEncoder.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/image/ImageEncoder.java | package com.egantt.awt.image;
import java.awt.image.BufferedImage;
/**
*
*/
public interface ImageEncoder
{
/**
* Returns the MimeType generated by the encoder
*/
String getType();
// __________________________________________________________________________
/**
* Encodes the image and returns the byte array, returns an empty array on finish
* the java.awt.Image interface does not provide enough information to the encoder
* therefore we pass a BufferedImage and use a subset of it's functionality
*/
byte[] encode(BufferedImage image);
}
| 570 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GraphicsState.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/GraphicsState.java | /*
* @(#)GraphicsState.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics;
import java.awt.Graphics;
public interface GraphicsState
{
// __________________________________________________________________________
/**
* Initialise the state, this should be always a general implementation will
* clear the existing state.
*/
void initialise(Graphics g);
/**
* Terminates the state, a general implementation will write back the contents
* of the buffer back to the GraphicsDevice
*/
void terminate(Graphics g);
// __________________________________________________________________________
/**
* Creates a new Graphics
*/
Graphics create(int x, int y, int w , int h);
}
| 796 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GraphicsResources.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/GraphicsResources.java | /*
* @(#)GraphicsResources.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics;
public interface GraphicsResources
{
/**
* @see java.awt.Composite
*/
String COMPOSITE = "Composite";
/**
* @see java.awt.Font
*/
String FONT = "Font";
/**
* @see java.awt.geom.AffineTransform
*/
String TRANSFORM = "Transform";
/**
* @see java.awt.Paint
*/
String PAINT = "Paint";
/**
* @see java.awt.Stroke
*/
String STROKE = "Stroke";
// ________________________________________________________________________
}
| 651 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GraphicsContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/GraphicsContext.java | /*
* @(#)GraphicsContext.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics;
public interface GraphicsContext
{
/**
* Returns a value which provides easy access for user based objects
*/
Object get(Object key, Object type);
}
| 332 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GraphicsManager.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/GraphicsManager.java | /*
* @(#)GraphicsManager.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics;
import com.egantt.awt.graphics.GraphicsContext;
import java.awt.Graphics;
/**
* <code>DrawingGraphics</code> is used to convert the <code>Proxy</code>,
* <code>Transform</code> and Intervals into a <code>Graphics</code> object
*/
public interface GraphicsManager
{
Graphics create(Object key, Graphics g, GraphicsContext context);
}
| 520 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
CompoundContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/context/CompoundContext.java | /*
* @(#)CompoundContext.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.context;
import com.egantt.awt.graphics.GraphicsContext;
public interface CompoundContext extends GraphicsContext
{
/**
* Returns a Map which provides easy access for user based objects
*/
Object get(Object key, Object group, Object name);
}
| 426 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicGraphicsContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/context/BasicGraphicsContext.java | /*
* @(#)BasicGraphicsContext.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.context;
import com.egantt.awt.graphics.GraphicsContext;
import java.util.HashMap;
import java.util.Map;
/**
* A very simple implementation a trivial map
*/
public class BasicGraphicsContext implements GraphicsContext
{
protected static final String DEFAULT_GROUP = "defaultGroup";
protected Map <Object, Object>attributes = new HashMap<Object, Object>();
//___________________________________________________________________________
public Object get(Object key, Object type)
{
return this.attributes.get(type);
}
public boolean put(Object type, Object value)
{
this.attributes.put(type, value);
return true;
}
}
| 820 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicCompoundContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/context/compound/BasicCompoundContext.java | /*
* @(#)BasicCompoundContext.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.context.compound;
import com.egantt.awt.graphics.context.CompoundContext;
import java.util.HashMap;
import java.util.Map;
/**
* A very simple implementation a trivial map
*/
public class BasicCompoundContext implements CompoundContext
{
protected static final String DEFAULT_GROUP = "defaultGroup";
protected final Map <Object, Map <String, Object>> attributes = new HashMap<Object, Map <String, Object>>();
//___________________________________________________________________________
public boolean put(String type, Object group, Object value)
{
Map<String, Object> attrib = this.attributes.get(group);
if (attrib == null)
{
attrib = new HashMap<String, Object>();
this.attributes.put(group, attrib);
}
attrib.put(type, value);
return true;
}
public boolean put(String type, Object value)
{
return put(type, DEFAULT_GROUP, value);
}
// __________________________________________________________________________
public Object get(Object key, Object type, Object group)
{
Map attrib = (Map) attributes.get(group);
if (attrib == null)
return group != DEFAULT_GROUP ? get(key, type, DEFAULT_GROUP) : null;
Object result = attrib.get(type);
return result != null || group == DEFAULT_GROUP
? result : get(key, type, DEFAULT_GROUP);
}
public Object get(Object key, Object type)
{
return get(key, type, DEFAULT_GROUP);
}
}
| 1,570 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
SubCompoundContext.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/context/compound/SubCompoundContext.java | /*
* @(#)SubCompoundContext.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.context.compound;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.graphics.context.CompoundContext;
public class SubCompoundContext implements GraphicsContext
{
protected final CompoundContext context;
protected final Object group;
public SubCompoundContext(Object group, CompoundContext context)
{
this.context = context;
this.group = group;
}
// __________________________________________________________________________
public Object get(Object key, Object type)
{
return context.get(key, type, group);
}
public Object get(Object key, Object type, Object group)
{
return context.get(key, type, group);
}
}
| 838 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AbstractGraphicsState.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/state/AbstractGraphicsState.java | /*
* @(#)AbstractGraphicsState.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.state;
import com.egantt.awt.graphics.GraphicsState;
import com.egantt.util.Trace;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.WritableRaster;
import java.util.Hashtable;
public abstract class AbstractGraphicsState implements GraphicsState
{
private static final String THIS = GraphicsState2D.class.getName();
private static final boolean TRACE = Trace.getEnable(THIS);
protected final Hashtable hashtable = new Hashtable();
/**
* Calculated from the buffered-image
*/
protected transient WritableRaster raster;
protected BufferedImage image;
protected Rectangle clip;
// __________________________________________________________________________
public Graphics create(int x, int y, int w, int h)
{
BufferedImage image = (BufferedImage) createImage(x, y, w, h);
if (image == null)
return null;
Graphics g = image.createGraphics();
g.translate(x > 0 ? 0 : x, y > 0 ? 0 : y);
g.setClip(0, 0, w, h);
return g;
}
protected Image createImage(int x, int y, int w, int h)
{
WritableRaster raster = createRaster(x, y, w, h);
if (raster == null)
return null;
ColorModel model = image.getColorModel();
return raster != null
? new BufferedImage(model, raster, model.isAlphaPremultiplied(), hashtable) : null;
}
/**
* Creates a sub-raster of the master image if it is apropriate otherwise
* it will have to create a brand-new raster image.
*/
protected WritableRaster createRaster(int x, int y, int w, int h)
{
// should not be passed in null graphics
if (w < 1 || h < 1)
return null;
// should not be passed in elements outside of the raser
if (x >= clip.x + clip.width || y >= clip.y + clip.height)
return null;
// calculate where to generate the raster
int xPos = x < 0 ? clip.x : x;
int yPos = y < 0 ? clip.y : y;
int width = x < 0 ? x + w : w;
width = Math.min(width, clip.width -xPos);
int height = y < 0 ? y + h : h;
height = Math.min(height, clip.height -yPos);
if (height < 1 || width < 1)
return null;
if (TRACE)
{
System.out.println("x="+x+"y="+y+"w="+w+"h="+h);
System.out.println("xpos=" +xPos + " yPos=" +yPos + "width=" +width + "height=" + height);
System.out.println(clip.toString());
System.out.println();
}
return (WritableRaster) raster.createChild(xPos, yPos, width, height, 0, 0, null);
}
}
| 2,643 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
GraphicsState2D.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/state/GraphicsState2D.java | /*
* @(#)GraphicsState2D.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.state;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
public class GraphicsState2D extends AbstractGraphicsState
{
protected final int imageType = BufferedImage.TYPE_INT_ARGB;
// __________________________________________________________________________
public void initialise(Graphics g)
{
Rectangle bounds = g.getClipBounds();
this.clip = new Rectangle(bounds.width + bounds.x, bounds.height + bounds.y);
this.image = new BufferedImage(Math.max(clip.width,1), Math.max(clip.height,1), imageType);
this.raster = image.getWritableTile(0, 0);
}
public void terminate(Graphics g)
{
g.drawImage(image, clip.x, clip.y, clip.width, clip.height, null);
this.image = null;
}
}
| 913 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ReflectionGraphicsManager.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/manager/ReflectionGraphicsManager.java | /*
* @(#)ReflectionGraphicsManager.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.manager;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.graphics.GraphicsResources;
import ext.egantt.util.reflect.ReflectionHelper;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.Iterator;
/**
* Should avoid using this one, as the disadvantages are it's quite slow
* and it will break under applets because reflection is not allowed
*/
public class ReflectionGraphicsManager extends AbstractGraphicsManager
{
// __________________________________________________________________________
public Graphics create(Object key, Graphics g, GraphicsContext context)
{
Graphics2D g2d = (Graphics2D) g;
for (Iterator iter = ReflectionHelper.fields(GraphicsResources.class); iter.hasNext();)
{
String field = (String) iter.next();
Object value = context.get(key, field);
if (value != null)
ReflectionHelper.set(g2d, field, value);
}
return g;
}
}
| 1,109 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AbstractGraphicsManager.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/manager/AbstractGraphicsManager.java | /*
* @(#)AbstractGraphicsManager.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.manager;
import com.egantt.awt.graphics.GraphicsManager;
import com.egantt.model.drawing.DrawingTransform;
import com.egantt.model.drawing.axis.AxisInterval;
import java.awt.Component;
import java.awt.Rectangle;
/**
* Useful for generating Graphics2D's
*/
public abstract class AbstractGraphicsManager implements GraphicsManager
{
// _________________________________________________________________________
public Rectangle create(Component c, AxisInterval intervals [],
DrawingTransform transforms[])
{
int points[] = new int [2];
points[0]= c.getWidth();
points[1]= c.getHeight();
int r[] = new int [points.length * 2];
for (int i=0; i < points.length; i++)
{
r[i *2] = transforms[i].transform(intervals[i].getStart(), points[i]);
r[i *2+1] = transforms[i].transform(intervals[i].getFinish(), points[i]);
}
int width = r[1] - r[0];
int height = r[3] - r[2];
return width > 0 && height > 0 ? new Rectangle(r[0], r[2], width, height) : null;
}
}
| 1,174 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicGraphicsManager.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/awt/graphics/manager/BasicGraphicsManager.java | /*
* @(#)BasicGraphicsManager.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.awt.graphics.manager;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.graphics.GraphicsResources;
import java.awt.Composite;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Stroke;
import java.awt.geom.AffineTransform;
/**
* This is used for applets instead of the other mechanism as applets can
* and must not use reflection on components that potentially have methods
* in the sun.* packages unfortunatly this applies to graphics
*/
public class BasicGraphicsManager extends AbstractGraphicsManager
{
public Graphics create(Object key, Graphics g, GraphicsContext context)
{
Graphics2D g2d = (Graphics2D) g;
AffineTransform transform = (AffineTransform) context.get(key, GraphicsResources.TRANSFORM);
if (transform != null)
g2d.setTransform(transform);
Composite composite = (Composite) context.get(key, GraphicsResources.COMPOSITE);
if (composite != null)
g2d.setComposite(composite);
Font font = (Font) context.get(key, GraphicsResources.FONT);
if (font != null)
g2d.setFont(font);
Paint paint = (Paint) context.get(key, GraphicsResources.PAINT);
if (paint != null)
g2d.setPaint(paint);
Stroke stroke = (Stroke) context.get(key, GraphicsResources.STROKE);
if (stroke != null)
g2d.setStroke(stroke);
return g;
}
}
| 1,537 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DrawingPaint.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/DrawingPaint.java | /*
* @(#)DrawingPaint.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing;
import java.awt.Paint;
/**
* It is very unlikey that you will need to use this interface directly
* it is just a wrapper around awt paint, to make the code more readable
*/
public interface DrawingPaint extends Paint
{
}
| 394 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DrawingPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/DrawingPainter.java | /*
* @(#)DrawingPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
public interface DrawingPainter
{
/**
* Paints to the Graphics device
*/
Shape paint(Object key, Graphics g, Rectangle bounds, PainterState state, GraphicsContext context);
/**
* @@deprecated calculates the width: it's to expensive
*/
long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context);
}
| 688 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DrawingComponent.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/DrawingComponent.java | /*
* @(#)DrawingComponent.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing;
import com.egantt.drawing.component.DrawingComponentPainter;
import com.egantt.swing.cell.CellState;
import com.egantt.awt.graphics.GraphicsState;
public interface DrawingComponent
{
/**
* Sets the content for painting
*/
void setComponentPainter(DrawingComponentPainter plotter);
/**
* Sets the virtual device, which is used for painting
*/
void setGraphicsState(GraphicsState state);
void setCellState(CellState cellState);
}
| 618 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
ViewManager.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/view/ViewManager.java | /*
* @(#)ViewManager.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.view;
import com.egantt.model.drawing.DrawingAxis;
import com.egantt.model.drawing.axis.AxisView;
public interface ViewManager
{
/**
* returns the DrawingAxis for this view
*/
DrawingAxis getAxis();
/**
* returns the AxisView
*/
AxisView getView();
// __________________________________________________________________________
/**
* Sets the start
*/
boolean setStart(Object start);
/**
* Sets the finish
*/
boolean setFinish(Object finish);
// __________________________________________________________________________
/**
* Translating may temporarily affect the mid-point therefore you may specify
* if this is acceptable.
*/
boolean translate(int x, boolean force);
}
| 893 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
DoubleViewManager.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/view/manager/DoubleViewManager.java | /*
* @(#)DoubleViewManager.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.view.manager;
import com.egantt.drawing.view.ViewManager;
import com.egantt.model.drawing.DrawingAxis;
import com.egantt.model.drawing.axis.AxisView;
import com.egantt.model.drawing.axis.interval.DoubleInterval;
public class DoubleViewManager implements ViewManager
{
protected AxisView view;
protected double center = Double.MAX_VALUE; /** treat MAX_VALUE as null */
// __________________________________________________________________________
public void setView(AxisView view)
{
this.view = view;
}
// __________________________________________________________________________
public DrawingAxis getAxis()
{
return view.getAxis();
}
public AxisView getView()
{
return view;
}
// __________________________________________________________________________
public boolean setStart(Object start)
{
DoubleInterval visible = (DoubleInterval) view.getInterval();
double startValue = ((Double) start).doubleValue();
double range = ((Double) visible.getRange()).doubleValue();
// update the mid point
this.center = startValue + (range / 2);
return view.setVisible(new DoubleInterval(startValue, startValue + range));
}
public boolean setFinish(Object finish)
{
DoubleInterval visible = (DoubleInterval) view.getInterval();
double finishValue = visible.getFinishValue();
double range = ((Double) visible.getRange()).doubleValue() / 2;
// update the mid point
this.center = range / 2;
return view.setVisible(new DoubleInterval(finishValue - range, finishValue));
}
// __________________________________________________________________________
public boolean translate(int x, boolean force)
{
DoubleInterval visible = (DoubleInterval) view.getInterval();
double range = visible.getRangeValue() /2;
this.center = (center == Double.MAX_VALUE)
? range + visible.getStartValue(): this.center;
double offset = (range / 50) * x;
double startValue = center - range - offset;
double finishValue = center + range + offset;
if (force)
{
DoubleInterval interval = (DoubleInterval) getAxis().getInterval();
double s = interval.getStartValue();
double f = interval.getFinishValue();
finishValue += (s > startValue) ? s - startValue : 0;
startValue -= (finishValue > f) ? finishValue -f : 0;
startValue = Math.max(startValue, s);
finishValue = Math.min(finishValue, f);
}
return view.setVisible(new DoubleInterval(startValue, finishValue));
}
}
| 2,655 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
LongViewManager.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/view/manager/LongViewManager.java | /*
* @(#)LongViewManager.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.view.manager;
import java.math.BigDecimal;
import com.egantt.drawing.view.ViewManager;
import com.egantt.model.drawing.DrawingAxis;
import com.egantt.model.drawing.axis.AxisView;
import com.egantt.model.drawing.axis.interval.LongInterval;
public class LongViewManager implements ViewManager
{
protected AxisView view;
protected long center = Long.MAX_VALUE; /** treat MAX_VALUE as null */
// __________________________________________________________________________
public void setView(AxisView view)
{
this.view = view;
}
// __________________________________________________________________________
public DrawingAxis getAxis()
{
return view.getAxis();
}
public AxisView getView()
{
return view;
}
// __________________________________________________________________________
public boolean setStart(Object start)
{
LongInterval visible = (LongInterval) view.getInterval();
long startValue = ((Long) start).longValue();
long range = ((Long) visible.getRange()).longValue();
// update the mid point
this.center = startValue + (range / 2);
return view.setVisible(new LongInterval(startValue, startValue + range));
}
public boolean setFinish(Object finish)
{
LongInterval visible = (LongInterval) view.getInterval();
long finishValue = visible.getFinishValue();
long range = ((Long) visible.getRange()).longValue() / 2;
// update the mid point
this.center = range / 2;
return view.setVisible(new LongInterval(finishValue - range, finishValue));
}
// __________________________________________________________________________
public boolean translate(int x, boolean force)
{
LongInterval visible = (LongInterval) view.getInterval();
long range = visible.getRangeValue() /2;
this.center = (center == Long.MAX_VALUE)
? range + visible.getStartValue(): this.center;
long offset = 0;
{
BigDecimal result = new BigDecimal(Long.toString(range));
result = result.divide(new BigDecimal(Double.toString(50d)));
result = result.multiply(new BigDecimal(Integer.toString(x)));
offset = result.longValue();
}
long startValue = center - range - offset;
long finishValue = center + range + offset;
if (force)
{
LongInterval interval = (LongInterval) getAxis().getInterval();
long s = interval.getStartValue();
long f = interval.getFinishValue();
finishValue += (s > startValue) ? s - startValue : 0;
startValue -= (finishValue > f) ? finishValue -f : 0;
startValue = Math.max(startValue, s);
finishValue = Math.min(finishValue, f);
}
return view.setVisible(new LongInterval(startValue, finishValue));
}
}
| 2,841 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
RangePainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/RangePainter.java | /*
* @(#)RangePainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter;
import java.awt.Graphics;
import java.awt.Rectangle;
import com.egantt.drawing.DrawingPainter;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.graphics.GraphicsState;
import com.egantt.drawing.painter.range.RangeModel;
public interface RangePainter extends DrawingPainter
{
void setModel(RangeModel model);
void setPainter(DrawingPainter plotter);
void setState(GraphicsState state);
// ________________________________________________________________________
public long width(Object data, Object granularity, Graphics vg, Rectangle rect, GraphicsContext context);
}
| 782 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BoundedBoxPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/bounded/BoundedBoxPainter.java | /**
* @(#)BoundedBoxPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.bounded;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
public class BoundedBoxPainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
bounds = new Rectangle(bounds.x, bounds.y, Math.min(bounds.height, bounds.width), Math.min(bounds.height, bounds.width));
int shadowOffset = 1;
int x = bounds.x;
int y = bounds.y;
int height = bounds.height - shadowOffset;
int width = bounds.height - shadowOffset;
Graphics2D g2d = (Graphics2D) g;
Paint paint = g2d.getPaint();
if (shadowOffset > 0 ){
g.setColor(g.getColor().darker().darker());
g.fillRect(x + shadowOffset, y + shadowOffset, width, height);
}
{
g2d.setPaint(paint);
g.fillRect(x, y, width, height);
}
return bounds;
}
// ________________________________________________________________________
public long width(Object key, Graphics g, Rectangle bounds,
GraphicsContext context)
{
return Math.min(bounds.width, bounds.height);
}
}
| 1,601 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BoundedOvalPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/bounded/BoundedOvalPainter.java | /**
* @(#)BoundedOvalPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.bounded;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
public class BoundedOvalPainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
bounds = new Rectangle(bounds.x, bounds.y, Math.min(bounds.height, bounds.width), Math.min(bounds.height, bounds.width));
int backgroundDropGap = 1;
Graphics2D g2d = (Graphics2D) g;
Paint paint = g2d.getPaint();
if (backgroundDropGap > 0)
{
g.setColor(g2d.getColor().darker().darker());
g.fillOval(bounds.x + backgroundDropGap, bounds.y + backgroundDropGap,
bounds.width - backgroundDropGap, bounds.height - backgroundDropGap);
}
{
g2d.setPaint(paint);
g.fillOval(bounds.x, bounds.y,
bounds.width - backgroundDropGap, bounds.height - backgroundDropGap);
}
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds,
GraphicsContext context)
{
return Math.min(bounds.width, bounds.height);
}
}
| 1,606 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BoundedDiamondPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/bounded/BoundedDiamondPainter.java | /**
* @(#)FilledRectanglePainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.bounded;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
public class BoundedDiamondPainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
bounds = new Rectangle(bounds.x, bounds.y, Math.min(bounds.height, bounds.width), Math.min(bounds.height, bounds.width));
Graphics2D g2d = (Graphics2D) g;
Paint paint = g2d.getPaint();
int backdropGap = 2;
if (backdropGap > 0)
{
g.setColor(g.getColor().darker().darker());
drawPolygon(g, bounds.x + backdropGap, bounds.y + backdropGap,
bounds.width - ((int)(backdropGap * 1.5)), bounds.height - ((int)(backdropGap * 1.5)));
}
g2d.setPaint(paint);
drawPolygon(g, bounds.x, bounds.y,
bounds.width - backdropGap, bounds.height - backdropGap);
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds,
GraphicsContext context)
{
return bounds.width;
}
// ________________________________________________________________________
protected void drawPolygon(Graphics g, int x, int y, int width, int height) {
int xx[] = new int[4];
int yy[] = new int[4];
xx[0] = ((x + width) / 2);
xx[1] = x + width;
xx[2] = xx[0];
xx[3] = x;
yy[0] = y;
yy[1] = (y + height) / 2;
yy[2] = y + height;
yy[3] = (y + height) / 2;
g.fillPolygon(xx, yy, 4);
}
}
| 1,967 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicShapePainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/basic/BasicShapePainter.java | /*
* @(#)BasicShapePainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.basic;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.StateResources;
import com.egantt.model.drawing.painter.PainterResources;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
public class BasicShapePainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
Graphics2D g2d = (Graphics2D) g;
Shape shape = (Shape) context.get(key, PainterResources.SHAPE);
if (shape == null)
shape = (Shape) state.get(StateResources.SHAPE);
if (shape != null)
g2d.draw(shape);
return shape;
}
//___________________________________________________________________________
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return g.getClipBounds().width;
}
}
| 1,244 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicRectanglePainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/basic/BasicRectanglePainter.java | /*
* @(#)BasicRectanglePainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.basic;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.BasicStroke;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
public class BasicRectanglePainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds,
GraphicsContext context)
{
BasicStroke stroke = (BasicStroke) ((Graphics2D)g).getStroke();
return (long) stroke.getLineWidth() *2;
}
}
| 1,016 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicArcPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/basic/BasicArcPainter.java | /*
* @(#)BasicArcPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.basic;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Arc2D;
/**
* Arc painter is a different instance than the standard shape painter,
* as we need to pass in parameters on the fly
* the type is constant you should use this to specify the ArcType Arc2D.*;
*/
public class BasicArcPainter implements DrawingPainter
{
/**
* The closure type for an open arc with no path segments
* connecting the two ends of the arc segment.
*/
public final static int OPEN = Arc2D.OPEN;
/**
* The closure type for an arc closed by drawing a straight
* line segment from the start of the arc segment to the end of the
* arc segment.
*/
public final static int CHORD = Arc2D.CHORD;
/**
* The closure type for an arc closed by drawing straight line
* segments from the start of the arc segment to the center
* of the full ellipse and from that point to the end of the arc segment.
*/
public final static int PIE = Arc2D.PIE;
protected final Arc2D arc;
public BasicArcPainter(int type)
{
this.arc = new Arc2D.Double(type);
}
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds, PainterState state, GraphicsContext context)
{
AxisInterval interval = (AxisInterval) key;
double startAngle = ((Number) interval.getStart()).doubleValue();
double finishAngle = ((Number) interval.getFinish()).doubleValue();
arc.setFrame(bounds.x, bounds.y, bounds.width, bounds.height);
arc.setAngleStart(startAngle);
arc.setAngleExtent(finishAngle - startAngle);
Graphics2D g2d = (Graphics2D) g;
g2d.draw(arc);
return null;
}
public long width(Object key, java.awt.Graphics g, Rectangle bounds, GraphicsContext context)
{
return 0;
}
}
| 2,268 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicBorderPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/basic/BasicBorderPainter.java | /*
* @(#)BasicBorderPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.basic;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.StateResources;
import com.egantt.model.drawing.painter.PainterResources;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
import javax.swing.border.Border;
public class BasicBorderPainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
Border border = (Border) context.get(key, PainterResources.BORDER);
Component c = (Component) state.get(StateResources.COMPONENT);
border.paintBorder(c, g, bounds.x, bounds.y, bounds.width, bounds.height);
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return bounds.width;
}
}
| 1,185 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicOvalPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/basic/BasicOvalPainter.java | /*
* @(#)BasicOvalPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.basic;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
public class BasicOvalPainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
g.drawOval(bounds.x, bounds.y, bounds.width, bounds.height);
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return bounds.width;
}
}
| 862 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicIconPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/basic/BasicIconPainter.java | /*
* @(#)BasicIconPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.basic;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Shape;
public class BasicIconPainter implements DrawingPainter
{
protected Image image;
public BasicIconPainter(Image image)
{
this.image = image;
}
//___________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
g.drawImage(image, 0, 0, null); // point of origin x=0, y=0
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return image.getWidth(null);
}
}
| 984 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicLinePainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/basic/BasicLinePainter.java | /*
* @(#)BasicLinePainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.basic;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
public class BasicLinePainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
g.drawLine(bounds.x, bounds.y, bounds.width, bounds.height);
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return bounds.width;
}
}
| 862 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicStringPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/basic/BasicStringPainter.java | /*
* @(#)BasicStringPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.basic;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
public class BasicStringPainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
g.drawString(key != null ? key.toString() : "", bounds.x, bounds.y + g.getFontMetrics().getAscent());
return bounds; // to do calc string height, width */
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return g.getFontMetrics().stringWidth((String) key);
}
}
| 977 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
FilledArcPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/filled/FilledArcPainter.java | /*
* @(#)FilledArcPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.filled;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Arc2D;
/**
* Arc painter is a different instance than the standard shape painter,
* as we need to pass in parameters on the fly
* the type is constant you should use this to specify the ArcType Arc2D.*;
*/
public class FilledArcPainter implements DrawingPainter
{
/**
* The closure type for an open arc with no path segments
* connecting the two ends of the arc segment.
*/
public final static int OPEN = Arc2D.OPEN;
/**
* The closure type for an arc closed by drawing a straight
* line segment from the start of the arc segment to the end of the
* arc segment.
*/
public final static int CHORD = Arc2D.CHORD;
/**
* The closure type for an arc closed by drawing straight line
* segments from the start of the arc segment to the center
* of the full ellipse and from that point to the end of the arc segment.
*/
public final static int PIE = Arc2D.PIE;
protected final Arc2D arc;
public FilledArcPainter(int type)
{
this.arc = new Arc2D.Double(type);
}
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds, PainterState state, GraphicsContext context)
{
AxisInterval interval = (AxisInterval) key;
double startAngle = ((Number) interval.getStart()).doubleValue();
double finishAngle = ((Number) interval.getFinish()).doubleValue();
arc.setFrame(bounds.x, bounds.y, bounds.width, bounds.height);
arc.setAngleStart(startAngle);
arc.setAngleExtent(finishAngle - startAngle);
Graphics2D g2d = (Graphics2D) g;
g2d.fill(arc);
return null;
}
public long width(Object key, java.awt.Graphics g, Rectangle bounds, GraphicsContext context)
{
return arc.getBounds().width;
}
} | 2,291 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
FilledShapePainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/filled/FilledShapePainter.java | /*
* @(#)FilledShapePainter.java
*
* Copyright 2002 DayOrganiser LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.filled;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.StateResources;
import com.egantt.model.drawing.painter.PainterResources;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
public class FilledShapePainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
Graphics2D g2d = (Graphics2D) g;
Shape shape = (Shape) context.get(key, PainterResources.SHAPE);
if (shape == null)
shape = (Shape) state.get(StateResources.SHAPE);
if (shape != null)
g2d.fill(shape);
return shape;
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return bounds.width;
}
}
| 1,161 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
FilledOvalPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/filled/FilledOvalPainter.java | /*
* @(#)FilledOvalPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.filled;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
public class FilledOvalPainter implements DrawingPainter
{
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
g.fillOval(bounds.x, bounds.y, bounds.width, bounds.height);
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds,
GraphicsContext context)
{
return bounds.width;
}
}
| 867 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
FilledRectanglePainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/filled/FilledRectanglePainter.java | /*
* @(#)FilledRectanglePainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.filled;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
public class FilledRectanglePainter implements DrawingPainter
{
// ________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
g.setColor(Color.BLACK);
g.draw3DRect(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1, true);
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds,
GraphicsContext context)
{
return bounds.width;
}
}
| 1,004 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
PathGeneratorPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/generator/PathGeneratorPainter.java | /*
* @(#)PathGeneratorPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.generator;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.DrawingTransform;
import com.egantt.model.drawing.StateResources;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.GeneralPath;
public class PathGeneratorPainter implements DrawingPainter
{
protected final int rule;
protected transient int capacity;
public PathGeneratorPainter(int rule, int capacity)
{
this.capacity = capacity;
this.rule = rule;
}
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
DrawingTransform [] transforms = (DrawingTransform [])
state.get(StateResources.TRANSFORMS);
GeneralPath path = (GeneralPath) state.get(StateResources.SHAPE);
if (path == null)
{
path = new GeneralPath(rule, capacity);
state.put(StateResources.SHAPE, path);
}
Object [] keys = (Object []) key;
int [] points = new int[keys.length];
for (int i= 0; i < keys.length; i++)
points[i] = transforms[i % 2].transform(keys[i], i % 2 == 0 ? bounds.width : bounds.height);
path.moveTo(points[0], points[1]);
for (int i=0; i < keys.length -1; i = i + 2)
path.lineTo(points[i], points[i+1]);
return path.getBounds();
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return g.getFontMetrics().stringWidth((String) key);
}
}
| 1,779 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AxisPercentagePainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/axis/AxisPercentagePainter.java | /**
* @(#)AxisPercentagePainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.axis;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingPart;
import com.egantt.model.drawing.DrawingTransform;
import com.egantt.model.drawing.StateResources;
import com.egantt.model.drawing.axis.AxisInterval;
import com.egantt.model.drawing.axis.AxisView;
import com.egantt.model.drawing.painter.PainterState;
import com.egantt.util.Trace;
public class AxisPercentagePainter implements DrawingPainter
{
private static final boolean trace = Trace.getEnable(AxisPercentagePainter.class.getName());
public static final String PROGRESS_PAINT = "progressPaint";
protected final String axis;
public AxisPercentagePainter(String axis) {
this.axis = axis;
}
// __________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
AxisView view = (AxisView) context.get(axis, ContextResources.AXIS_VIEW);
if (view == null)
{
if (trace) Trace.out.println("AxisPercentagePainter - paint: Axis not defined in context [" + axis + "]");
// Axis not defined
return bounds;
}
DrawingPart part = (DrawingPart) state.get(StateResources.DRAWING_PART);
if (part == null || part.keys().indexOf(axis) < 0)
{
if (trace) Trace.out.println("AxisPercentagePainter - paint: Axis not defined for DrawingPart axis [" + axis + "]");
return bounds;
}
final int axisIndex = part.keys().indexOf(axis);
AxisInterval interval = part.getInterval()[axisIndex];
if (interval == null) {
if (trace) Trace.out.println("AxisPercentagePainter - paint: interval is null for DrawingPart axis [" + axis + "]");
return bounds;
}
// draw the outer rectangle
g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
g.setColor(Color.BLACK);
g.draw3DRect(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1, true);
Color fillColor = (Color) context.get(key, AxisPercentagePainter.PROGRESS_PAINT);
fillColor = fillColor != null ? fillColor : Color.BLACK;
int xOffset = Math.min(2, bounds.width - (2 * 2));
int yOffset = new Double(bounds.height * 0.30).intValue();
{
g.setColor(fillColor);
DrawingTransform transform = view.getAxis().getTransform();
int width = transform.transform(interval.getFinish(), bounds.width) - transform.transform(interval.getStart(), bounds.width);
// draw the outer rectangle
g.fillRect(bounds.x + xOffset, bounds.y + yOffset,
width - (xOffset * 2) , bounds.height - (yOffset *2));
}
return bounds;
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
return bounds.width;
}
} | 3,071 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicFormatPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/format/BasicFormatPainter.java | /*
* @(#)BasicFormatPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.format;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.model.drawing.painter.PainterResources;
import java.text.Format;
public class BasicFormatPainter extends AbstractFormatPainter
{
// __________________________________________________________________________
protected String getValue(Object key, GraphicsContext context)
{
Format format = (Format) context.get(key, PainterResources.FORMAT);
String value = format != null ? format.format(key) : key.toString();
return value;
}
}
| 697 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AbstractFormatPainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/format/AbstractFormatPainter.java | /*
* @(#)AbstractFormatPainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.format;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.font.LineMetrics;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.drawing.DrawingPainter;
import com.egantt.model.drawing.painter.PainterState;
public abstract class AbstractFormatPainter implements DrawingPainter
{
// _________________________________________________________________________
public Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
String value = getValue(key, context);
//FontMetrics fm = g.getFontMetrics();
LineMetrics metrics = g.getFontMetrics().getLineMetrics(value, g);
//Rectangle2D rect = fm.getStringBounds(value, g);
g.drawString(getValue(key, context), bounds.x, bounds.y + (int) metrics.getAscent());
return bounds; // to do use the line metrics
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context)
{
FontMetrics metrics = g.getFontMetrics();
return metrics.stringWidth(getValue(key, context));
}
// __________________________________________________________________________
protected abstract String getValue(Object key, GraphicsContext context);
}
| 1,434 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
RangeTransform.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/range/RangeTransform.java | /*
* @(#)RangeTransform.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.range;
import com.egantt.model.drawing.DrawingTransform;
public interface RangeTransform extends DrawingTransform
{
}
| 298 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
RangeModel.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/range/RangeModel.java | /*
* @(#)RangeModel.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.range;
import java.awt.Graphics;
import java.awt.Rectangle;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.model.drawing.painter.PainterState;
public interface RangeModel
{
/**
* returns an apropriate proxy based on the existing proxy
* passing in a proxy to do this is less than ideal
*/
GraphicsContext getContext(Object gran, GraphicsContext context);
// _________________________________________________________________________
/**
* This converts a one dimensional transform into a useable granularity for this class
*/
RangeIterator iterator(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context);
}
| 857 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
RangeIterator.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/range/RangeIterator.java | /*
* @(#)RangeIterator.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.range;
import java.util.Iterator;
public interface RangeIterator extends Iterator
{
/**
* returns a unique key, which reflects the position which has been reached
* from with-in the iterators data structure
*/
Object getKey();
}
| 417 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
BasicRangePainter.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/range/BasicRangePainter.java | /*
* @(#)BasicRangePainter.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.range;
import com.egantt.awt.graphics.GraphicsContext;
import com.egantt.awt.graphics.GraphicsManager;
import com.egantt.awt.graphics.GraphicsState;
import com.egantt.drawing.DrawingPainter;
import com.egantt.drawing.painter.RangePainter;
import com.egantt.model.drawing.StateResources;
import com.egantt.model.drawing.painter.PainterState;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
/**
* Relies on the availabiltiy of other plotters to perform the paint
*/
public class BasicRangePainter implements RangePainter
{
protected final GraphicsManager graphics;
protected final boolean alwaysPaint;
protected DrawingPainter painter;
protected GraphicsState state;
protected RangeModel model;
public BasicRangePainter(GraphicsManager graphics, boolean alwaysPaint)
{
this.alwaysPaint = alwaysPaint;
this.graphics = graphics;
}
// __________________________________________________________________________
public void setModel(RangeModel model)
{
this.model = model;
}
public void setPainter(DrawingPainter painter)
{
this.painter = painter;
}
public void setState(GraphicsState state)
{
this.state = state;
}
// __________________________________________________________________________
/**
* This paint essentially uses a fences and posts algorithm, we are given the
* the posts from the GranularityHelper but we need to calculate the fences
*/
public synchronized Shape paint(Object key, Graphics g, Rectangle bounds,
PainterState state, GraphicsContext context)
{
// start the drawing
this.state.initialise(g);
Graphics vg = this.state.create(bounds.x, bounds.y, bounds.width, bounds.height);
for (RangeIterator iter = model.iterator(key, g, bounds, state, context); iter.hasNext();)
{
Rectangle rect = (Rectangle) iter.next();
if (rect == null)
continue;
Object data = iter.getKey();
if (iter.getKey() == null)
continue; // :: hack !WHY!
vg = graphics.create(data, vg, context);
Object gran = state.get(StateResources.GRANULARITY_KEY);
GraphicsContext granularityContext = model.getContext(gran, context);
// don't plot plotters, that aren't really plottable
if (alwaysPaint || painter.width(data, vg, rect, granularityContext) <= rect.width)
{
painter.paint(data, vg, rect, state, granularityContext);
}
}
this.state.terminate(g);
return bounds;
}
public long width(Object data, Object granularity, Graphics vg, Rectangle rect, GraphicsContext context)
{
vg = graphics.create(data, vg, context);
return painter.width(data, vg, rect, model.getContext(granularity, context));
}
public long width(Object key, Graphics g, Rectangle bounds, GraphicsContext context) {
return bounds.width;
}
}
| 2,949 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |
AbstractRangeIterator.java | /FileExtraction/Java_unseen/akardapolov_ASH-Viewer/egantt/src/main/java/com/egantt/drawing/painter/range/iterator/AbstractRangeIterator.java | /*
* @(#)AbstractRangeIterator.java
*
* Copyright 2002 EGANTT LLP. All rights reserved.
* PROPRIETARY/QPL. Use is subject to license terms.
*/
package com.egantt.drawing.painter.range.iterator;
import com.egantt.drawing.painter.range.RangeIterator;
import java.util.Iterator;
abstract class AbstractRangeIterator implements RangeIterator
{
protected final long width;
protected transient long lastX = 0;
protected transient Object lastData;
protected transient Iterator iter;
public AbstractRangeIterator(Iterator iter, long width)
{
this.iter = iter;
this.width = width;
}
// __________________________________________________________________________
public Object getKey()
{
return lastData;
}
// __________________________________________________________________________
public boolean hasNext()
{
return width >= lastX && iter.hasNext();
}
}
| 890 | Java | .java | akardapolov/ASH-Viewer | 156 | 72 | 35 | 2011-05-25T05:22:11Z | 2023-12-04T11:03:40Z |