query

16:51:07.134 INFO  jd.cli.Main - Decompiling query.jar
package com.sun.star.wizards.query;

import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XInitialization;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.lib.uno.helper.PropertySet;
import com.sun.star.task.XJobExecutor;
import com.sun.star.uno.Type;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.PropertyNames;
import java.io.PrintStream;

public class CallQueryWizard$QueryWizardImplementation
  extends PropertySet
  implements XInitialization, XServiceInfo, XTypeProvider, XJobExecutor
{
  private PropertyValue[] m_wizardContext;
  public String Command;
  public final Integer CommandType = Integer.valueOf(1);
  private static final String __serviceName = "com.sun.star.wizards.query.CallQueryWizard";
  private XMultiServiceFactory m_serviceFactory;
  
  public CallQueryWizard$QueryWizardImplementation(XMultiServiceFactory paramXMultiServiceFactory)
  {
    m_serviceFactory = paramXMultiServiceFactory;
    registerProperty(PropertyNames.COMMAND, (short)17);
    registerProperty(PropertyNames.COMMAND_TYPE, (short)16);
  }
  
  public void trigger(String paramString)
  {
    try
    {
      if (paramString.compareTo(PropertyNames.START) == 0)
      {
        QueryWizard localQueryWizard = new QueryWizard(m_serviceFactory, m_wizardContext);
        Command = localQueryWizard.start();
      }
    }
    catch (Exception localException)
    {
      System.err.println(localException);
    }
    System.gc();
  }
  
  public void initialize(Object[] paramArrayOfObject)
    throws com.sun.star.uno.Exception
  {
    m_wizardContext = Properties.convertToPropertyValueArray(paramArrayOfObject);
  }
  
  public String[] getSupportedServiceNames()
  {
    String[] arrayOfString = new String[1];
    
    arrayOfString[0] = "com.sun.star.wizards.query.CallQueryWizard";
    
    return arrayOfString;
  }
  
  public boolean supportsService(String paramString)
  {
    boolean bool = false;
    if (paramString.equals("com.sun.star.wizards.query.CallQueryWizard")) {
      bool = true;
    }
    return bool;
  }
  
  public byte[] getImplementationId()
  {
    byte[] arrayOfByte = new byte[0];
    try
    {
      arrayOfByte = (PropertyNames.EMPTY_STRING + hashCode()).getBytes();
    }
    catch (Exception localException)
    {
      System.err.println(localException);
    }
    return arrayOfByte;
  }
  
  public String getImplementationName()
  {
    return QueryWizardImplementation.class.getName();
  }
  
  public Type[] getTypes()
  {
    Type[] arrayOfType = new Type[0];
    try
    {
      arrayOfType = new Type[] { new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class) };
    }
    catch (Exception localException)
    {
      System.err.println(localException);
    }
    return arrayOfType;
  }
}

/* Location:
 * Qualified Name:     com.sun.star.wizards.query.CallQueryWizard.QueryWizardImplementation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.wizards.query;

import com.sun.star.beans.PropertyValue;
import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.lang.XInitialization;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.lib.uno.helper.PropertySet;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.task.XJobExecutor;
import com.sun.star.uno.Type;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.PropertyNames;
import java.io.PrintStream;

public class CallQueryWizard
{
  public static XSingleServiceFactory __getServiceFactory(String paramString, XMultiServiceFactory paramXMultiServiceFactory, XRegistryKey paramXRegistryKey)
  {
    XSingleServiceFactory localXSingleServiceFactory = null;
    if (paramString.equals(QueryWizardImplementation.class.getName())) {
      localXSingleServiceFactory = FactoryHelper.getServiceFactory(QueryWizardImplementation.class, "com.sun.star.wizards.query.CallQueryWizard", paramXMultiServiceFactory, paramXRegistryKey);
    }
    return localXSingleServiceFactory;
  }
  
  public static class QueryWizardImplementation
    extends PropertySet
    implements XInitialization, XServiceInfo, XTypeProvider, XJobExecutor
  {
    private PropertyValue[] m_wizardContext;
    public String Command;
    public final Integer CommandType = Integer.valueOf(1);
    private static final String __serviceName = "com.sun.star.wizards.query.CallQueryWizard";
    private XMultiServiceFactory m_serviceFactory;
    
    public QueryWizardImplementation(XMultiServiceFactory paramXMultiServiceFactory)
    {
      m_serviceFactory = paramXMultiServiceFactory;
      registerProperty(PropertyNames.COMMAND, (short)17);
      registerProperty(PropertyNames.COMMAND_TYPE, (short)16);
    }
    
    public void trigger(String paramString)
    {
      try
      {
        if (paramString.compareTo(PropertyNames.START) == 0)
        {
          QueryWizard localQueryWizard = new QueryWizard(m_serviceFactory, m_wizardContext);
          Command = localQueryWizard.start();
        }
      }
      catch (Exception localException)
      {
        System.err.println(localException);
      }
      System.gc();
    }
    
    public void initialize(Object[] paramArrayOfObject)
      throws com.sun.star.uno.Exception
    {
      m_wizardContext = Properties.convertToPropertyValueArray(paramArrayOfObject);
    }
    
    public String[] getSupportedServiceNames()
    {
      String[] arrayOfString = new String[1];
      
      arrayOfString[0] = "com.sun.star.wizards.query.CallQueryWizard";
      
      return arrayOfString;
    }
    
    public boolean supportsService(String paramString)
    {
      boolean bool = false;
      if (paramString.equals("com.sun.star.wizards.query.CallQueryWizard")) {
        bool = true;
      }
      return bool;
    }
    
    public byte[] getImplementationId()
    {
      byte[] arrayOfByte = new byte[0];
      try
      {
        arrayOfByte = (PropertyNames.EMPTY_STRING + hashCode()).getBytes();
      }
      catch (Exception localException)
      {
        System.err.println(localException);
      }
      return arrayOfByte;
    }
    
    public String getImplementationName()
    {
      return QueryWizardImplementation.class.getName();
    }
    
    public Type[] getTypes()
    {
      Type[] arrayOfType = new Type[0];
      try
      {
        arrayOfType = new Type[] { new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class) };
      }
      catch (Exception localException)
      {
        System.err.println(localException);
      }
      return arrayOfType;
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.star.wizards.query.CallQueryWizard
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.wizards.query;

import com.sun.star.awt.XRadioButton;
import com.sun.star.awt.XTextComponent;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.wizards.common.HelpIds;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.db.SQLQueryComposer;
import com.sun.star.wizards.ui.UnoDialog;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Finalizer
{
  private QueryWizard m_queryWizard;
  private String resQuery;
  private XTextComponent m_aTxtTitle;
  private XRadioButton xRadioDisplayQuery;
  private QuerySummary CurDBMetaData;
  
  public Finalizer(QueryWizard paramQueryWizard, QuerySummary paramQuerySummary)
  {
    short s = 800;
    
    m_queryWizard = paramQueryWizard;
    CurDBMetaData = paramQuerySummary;
    String str1 = m_queryWizard.m_oResource.getResText(2305);
    String str2 = m_queryWizard.m_oResource.getResText(2306);
    String str3 = m_queryWizard.m_oResource.getResText(2307);
    String str4 = m_queryWizard.m_oResource.getResText(2387);
    String str5 = m_queryWizard.m_oResource.getResText(2308);
    resQuery = m_queryWizard.m_oResource.getResText(2301);
    int i = 40955;
    
    s = (short)(s + 1);{ Integer.valueOf(8), str1, Integer.valueOf(95), Integer.valueOf(27), new Integer(8) }[5] = new Short(s); Object[] tmp230_214 = tmp214_202;tmp230_214[6] = Integer.valueOf(52);m_queryWizard.insertLabel("lblQueryTitle", new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, tmp230_214);
    
    s = (short)(s + 1);{ Integer.valueOf(12), HelpIds.getHelpIdString(i++), Integer.valueOf(95), Integer.valueOf(37), new Integer(8) }[5] = new Short(s); Object[] tmp369_353 = tmp353_341;tmp369_353[6] = Integer.valueOf(90);m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", "changeTitle", this, new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, tmp369_353);
    
    s = (short)(s + 1);{ Integer.valueOf(16), str5, Boolean.TRUE, Integer.valueOf(192), Integer.valueOf(27), new Integer(8) }[6] = new Short(s); Object[] tmp515_498 = tmp498_486;tmp515_498[7] = Integer.valueOf(112);m_queryWizard.insertLabel("lblHowGoOn", new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, tmp515_498);
    
    s = (short)(s + 1);{ Integer.valueOf(9), HelpIds.getHelpIdString(i++), str2, Integer.valueOf(192), Integer.valueOf(46), new Short(1), new Integer(8) }[7] = new Short(s); Object[] tmp684_667 = tmp667_654;tmp684_667[8] = Integer.valueOf(118);xRadioDisplayQuery = m_queryWizard.insertRadioButton("optDisplayQuery", new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, tmp684_667);
    
    s = (short)(s + 1);{ Integer.valueOf(10), HelpIds.getHelpIdString(i++), str3, Integer.valueOf(192), Integer.valueOf(56), new Integer(8) }[6] = new Short(s); Object[] tmp835_818 = tmp818_806;tmp835_818[7] = Integer.valueOf(118);m_queryWizard.insertRadioButton("optModifyQuery", new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, tmp835_818);
    
    s = (short)(s + 1);{ Integer.valueOf(10), str4, Integer.valueOf(95), Integer.valueOf(68), Integer.valueOf(8) }[5] = new Short(s); Object[] tmp960_944 = tmp944_936;tmp960_944[6] = Integer.valueOf(209);m_queryWizard.insertFixedLine("flnSummary", new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, tmp960_944);
    
    m_queryWizard.insertTextField("txtSummary", 0, null, new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.READ_ONLY, PropertyNames.PROPERTY_STEP, "VScroll", PropertyNames.PROPERTY_WIDTH }, new Object[] { Integer.valueOf(96), HelpIds.getHelpIdString(i++), Boolean.TRUE, Integer.valueOf(95), Integer.valueOf(80), Boolean.TRUE, Integer.valueOf(8), Boolean.TRUE, Integer.valueOf(209) });
  }
  
  public void changeTitle()
  {
    String str = m_aTxtTitle.getText();
    m_queryWizard.enableFinishButton(str.length() > 0);
  }
  
  protected String initialize()
  {
    try
    {
      String str = AnyConverter.toString(Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text"));
      if (str != null) {
        if (str.equals(PropertyNames.EMPTY_STRING))
        {
          String[] arrayOfString = CurDBMetaData.getIncludedCommandNames();
          str = resQuery + "_" + arrayOfString[0];
          str = CurDBMetaData.suggestName(1, str);
          Helper.setUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text", str);
        }
      }
      CurDBMetaData.setSummaryString();
      m_queryWizard.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString());
      return str;
    }
    catch (Exception localException)
    {
      localException.printStackTrace(System.out);
    }
    return PropertyNames.EMPTY_STRING;
  }
  
  private String getTitle()
  {
    return (String)Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text");
  }
  
  public String finish()
  {
    String str = getTitle();
    if ((CurDBMetaData.getSQLQueryComposer().setQueryCommand(m_queryWizard.xWindow, true, true)) && (CurDBMetaData.createQuery(CurDBMetaData.getSQLQueryComposer(), str))) {
      return str;
    }
    return PropertyNames.EMPTY_STRING;
  }
  
  public final boolean displayQueryDesign()
  {
    try
    {
      int i = AnyConverter.toShort(Helper.getUnoPropertyValue(UnoDialog.getModel(xRadioDisplayQuery), PropertyNames.PROPERTY_STATE));
      int j = i == 1 ? 1 : 0;
      return j == 0;
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      Logger.getLogger(Finalizer.class.getName()).log(Level.SEVERE, null, localIllegalArgumentException);
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     com.sun.star.wizards.query.Finalizer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.wizards.query;

import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdbc.XDatabaseMetaData;
import com.sun.star.uno.Exception;
import com.sun.star.wizards.common.JavaTools;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.db.FieldColumn;
import com.sun.star.wizards.db.QueryMetaData;
import com.sun.star.wizards.ui.FilterComponent;

public class QuerySummary
  extends QueryMetaData
{
  protected final int RID_QUERY = 2300;
  protected final int RID_REPORT = 2400;
  String sSummary;
  Resource oResource;
  private String sSeparator;
  private String sReturnChar;
  private String sAnd;
  private String sOr;
  
  public QuerySummary(XMultiServiceFactory paramXMultiServiceFactory, Resource paramResource)
  {
    super(paramXMultiServiceFactory);
    oResource = paramResource;
    
    sAnd = oResource.getResText(2338);
    sOr = oResource.getResText(2339);
    sSeparator = oResource.getResText(2391);
    sReturnChar = (String.valueOf('\r') + String.valueOf('\r'));
  }
  
  public void setSummaryString()
  {
    try
    {
      String str1 = PropertyNames.EMPTY_STRING;
      String str2 = PropertyNames.EMPTY_STRING;
      String str3 = PropertyNames.EMPTY_STRING;
      String str4 = PropertyNames.EMPTY_STRING;
      String str5 = PropertyNames.EMPTY_STRING;
      String str6 = PropertyNames.EMPTY_STRING;
      str1 = combineFieldNameFraction() + sReturnChar;
      str2 = combinePartString(2351, getSortFieldNames(), 2352, 2393, new String[] { "<FIELDNAME>", "<SORTMODE>" }) + sReturnChar;
      
      str3 = combineFilterNameFraction(getFilterConditions(), 2353, 2354) + sReturnChar;
      if (xDBMetaData.supportsGroupBy())
      {
        str5 = combinePartString(2357, GroupFieldNames, 2358) + sReturnChar;
        str6 = combineFilterNameFraction(getGroupByFilterConditions(), 2359, 2360);
      }
      sSummary = (str1 + str2 + str3 + str4 + str5 + str6);
      sSummary = JavaTools.replaceSubString(sSummary, PropertyNames.EMPTY_STRING, "~");
    }
    catch (Exception localException)
    {
      localException.printStackTrace(System.out);
    }
  }
  
  public String getSummaryString()
  {
    return sSummary;
  }
  
  private String combineFilterNameFraction(PropertyValue[][] paramArrayOfPropertyValue, int paramInt1, int paramInt2)
  {
    if ((paramArrayOfPropertyValue != null) && (paramArrayOfPropertyValue.length > 0))
    {
      String str1 = PropertyNames.EMPTY_STRING;
      String str2 = oResource.getResText(paramInt1);
      String str3 = oResource.getResText(2396);
      if (paramArrayOfPropertyValue.length == 1)
      {
        PropertyValue[] arrayOfPropertyValue = paramArrayOfPropertyValue[0];
        for (int j = 0; j < arrayOfPropertyValue.length; j++)
        {
          str1 = str1 + FilterComponent.getDisplayCondition(str3, paramArrayOfPropertyValue[0][j], this);
          str1 = appendClauseSeparator(str1, PropertyNames.SPACE + sAnd + PropertyNames.SPACE, j, arrayOfPropertyValue.length);
        }
      }
      else
      {
        for (int i = 0; i < paramArrayOfPropertyValue.length; i++)
        {
          str1 = str1 + FilterComponent.getDisplayCondition(str3, paramArrayOfPropertyValue[i][0], this);
          str1 = appendClauseSeparator(str1, PropertyNames.SPACE + sOr + PropertyNames.SPACE, i, paramArrayOfPropertyValue.length);
        }
      }
      return str2 + str1;
    }
    return oResource.getResText(paramInt2);
  }
  
  private String combineFieldNameFraction()
  {
    Object localObject = PropertyNames.EMPTY_STRING;
    String str1 = oResource.getResText(2350);
    String str2 = oResource.getResText(2392);
    for (int i = 0; i < FieldColumns.length; i++)
    {
      localObject = str2;
      FieldColumn localFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].getDisplayFieldName());
      int j = getAggregateIndex(FieldColumns[i].getFieldName());
      if (j > -1)
      {
        String str3 = AggregateFieldNames[j][1] + "(" + AggregateFieldNames[j][0] + ")";
        localObject = JavaTools.replaceSubString((String)localObject, str3, "<FIELDNAME>");
      }
      else
      {
        localObject = JavaTools.replaceSubString((String)localObject, localFieldColumn.getDisplayFieldName(), "<FIELDNAME>");
      }
      str1 = str1 + JavaTools.replaceSubString((String)localObject, localFieldColumn.getFieldTitle(), "<FIELDTITLE>");
      str1 = appendClauseSeparator(str1, sSeparator, i, FieldColumns.length);
    }
    return str1;
  }
  
  private String appendClauseSeparator(String paramString1, String paramString2, int paramInt1, int paramInt2)
  {
    if (paramInt1 < paramInt2 - 1) {
      paramString1 = paramString1 + paramString2;
    }
    return paramString1;
  }
  
  public String combinePartString(int paramInt1, String[] paramArrayOfString, int paramInt2)
  {
    if ((paramArrayOfString != null) && (paramArrayOfString.length > 0)) {
      return ArrayFieldsToString(paramInt1, paramArrayOfString);
    }
    return oResource.getResText(paramInt2);
  }
  
  protected String ArrayFieldsToString(int paramInt, String[] paramArrayOfString)
  {
    String str = oResource.getResText(paramInt);
    int i = paramArrayOfString.length;
    for (int j = 0; j < i; j++)
    {
      str = str + getFieldColumnByDisplayName(paramArrayOfString[j]).getFieldTitle();
      if (j < i - 1) {
        str = str + sSeparator;
      }
    }
    return str;
  }
  
  public String combinePartString(int paramInt1, String[][] paramArrayOfString, int paramInt2, int paramInt3, String[] paramArrayOfString1)
  {
    if ((paramArrayOfString != null) && (paramArrayOfString.length > 0)) {
      return ArrayFieldsToString(paramInt1, paramArrayOfString, paramInt3, paramArrayOfString1);
    }
    return oResource.getResText(paramInt2);
  }
  
  public String ArrayFieldsToString(int paramInt1, String[][] paramArrayOfString, int paramInt2, String[] paramArrayOfString1)
  {
    String str1 = PropertyNames.EMPTY_STRING;
    String str2 = oResource.getResText(paramInt1);
    int i = paramArrayOfString.length;
    if (i > 0)
    {
      int j = paramArrayOfString[0].length;
      String str3 = oResource.getResText(paramInt2);
      for (int k = 0; k < i; k++)
      {
        for (int m = 0; m < j; m++) {
          if (m == 0)
          {
            int n = getAggregateIndex(getFieldColumnByDisplayName(paramArrayOfString[k][m]).getDisplayFieldName());
            if (n > -1)
            {
              String str4 = AggregateFieldNames[n][1] + "(" + AggregateFieldNames[n][0] + ")";
              str1 = JavaTools.replaceSubString(str3, str4, paramArrayOfString1[m]);
            }
            else
            {
              str1 = JavaTools.replaceSubString(str3, getFieldColumnByDisplayName(paramArrayOfString[k][m]).getFieldTitle(), paramArrayOfString1[m]);
            }
          }
          else
          {
            str1 = JavaTools.replaceSubString(str1, paramArrayOfString[k][m], paramArrayOfString1[m]);
          }
        }
        str2 = str2 + str1;
        if (k < i - 1) {
          str2 = str2 + sSeparator;
        }
      }
    }
    return str2;
  }
}

/* Location:
 * Qualified Name:     com.sun.star.wizards.query.QuerySummary
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.wizards.query;

import com.sun.star.awt.XListBox;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.JavaTools;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.ui.CommandFieldSelection;
import com.sun.star.wizards.ui.FieldSelection;
import com.sun.star.wizards.ui.XFieldSelectionListener;

public class QueryWizard$FieldSelectionListener
  implements XFieldSelectionListener
{
  protected int ID;
  
  public QueryWizard$FieldSelectionListener(QueryWizard paramQueryWizard) {}
  
  public int getID()
  {
    return ID;
  }
  
  public void setID(String paramString)
  {
    ID = 1;
    if (paramString != null) {
      if ((!paramString.equals(PropertyNames.EMPTY_STRING)) && (!paramString.equals("_")))
      {
        String str = JavaTools.ArrayoutofString(paramString, "_")[1];
        ID = Integer.parseInt(str);
        int i = 0;
      }
    }
  }
  
  public void shiftFromLeftToRight(String[] paramArrayOfString1, String[] paramArrayOfString2)
  {
    if (ID == 1)
    {
      QueryWizard.access$100(this$0).addSeveralFieldColumns(paramArrayOfString1, QueryWizard.access$000(this$0).getSelectedCommandName());
      QueryWizard.access$200(this$0, paramArrayOfString2);
      QueryWizard.access$000(this$0).changeSelectedFieldNames(QueryWizard.access$100(this$0).getDisplayFieldNames());
      QueryWizard.access$000(this$0).toggleCommandListBox(paramArrayOfString2);
    }
    else
    {
      boolean bool = QueryWizard.access$300(this$0).getSelectedFieldNames().length > 0;
      Helper.setUnoPropertyValue(this$0.getRoadmapItemByID(6), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bool));
    }
  }
  
  public void shiftFromRightToLeft(String[] paramArrayOfString1, String[] paramArrayOfString2)
  {
    if (ID == 1)
    {
      QueryWizard.access$200(this$0, paramArrayOfString2);
      String[] arrayOfString1 = QueryWizard.access$100(this$0).getFieldNames(paramArrayOfString1, QueryWizard.access$000(this$0).getSelectedCommandName());
      QueryWizard.access$000(this$0).addItemsToFieldsListbox(arrayOfString1);
      QueryWizard.access$100(this$0).removeSeveralFieldColumnsByDisplayFieldName(paramArrayOfString1);
      QueryWizard.access$000(this$0).toggleCommandListBox(paramArrayOfString2);
    }
    else
    {
      boolean bool = QueryWizard.access$300(this$0).getSelectedFieldNames().length > 0;
      String str = paramArrayOfString1[0];
      if (JavaTools.FieldInList(access$100this$0).NonAggregateFieldNames, str) > -1)
      {
        this$0.showMessageBox("ErrorBox", 4194304, QueryWizard.access$400(this$0));
        access$300this$0).xSelectedFieldsListBox.addItems(paramArrayOfString1, access$300this$0).xSelectedFieldsListBox.getItemCount());
        String[] arrayOfString2 = access$300this$0).xFieldsListBox.getItems();
        int i = JavaTools.FieldInList(arrayOfString2, str);
        if (i > -1) {
          access$300this$0).xFieldsListBox.removeItems((short)i, (short)1);
        }
      }
      else
      {
        Helper.setUnoPropertyValue(this$0.getRoadmapItemByID(6), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bool));
      }
    }
  }
  
  public void moveItemDown(String paramString) {}
  
  public void moveItemUp(String paramString) {}
}

/* Location:
 * Qualified Name:     com.sun.star.wizards.query.QueryWizard.FieldSelectionListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.wizards.query;

import com.sun.star.awt.XControl;
import com.sun.star.awt.XDialog;
import com.sun.star.awt.XListBox;
import com.sun.star.awt.XWindow;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.container.XIndexContainer;
import com.sun.star.frame.XFrame;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdbc.SQLException;
import com.sun.star.sdbc.XDatabaseMetaData;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.JavaTools;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.db.DatabaseObjectWizard;
import com.sun.star.wizards.ui.AggregateComponent;
import com.sun.star.wizards.ui.CommandFieldSelection;
import com.sun.star.wizards.ui.FieldSelection;
import com.sun.star.wizards.ui.FilterComponent;
import com.sun.star.wizards.ui.SortingComponent;
import com.sun.star.wizards.ui.TitlesComponent;
import com.sun.star.wizards.ui.XFieldSelectionListener;

public class QueryWizard
  extends DatabaseObjectWizard
{
  public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox";
  private static final int SOFIELDSELECTION_PAGE = 1;
  private static final int SOSORTING_PAGE = 2;
  private static final int SOFILTER_PAGE = 3;
  private static final int SOAGGREGATE_PAGE = 4;
  private static final int SOGROUPSELECTION_PAGE = 5;
  private static final int SOGROUPFILTER_PAGE = 6;
  private static final int SOTITLES_PAGE = 7;
  protected static final int SOSUMMARY_PAGE = 8;
  private CommandFieldSelection m_DBCommandFieldSelectio;
  private SortingComponent m_sortingComponent;
  private FieldSelection m_groupFieldSelection;
  private TitlesComponent m_titlesComponent;
  private FilterComponent m_filterComponent;
  private FilterComponent m_groupFilterComponent;
  private AggregateComponent m_aggregateComponent;
  private Finalizer m_finalizer;
  private QuerySummary m_DBMetaData;
  private String reslblFieldHeader;
  private String reslblAliasHeader;
  private String reslblFields;
  private String reslblSelFields;
  private String reslblTables;
  private String reslblGroupBy;
  private String resmsgNonNumericAsGroupBy;
  private String m_createdQuery;
  
  public QueryWizard(XMultiServiceFactory paramXMultiServiceFactory, PropertyValue[] paramArrayOfPropertyValue)
  {
    super(paramXMultiServiceFactory, 40970, paramArrayOfPropertyValue);
    addResourceHandler("QueryWizard", "dbw");
    m_DBMetaData = new QuerySummary(paramXMultiServiceFactory, m_oResource);
  }
  
  public static void main(String[] paramArrayOfString)
  {
    executeWizardFromCommandLine(paramArrayOfString, QueryWizard.class.getName());
  }
  
  public final XFrame getFrame()
  {
    return m_frame;
  }
  
  public String start()
  {
    try
    {
      if (m_DBMetaData.getConnection(m_wizardContext))
      {
        reslblFields = m_oResource.getResText(2304);
        reslblFieldHeader = m_oResource.getResText(2319);
        reslblAliasHeader = m_oResource.getResText(2320);
        reslblSelFields = m_oResource.getResText(2350);
        reslblTables = m_oResource.getResText(2303);
        reslblGroupBy = m_oResource.getResText(2318);
        String str = m_oResource.getResText(2302);
        resmsgNonNumericAsGroupBy = m_oResource.getResText(2388);
        Helper.setUnoPropertyValues(xDialogModel, new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { Integer.valueOf(210), Boolean.TRUE, "DialogQuery", Integer.valueOf(102), Integer.valueOf(41), Integer.valueOf(1), new Short(0), str, Integer.valueOf(310) });
        
        drawNaviBar();
        setRightPaneHeaders(m_oResource, 2370, 8);
        setMaxStep(8);
        buildSteps();
        m_DBCommandFieldSelectio.preselectCommand(m_wizardContext, false);
        
        XWindowPeer localXWindowPeer = (XWindowPeer)UnoRuntime.queryInterface(XWindowPeer.class, m_frame.getContainerWindow());
        createWindowPeer(localXWindowPeer);
        m_DBMetaData.setWindowPeer(xControl.getPeer());
        insertQueryRelatedSteps();
        executeDialog(m_frame.getContainerWindow().getPosSize());
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace(System.out);
    }
    m_groupFilterComponent = null;
    m_titlesComponent = null;
    m_aggregateComponent = null;
    m_DBCommandFieldSelectio = null;
    xWindowPeer = null;
    m_finalizer = null;
    m_DBMetaData.finish();
    m_DBMetaData = null;
    System.gc();
    
    return m_createdQuery;
  }
  
  public void enableRoadmapItems(String[] paramArrayOfString, boolean paramBoolean)
  {
    try
    {
      int i = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP));
      boolean bool = false;
      for (int k = 0; k < getRMItemCount(); k++)
      {
        Object localObject = xIndexContRoadmap.getByIndex(k);
        int j = AnyConverter.toInt(Helper.getUnoPropertyValue(localObject, "ID"));
        switch (j)
        {
        case 4: 
          if (paramBoolean) {
            bool = (m_DBMetaData.hasNumericalFields()) && (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar());
          }
          break;
        case 5: 
          bool = m_DBMetaData.Type == 0;
          break;
        case 6: 
          bool = false;
          if (paramBoolean) {
            bool = m_DBMetaData.GroupByFilterConditions.length > 0;
          }
          break;
        default: 
          if (j > i) {
            bool = paramBoolean;
          } else {
            bool = true;
          }
          break;
        }
        super.setStepEnabled(j, bool);
      }
    }
    catch (com.sun.star.uno.Exception localException)
    {
      localException.printStackTrace(System.out);
    }
  }
  
  public void insertQueryRelatedSteps()
  {
    try
    {
      setRMItemLabels(m_oResource, 2380);
      addRoadmap();
      int i = 0;
      i = insertRoadmapItem(0, true, 0, 1);
      i = insertRoadmapItem(i, false, 1, 2);
      i = insertRoadmapItem(i, false, 2, 3);
      if (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar()) {
        i = insertRoadmapItem(i, m_DBMetaData.hasNumericalFields(), 3, 4);
      }
      if (m_DBMetaData.xDBMetaData.supportsGroupBy())
      {
        i = insertRoadmapItem(i, false, 4, 5);
        i = insertRoadmapItem(i, false, 5, 6);
      }
      i = insertRoadmapItem(i, false, 6, 7);
      i = insertRoadmapItem(i, false, 7, 8);
      setRoadmapInteractive(true);
      setRoadmapComplete(true);
      setCurrentRoadmapItemID((short)1);
    }
    catch (com.sun.star.uno.Exception localException)
    {
      Resource.showCommonResourceError(xMSF);
    }
  }
  
  public void buildSteps()
  {
    try
    {
      m_DBCommandFieldSelectio = new CommandFieldSelection(this, m_DBMetaData, 120, reslblFields, reslblSelFields, reslblTables, m_DBMetaData.supportsQueriesInFrom(), 40850);
      
      m_DBCommandFieldSelectio.setAppendMode(true);
      m_DBCommandFieldSelectio.addFieldSelectionListener(new FieldSelectionListener());
      m_sortingComponent = new SortingComponent(this, 2, 95, 27, 210, 40865);
      m_filterComponent = new FilterComponent(this, xMSF, 3, 97, 27, 209, 3, m_DBMetaData, 40878);
      m_filterComponent.addNumberFormats();
      if (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar()) {
        m_aggregateComponent = new AggregateComponent(this, m_DBMetaData, 4, 97, 69, 209, 5, 40895);
      }
      if (m_DBMetaData.xDBMetaData.supportsGroupBy())
      {
        m_groupFieldSelection = new FieldSelection(this, 5, 95, 27, 210, 150, reslblFields, reslblGroupBy, 40915, false);
        m_groupFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
        m_groupFilterComponent = new FilterComponent(this, xMSF, 6, 97, 27, 209, 3, m_DBMetaData, 40923);
      }
      m_titlesComponent = new TitlesComponent(this, 7, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940);
      m_finalizer = new Finalizer(this, m_DBMetaData);
      enableNavigationButtons(false, false, false);
    }
    catch (com.sun.star.uno.Exception localException)
    {
      Resource.showCommonResourceError(xMSF);
    }
  }
  
  public boolean finishWizard()
  {
    int i = getCurrentStep();
    if ((i == 8) || (switchToStep(i, 8)))
    {
      m_createdQuery = m_finalizer.finish();
      if (m_createdQuery.length() > 0)
      {
        loadSubComponent(1, m_createdQuery, m_finalizer.displayQueryDesign());
        xDialog.endExecute();
        return true;
      }
    }
    return false;
  }
  
  protected void enterStep(int paramInt1, int paramInt2)
  {
    try
    {
      if ((paramInt1 <= 5) && (paramInt2 > 5)) {
        if (m_DBMetaData.xDBMetaData.supportsGroupBy())
        {
          m_DBMetaData.setGroupFieldNames(m_groupFieldSelection.getSelectedFieldNames());
          m_DBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(m_DBMetaData.GroupFieldNames, m_DBMetaData.NonAggregateFieldNames);
          m_DBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(m_DBMetaData.GroupByFilterConditions, m_DBMetaData.GroupFieldNames);
        }
      }
      switch (paramInt2)
      {
      case 1: 
        break;
      case 2: 
        m_sortingComponent.initialize(m_DBMetaData.getDisplayFieldNames(), m_DBMetaData.getSortFieldNames());
        break;
      case 3: 
        m_filterComponent.initialize(m_DBMetaData.getFilterConditions(), m_DBMetaData.getDisplayFieldNames());
        break;
      case 4: 
        m_aggregateComponent.initialize();
        break;
      case 5: 
        break;
      case 6: 
        m_groupFilterComponent.initialize(m_DBMetaData.GroupByFilterConditions, m_DBMetaData.getGroupFieldNames());
        break;
      case 7: 
        m_titlesComponent.initialize(m_DBMetaData.getDisplayFieldNames(), m_DBMetaData.FieldTitleSet);
        break;
      case 8: 
        m_finalizer.initialize();
      }
    }
    catch (SQLException localSQLException)
    {
      localSQLException.printStackTrace(System.out);
    }
  }
  
  protected void leaveStep(int paramInt1, int paramInt2)
  {
    switch (paramInt1)
    {
    case 1: 
      m_DBMetaData.reorderFieldColumns(m_DBCommandFieldSelectio.getSelectedFieldNames());
      m_DBMetaData.initializeFieldTitleSet(true);
      m_DBMetaData.setNumericFields();
      searchForOutdatedFields();
      break;
    case 2: 
      m_DBMetaData.setSortFieldNames(m_sortingComponent.getSortFieldNames());
      break;
    case 3: 
      m_DBMetaData.setFilterConditions(m_filterComponent.getFilterConditions());
      break;
    case 4: 
      m_DBMetaData.AggregateFieldNames = m_aggregateComponent.getAggregateFieldNames();
      break;
    case 5: 
      break;
    case 6: 
      m_DBMetaData.setGroupByFilterConditions(m_groupFilterComponent.getFilterConditions());
      break;
    case 7: 
      m_DBMetaData.setFieldTitles(m_titlesComponent.getFieldTitles());
      break;
    case 8: 
      break;
    }
    if ((paramInt1 < 5) && (paramInt2 >= 5)) {
      try
      {
        if (m_DBMetaData.Type == 0) {
          if (m_DBMetaData.xDBMetaData.supportsGroupBy())
          {
            m_DBMetaData.setNonAggregateFieldNames();
            m_groupFieldSelection.initialize(m_DBMetaData.getUniqueAggregateFieldNames(), false, m_DBMetaData.xDBMetaData.getMaxColumnsInGroupBy());
            m_groupFieldSelection.intializeSelectedFields(m_DBMetaData.NonAggregateFieldNames);
            m_groupFieldSelection.setMultipleMode(false);
            setStepEnabled(6, (m_aggregateComponent.isGroupingpossible()) && (m_DBMetaData.NonAggregateFieldNames.length > 0));
          }
        }
      }
      catch (SQLException localSQLException)
      {
        localSQLException.printStackTrace(System.err);
      }
    }
  }
  
  private void searchForOutdatedFields()
  {
    String[] arrayOfString = m_DBMetaData.getFieldNames();
    String[][] arrayOfString1 = JavaTools.removeOutdatedFields(m_DBMetaData.getSortFieldNames(), arrayOfString);
    m_DBMetaData.setSortFieldNames(arrayOfString1);
    m_DBMetaData.setFilterConditions(JavaTools.removeOutdatedFields(m_DBMetaData.getFilterConditions(), arrayOfString));
    m_DBMetaData.AggregateFieldNames = JavaTools.removeOutdatedFields(m_DBMetaData.AggregateFieldNames, arrayOfString);
  }
  
  private void enableWizardSteps(String[] paramArrayOfString)
  {
    boolean bool = paramArrayOfString.length > 0;
    setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bool));
    setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bool));
    enableRoadmapItems(paramArrayOfString, bool);
  }
  
  public class FieldSelectionListener
    implements XFieldSelectionListener
  {
    protected int ID;
    
    public FieldSelectionListener() {}
    
    public int getID()
    {
      return ID;
    }
    
    public void setID(String paramString)
    {
      ID = 1;
      if (paramString != null) {
        if ((!paramString.equals(PropertyNames.EMPTY_STRING)) && (!paramString.equals("_")))
        {
          String str = JavaTools.ArrayoutofString(paramString, "_")[1];
          ID = Integer.parseInt(str);
          int i = 0;
        }
      }
    }
    
    public void shiftFromLeftToRight(String[] paramArrayOfString1, String[] paramArrayOfString2)
    {
      if (ID == 1)
      {
        m_DBMetaData.addSeveralFieldColumns(paramArrayOfString1, m_DBCommandFieldSelectio.getSelectedCommandName());
        QueryWizard.this.enableWizardSteps(paramArrayOfString2);
        m_DBCommandFieldSelectio.changeSelectedFieldNames(m_DBMetaData.getDisplayFieldNames());
        m_DBCommandFieldSelectio.toggleCommandListBox(paramArrayOfString2);
      }
      else
      {
        boolean bool = m_groupFieldSelection.getSelectedFieldNames().length > 0;
        Helper.setUnoPropertyValue(getRoadmapItemByID(6), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bool));
      }
    }
    
    public void shiftFromRightToLeft(String[] paramArrayOfString1, String[] paramArrayOfString2)
    {
      if (ID == 1)
      {
        QueryWizard.this.enableWizardSteps(paramArrayOfString2);
        String[] arrayOfString1 = m_DBMetaData.getFieldNames(paramArrayOfString1, m_DBCommandFieldSelectio.getSelectedCommandName());
        m_DBCommandFieldSelectio.addItemsToFieldsListbox(arrayOfString1);
        m_DBMetaData.removeSeveralFieldColumnsByDisplayFieldName(paramArrayOfString1);
       
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd