Package com.projity.graphic.configuration

Examples of com.projity.graphic.configuration.CellFormat


public class ResourceCellStyle extends DefaultCellStyle {
  public ResourceCellStyle(){
   
  }
  public CellFormat getCellFormat(Object object) {
    CellFormat format=super.getCellFormat(object);
    GraphicNode node=(GraphicNode)object;
    Object impl=node.getNode().getImpl();
    if (impl instanceof ResourceImpl) {
      if (((ResourceImpl)impl).getAssignments().size()>0) // make assigned resources have a special color
        format.setBackground("PALE_GREEN");
    }

    return format;
  }
View Full Code Here


*/
public class CellUtility {
  public static void setAppearance(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column, JComponent component){
    CommonSpreadSheetModel model = (CommonSpreadSheetModel) table.getModel();
    GraphicNode node = model.getNode(row);
    CellFormat cellFormat=model.getCellProperties(node);
    if (isSelected){
      component.setForeground(/*table.getSelectionForeground()*/Color.WHITE);
      component.setBackground(/*Color.BLACK*/GraphicManager.getInstance().getLafManager().getSelectedBackgroundColor());
    }else{

      Color foreground=cellFormat.getForegroundObject();
      component.setForeground((foreground==null)?table.getForeground():foreground);
      Color background=cellFormat.getBackgroundObject();
      component.setBackground((background==null)?table.getBackground():background);
    }
    //component.setFont(table.getFont());
    if (hasFocus){
      component.setBorder( /*UIManager.getBorder("Table.focusCellHighlightBorder")*/new LineBorder(Color.BLACK) );
      if (table.isCellEditable(row, column)) {
        Color foreground=cellFormat.getForegroundObject();
        component.setForeground((foreground==null)?UIManager.getColor("Table.focusCellForeground"):foreground );
        Color background=cellFormat.getBackgroundObject();
        component.setBackground((background==null)?(Environment.isMac()?Colors.NOT_TOO_DARK_GRAY:UIManager.getColor("Table.focusCellBackground")):background );
      }
    }else{
      component.setBorder(new EmptyBorder(1, 1, 1, 1));
//      if (!model.isRowEditable(row))
View Full Code Here

    return component;
  }

  public static Component getComponent(Object value, GraphicNode node, SpreadSheetParams params){
    NameCellComponent component = getUninitializedComponent(false);
    CellFormat format=params.getFieldArray().getCellStyle().getCellFormat(node);
    component.getTextComponent().setBorder(null);
    component.setOffline(true);
    CellUtility.setAppearance(format,component);
    String valueS=value == null? " " : value.toString();//to avoid void textComponents with no height
    if (valueS.length()==0) valueS=" ";
    component.setText(valueS);
    int level=params.getCache().getLevel(node);
    component.setLevel((node.isVoid())?(level+1):level,true);
    component.setLazy(node.isLazyParent());
    component.setFetched(node.isFetched());
    if (format.isCompositeIcon()) {
      component.setCollapsed(node.isCollapsed());
    } else {
      component.setLeaf(node.isVoid());
    }
    FontManager.setComponentFont(format,component);
View Full Code Here

TOP

Related Classes of com.projity.graphic.configuration.CellFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.