1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 package com.sun.star.wizards.ui; 24 25 import java.util.ArrayList; 26 import java.util.Vector; 27 import com.sun.star.wizards.common.*; 28 import com.sun.star.wizards.db.*; 29 import com.sun.star.lang.EventObject; 30 import com.sun.star.beans.*; 31 import com.sun.star.sdbc.SQLException; 32 import com.sun.star.uno.AnyConverter; 33 34 import com.sun.star.awt.*; 35 36 public class AggregateComponent extends ControlScroller 37 { 38 39 String[] sFunctions; 40 String[] sFunctionOperators = new String[] 41 { 42 "SUM", "AVG", "MIN", "MAX", "COUNT" 43 }; 44 QueryMetaData CurDBMetaData; 45 XButton optDetailQuery; 46 XButton optSummaryQuery; 47 String soptDetailQuery; 48 String soptSummaryQuery; 49 String slblAggregate; 50 String slblFieldNames; 51 String sDuplicateAggregateFunction; 52 int Count; 53 int iQueryType; 54 final int SOADDROW = 1; 55 final int SOREMOVEROW = 2; 56 final int CONTROLROWDIST = 18; 57 Vector ControlRowVector; 58 String OPTIONBUTTONDETAILQUERY_ITEM_CHANGED = "toggleComponent"; 59 String OPTIONBUTTONSUMMARYQUERY_ITEM_CHANGED = "toggleComponent"; 60 String LISTBOXFUNCTIONS_ACTION_PERFORMED; 61 String LISTBOXFUNCTIONS_ITEM_CHANGED; 62 String LISTBOXFIELDNAMES_ACTION_PERFORMED; 63 String LISTBOXFIELDNAMES_ITEM_CHANGED; 64 String COMMANDBUTTONPLUS_ACTION_PERFORMED = "addRow"; 65 String COMMANDBUTTONMINUS_ACTION_PERFORMED = "removeRow"; 66 Vector ControlRows; 67 int curHelpID; 68 int lastHelpIndex; 69 70 /** Creates a new instance of AggrgateComponent */ AggregateComponent(WizardDialog _CurUnoDialog, QueryMetaData _CurDBMetaData, int _iStep, int _iPosX, int _iPosY, int _iWidth, int _uitextfieldcount, int _firstHelpID)71 public AggregateComponent(WizardDialog _CurUnoDialog, QueryMetaData _CurDBMetaData, int _iStep, int _iPosX, int _iPosY, int _iWidth, int _uitextfieldcount, int _firstHelpID) 72 { 73 super(_CurUnoDialog, _CurDBMetaData.xMSF, _iStep, _iPosX + 10, _iPosY, _iWidth - 12, _uitextfieldcount, 18, _firstHelpID + 2); 74 try 75 { 76 curHelpID = _firstHelpID; 77 this.CurDBMetaData = _CurDBMetaData; 78 Count = 1; 79 optDetailQuery = CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(), 80 new String[] 81 { 82 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 83 }, 84 new Object[] 85 { 86 8, HelpIds.getHelpIdString(curHelpID), soptDetailQuery, new Integer(_iPosX), new Integer(iCompPosY - 42), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(iCompWidth) 87 }); 88 89 optSummaryQuery = CurUnoDialog.insertRadioButton("optSummaryQuery", 0, new ActionListenerImpl(), 90 new String[] 91 { 92 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 93 }, 94 new Object[] 95 { 96 16, HelpIds.getHelpIdString(curHelpID + 1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY - 32), IStep, new Short(curtabindex++), new Integer(iCompWidth) 97 }); 98 CurUnoDialog.insertLabel("lblAggregate", 99 new String[] 100 { 101 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 102 }, 103 new Object[] 104 { 105 8, slblAggregate, new Integer(iCompPosX + 5), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90 106 }); 107 CurUnoDialog.insertLabel("lblFieldnames", 108 new String[] 109 { 110 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 111 }, 112 new Object[] 113 { 114 8, slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90 115 }); 116 this.setTotalFieldCount(1); 117 FontDescriptor oFontDescriptor = new FontDescriptor(); 118 oFontDescriptor.Weight = com.sun.star.awt.FontWeight.BOLD; 119 oFontDescriptor.Height = (short) 14; 120 121 int iButtonPosY = iCompPosY + iCompHeight + 3; 122 CurUnoDialog.insertButton("btnplus", SOADDROW, new ActionListenerImpl(), 123 new String[] 124 { 125 PropertyNames.FONT_DESCRIPTOR, 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 126 }, 127 new Object[] 128 { 129 oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), 16 130 }); 131 CurUnoDialog.insertButton("btnminus", SOREMOVEROW, new ActionListenerImpl(), 132 new String[] 133 { 134 PropertyNames.FONT_DESCRIPTOR, 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 135 }, 136 new Object[] 137 { 138 oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 2), "-", new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), 16 139 }); 140 CurDBMetaData.Type = getQueryType(); 141 } 142 catch (com.sun.star.uno.Exception exception) 143 { 144 Resource.showCommonResourceError(CurDBMetaData.xMSF); 145 } 146 } 147 getQueryType()148 public int getQueryType() 149 { 150 if (((Short) CurUnoDialog.getControlProperty("optDetailQuery", PropertyNames.PROPERTY_STATE)).intValue() == 1) 151 { 152 return QueryMetaData.QueryType.SODETAILQUERY; 153 } 154 else 155 { 156 return QueryMetaData.QueryType.SOSUMMARYQUERY; 157 } 158 } 159 160 class ActionListenerImpl implements com.sun.star.awt.XActionListener 161 { 162 disposing(EventObject eventObject)163 public void disposing(EventObject eventObject) 164 { 165 } 166 actionPerformed(com.sun.star.awt.ActionEvent actionEvent)167 public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) 168 { 169 try 170 { 171 int iKey = CurUnoDialog.getControlKey(actionEvent.Source, CurUnoDialog.ControlList); 172 switch (iKey) 173 { 174 case SOADDROW: 175 addRow(); 176 break; 177 178 case SOREMOVEROW: 179 removeRow(); 180 break; 181 182 default: 183 toggleComponent(); 184 break; 185 } 186 } 187 catch (Exception exception) 188 { 189 exception.printStackTrace(System.out); 190 } 191 } 192 } 193 getCount()194 public int getCount() 195 { 196 return Count; 197 } 198 insertControlGroup(int i, int ypos)199 protected void insertControlGroup(int i, int ypos) 200 { 201 if (i == 0) 202 { 203 soptDetailQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 11); 204 soptSummaryQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 12); 205 slblAggregate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 16); 206 slblFieldNames = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 17); 207 sFunctions = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_QUERY + 40, 5); 208 209 sDuplicateAggregateFunction = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 90); 210 } 211 if (ControlRowVector == null) 212 { 213 ControlRowVector = new Vector(); 214 } 215 int locHelpID = curHelpIndex + (i * 2); 216 ControlRow oControlRow = new ControlRow(i, ypos, locHelpID); 217 ControlRowVector.add(oControlRow); 218 } 219 setControlGroupVisible(int _index, boolean _bIsVisible)220 protected void setControlGroupVisible(int _index, boolean _bIsVisible) 221 { 222 ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(_index); 223 oControlRow.setVisible(_bIsVisible); 224 if (_index >= (this.CurDBMetaData.AggregateFieldNames.length)) 225 { 226 oControlRow.settovoid(); 227 } 228 } 229 addRow()230 protected void addRow() 231 { 232 int fieldcount = super.getTotalFieldCount(); 233 registerControlGroupAtIndex(fieldcount); 234 if (fieldcount < super.getBlockIncrementation()) 235 { 236 ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(fieldcount); 237 oControlRow.setVisible(true); 238 oControlRow.settovoid(); 239 } 240 else 241 { 242 ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(super.getBlockIncrementation() - 1); 243 super.setScrollValue(getScrollValue() + 1, (fieldcount + 1)); 244 oControlRow.settovoid(); 245 } 246 fieldcount++; 247 super.setTotalFieldCount(fieldcount); 248 toggleButtons(); 249 CurUnoDialog.repaintDialogStep(); 250 } 251 removeRow()252 protected void removeRow() 253 { 254 int fieldcount = super.getTotalFieldCount(); 255 if (fieldcount > 0) 256 { 257 ControlRow oControlRow; 258 fieldcount--; 259 if ((fieldcount + 1) <= super.getBlockIncrementation()) 260 { 261 oControlRow = (ControlRow) ControlRowVector.elementAt(fieldcount); 262 oControlRow.setVisible(false); 263 } 264 super.setScrollValue(getScrollValue() - 1, (fieldcount)); 265 super.unregisterControlGroup(fieldcount); 266 267 } 268 toggleButtons(); 269 CurUnoDialog.repaintDialogStep(); 270 } 271 toggleButtons()272 protected void toggleButtons() 273 { 274 ControlRow curcontrolrow = null; 275 boolean biscomplete = true; 276 CurDBMetaData.Type = getQueryType(); 277 CurUnoDialog.setControlProperty("btnminus", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf((super.getTotalFieldCount() > 0) && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY))); 278 int fieldcount = super.getCurFieldCount(); 279 if (fieldcount > 0) 280 { 281 curcontrolrow = (ControlRow) ControlRowVector.elementAt(super.getCurFieldCount() - 1); 282 biscomplete = curcontrolrow.isComplete(); 283 } 284 CurUnoDialog.setControlProperty("btnplus", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(biscomplete && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY))); 285 togglefollowingDialogSteps(); 286 } 287 toggleComponent()288 public void toggleComponent() 289 { 290 CurDBMetaData.Type = getQueryType(); 291 boolean benableComponent = isAggregateComponentEnabled(); 292 CurUnoDialog.setControlProperty("lblAggregate", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableComponent)); 293 CurUnoDialog.setControlProperty("lblFieldnames", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableComponent)); 294 toggleButtons(); 295 super.toggleComponent(benableComponent); 296 super.toggleControls(benableComponent); 297 togglefollowingDialogSteps(); 298 } 299 isAggregateComponentEnabled()300 private boolean isAggregateComponentEnabled() 301 { 302 return (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY); 303 } 304 isGroupingpossible()305 public boolean isGroupingpossible() 306 { 307 try 308 { 309 boolean benableGroupPage = isAggregateComponentEnabled() && CurDBMetaData.xDBMetaData.supportsGroupBy() && hasonlycompletefunctions(); 310 String[][] sAggregateFieldNames = this.getAggregateFieldNames(); 311 if (benableGroupPage) 312 { 313 for (int i = 0; i < CurDBMetaData.NumericFieldNames.length; i++) 314 { 315 boolean bisthere = (JavaTools.FieldInTable(sAggregateFieldNames, CurDBMetaData.NumericFieldNames[i]) > -1); 316 if (!bisthere) 317 { 318 return true; 319 } 320 } 321 } 322 } 323 catch (SQLException e) 324 { 325 e.printStackTrace(System.out); 326 } 327 return false; 328 } 329 togglefollowingDialogSteps()330 private void togglefollowingDialogSteps() 331 { 332 boolean benabletherest = true; 333 boolean benableGroupPage = isGroupingpossible(); 334 CurUnoDialog.setStepEnabled(UIConsts.SOGROUPSELECTIONPAGE, benableGroupPage); 335 CurUnoDialog.setStepEnabled(UIConsts.SOGROUPFILTERPAGE, benableGroupPage && CurDBMetaData.GroupFieldNames.length > 0); 336 if (isAggregateComponentEnabled()) 337 { 338 benabletherest = hasonlycompletefunctions(); 339 } 340 CurUnoDialog.enablefromStep(UIConsts.SOTITLESPAGE, benabletherest); 341 CurUnoDialog.enableNextButton(benabletherest); 342 } 343 hideControlRowsfromindex(int _index)344 private void hideControlRowsfromindex(int _index) 345 { 346 if (_index < this.ControlRowVector.size()) 347 { 348 for (int i = _index; i < ControlRowVector.size(); i++) 349 { 350 ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(i); 351 // if (i == _index) 352 // oControlRow.settovoid(); 353 // else 354 oControlRow.setVisible(false); 355 } 356 } 357 358 } 359 getAggregateFieldNames()360 public String[][] getAggregateFieldNames() 361 { 362 try 363 { 364 CurDBMetaData.Type = getQueryType(); 365 if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY) 366 { 367 ArrayList<String[]> aggregatevector = new ArrayList<String[]>(); 368 PropertyValue[][] aggregatelist = this.getScrollFieldValues(); 369 PropertyValue[] currowproperties; 370 PropertyValue curaggregateproperty; 371 if (CurDBMetaData.AggregateFieldNames != null) 372 { 373 for (int i = 0; i < aggregatelist.length; i++) 374 { 375 currowproperties = aggregatelist[i]; 376 if ((currowproperties[0].Value != null) && (currowproperties[1].Value != null)) 377 { 378 short[] iselfield = (short[]) AnyConverter.toArray(currowproperties[1].Value); 379 short[] iselfunction = (short[]) AnyConverter.toArray(currowproperties[0].Value); 380 if ((iselfield.length > 0) && (iselfunction.length > 0)) 381 { 382 String[] curaggregatename = new String[2]; 383 curaggregatename[0] = CurDBMetaData.NumericFieldNames[iselfield[0]]; 384 curaggregatename[1] = this.sFunctionOperators[iselfunction[0]]; 385 aggregatevector.add(curaggregatename); 386 } 387 } 388 } 389 } 390 CurDBMetaData.AggregateFieldNames = new String[aggregatevector.size()][2]; 391 aggregatevector.toArray(CurDBMetaData.AggregateFieldNames); 392 } 393 394 int iduplicate = JavaTools.getDuplicateFieldIndex(CurDBMetaData.AggregateFieldNames); 395 if (iduplicate != -1) 396 { 397 sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, CurDBMetaData.AggregateFieldNames[iduplicate][0], "<NUMERICFIELD>"); 398 int index = JavaTools.FieldInList(sFunctionOperators, CurDBMetaData.AggregateFieldNames[iduplicate][1]); 399 String sDisplayFunction = sFunctions[index]; 400 sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, sDisplayFunction, "<FUNCTION>"); 401 CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sDuplicateAggregateFunction); 402 CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", 1, 2)); 403 return new String[][] 404 { 405 }; 406 } 407 else 408 { 409 return CurDBMetaData.AggregateFieldNames; 410 } 411 } 412 catch (Exception exception) 413 { 414 exception.printStackTrace(System.out); 415 return null; 416 } 417 } 418 initialize()419 public void initialize() 420 { 421 CurDBMetaData.setNumericFields(); 422 initializeScrollFields(); 423 int icount = CurDBMetaData.AggregateFieldNames.length; 424 if (icount == 0) 425 { 426 super.initialize(1); 427 hideControlRowsfromindex(1); 428 } 429 else 430 { 431 super.initialize(icount); 432 hideControlRowsfromindex(icount); 433 } 434 toggleComponent(); 435 CurUnoDialog.repaintDialogStep(); 436 } 437 initializeScrollFields()438 protected void initializeScrollFields() 439 { 440 ControlRow curControlRow; 441 if (CurDBMetaData.AggregateFieldNames != null) 442 { 443 for (int i = 0; i < this.getBlockIncrementation(); i++) 444 { 445 curControlRow = (ControlRow) ControlRowVector.elementAt(i); 446 curControlRow.insertFieldNames(); 447 } 448 for (int i = 0; i <= CurDBMetaData.AggregateFieldNames.length; i++) 449 { 450 registerControlGroupAtIndex(i); 451 } 452 } 453 } 454 registerControlGroupAtIndex(int _index)455 private void registerControlGroupAtIndex(int _index) 456 { 457 short[] iselfunctionlist = new short[] 458 { 459 }; 460 short[] iselfieldslist = new short[] 461 { 462 }; 463 PropertyValue[] currowproperties = new PropertyValue[2]; 464 if (_index < CurDBMetaData.AggregateFieldNames.length) 465 { 466 short iselfieldsindex = (short) JavaTools.FieldInList(CurDBMetaData.NumericFieldNames, CurDBMetaData.AggregateFieldNames[_index][0]); 467 iselfieldslist = new short[] 468 { 469 iselfieldsindex 470 }; 471 short iselfunctionindex = (short) JavaTools.FieldInList(sFunctionOperators, CurDBMetaData.AggregateFieldNames[_index][1]); 472 iselfunctionlist = new short[] 473 { 474 iselfunctionindex 475 }; 476 } 477 currowproperties[0] = Properties.createProperty(getFunctionControlName(_index), iselfunctionlist, _index); 478 currowproperties[1] = Properties.createProperty(getFieldsControlName(_index), iselfieldslist, _index); //getTitleName(i) 479 super.registerControlGroup(currowproperties, _index); 480 } 481 getFunctionControlName(int _index)482 private String getFunctionControlName(int _index) 483 { 484 String namesuffix = "_" + String.valueOf(_index + 1); 485 return "lstfunctions" + namesuffix; 486 } 487 getFieldsControlName(int _index)488 private String getFieldsControlName(int _index) 489 { 490 String namesuffix = "_" + String.valueOf(_index + 1); 491 return "lstFieldnames" + namesuffix; 492 } 493 hasonlycompletefunctions()494 private boolean hasonlycompletefunctions() 495 { 496 int maxfieldcount = super.getCurFieldCount(); 497 if (maxfieldcount > 0) 498 { 499 ControlRow curcontrolrow = (ControlRow) this.ControlRowVector.elementAt(maxfieldcount - 1); 500 return curcontrolrow.isComplete(); 501 } 502 else 503 { 504 return false; 505 } 506 } 507 508 protected class ControlRow 509 { 510 511 private XListBox xFieldListBox; 512 private XListBox xFunctionListBox; 513 private int index; 514 ControlRow(int _index, int ypos, int _curHelpID)515 protected ControlRow(int _index, int ypos, int _curHelpID) 516 { 517 try 518 { 519 this.index = _index; 520 xFunctionListBox = CurUnoDialog.insertListBox(getFunctionControlName(index), 1, null, new ItemListenerImpl(), 521 new String[] 522 { 523 "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 524 }, 525 new Object[] 526 { 527 Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), 88 528 }); 529 530 xFieldListBox = CurUnoDialog.insertListBox(getFieldsControlName(index), 1, null, new ItemListenerImpl(), 531 new String[] 532 { 533 "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 534 }, 535 new Object[] 536 { 537 Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 86 538 }); 539 lastHelpIndex = _curHelpID - 1; 540 } 541 catch (Exception exception) 542 { 543 exception.printStackTrace(System.out); 544 } 545 } 546 getSelectedFieldName()547 private String getSelectedFieldName() 548 { 549 return xFieldListBox.getSelectedItem(); 550 } 551 getSelectedFunction()552 private String getSelectedFunction() 553 { 554 return xFunctionListBox.getSelectedItem(); 555 } 556 setVisible(boolean _bvisible)557 private void setVisible(boolean _bvisible) 558 { 559 CurUnoDialog.setControlVisible(getFunctionControlName(index), _bvisible); 560 CurUnoDialog.setControlVisible(getFieldsControlName(index), _bvisible); 561 } 562 insertFieldNames()563 private void insertFieldNames() 564 { 565 Helper.setUnoPropertyValue(UnoDialog.getModel(xFieldListBox), PropertyNames.STRING_ITEM_LIST, CurDBMetaData.NumericFieldNames); 566 } 567 isComplete()568 private boolean isComplete() 569 { 570 boolean bfieldnameisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFieldListBox), PropertyNames.SELECTED_ITEMS) != null); 571 boolean bfunctionisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFunctionListBox), PropertyNames.SELECTED_ITEMS) != null); 572 return (bfieldnameisselected && bfunctionisselected); 573 } 574 settovoid()575 private void settovoid() 576 { 577 CurUnoDialog.deselectListBox(xFieldListBox); 578 CurUnoDialog.deselectListBox(xFunctionListBox); 579 } 580 581 protected class ItemListenerImpl implements com.sun.star.awt.XItemListener 582 { 583 itemStateChanged(com.sun.star.awt.ItemEvent EventObject)584 public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) 585 { 586 try 587 { 588 toggleButtons(); 589 togglefollowingDialogSteps(); 590 } 591 catch (Exception exception) 592 { 593 exception.printStackTrace(System.out); 594 } 595 } 596 disposing(com.sun.star.lang.EventObject eventObject)597 public void disposing(com.sun.star.lang.EventObject eventObject) 598 { 599 } 600 } 601 } 602 } 603