private TrialEqualsByProperties() { createLoaderForThread(true); sbI1 = (SdzBagI) Utils.loadXMLFromResource(filename1, this, false); sbI2 = (SdzBagI) Utils.loadXMLFromResource(filename2, this, false); Err.pr("sbI1: " + sbI1); Err.pr("sbI2: " + sbI2); JComponent[] panels1 = sbI1.getPanes(); JComponent[] panels2 = sbI2.getPanes(); if (panels1.length != panels2.length) { Err.error("Expected the size of the panels to be the same"); } WidgetClassifier wc = new WidgetClassifier(); ReasonNotEquals.turnOn(true); for (int i = 0; i < panels1.length; i++) { JComponent component1 = panels1[i]; JComponent component2 = panels2[i]; if (ComponentUtils.equalsByProperties(component1, component2, wc)) { Err.pr("Found to be equal"); } else { Err.pr("Found to be NOT equal: " + ReasonNotEquals.formatReasons()); break; } } ReasonNotEquals.turnOn(false); }
/** Re-create the displayList. Will appear to outside world that only this list exists. */ public void setList(Object masterElement, Tie tie) { Err.pr( SdzNote.CANT_ADD_RS, "$$$ setList called for reference extent, masterElement: " + masterElement); Err.pr( SdzNote.CANT_ADD_RS, "$$$ setList called for reference extent, tie: " + tie.hashCode()); super.setList(masterElement, tie); this.tie = tie; referenceValue = masterElement; displayList.clear(); Object refVal, element; for (Iterator e = hugeList.iterator(); e.hasNext(); ) { element = e.next(); // Err.pr("Looking for " + refField + " in " + element); refVal = tie.getFieldValue(element); debug(refVal, masterElement); if (DOHelperUtils.equalityTest(masterElement, refVal)) // if(masterElement == refVal) { Err.pr(SdzNote.CANT_ADD_RS, "Match found on refVal " + refVal); displayList.add(element); } else { // Err.pr(SdzNote.cantAddRS, ""); // Err.pr(SdzNote.cantAddRS, "NO match found on refVal: " + refVal); // Err.pr(SdzNote.cantAddRS, "WHEN CF WITH: " + masterElement); // Err.pr(SdzNote.cantAddRS, ""); } } hasCombinationExtent.getCombinationExtent().setList(this, tie); }
public boolean haveFieldsChanged() { boolean result = false; for (Iterator e = vector.iterator(); e.hasNext(); ) { AbstFieldObj fieldObj = (AbstFieldObj) e.next(); Err.pr(SdzNote.SET_OBJCOMP_TABLE, "fieldObj to consider: " + fieldObj); if (fieldObj.haveFieldsChanged()) { Err.pr(SdzNote.SET_OBJCOMP_TABLE, "fields have changed for " + fieldObj); result = true; break; } } return result; }
private void pr(String txt, boolean force) { if (DEBUG) { if ( /*block.getName().equals("Job Node") &&*/ (force || doingNonVisual())) { Err.pr(txt); } } }
void removeClickListeners(Component comp) { MouseListener ls[] = comp.getMouseListeners(); for (int i = 0; i < ls.length; i++) { if (ls[i] instanceof ClickListener) { comp.removeMouseListener(ls[i]); Err.pr(SdzNote.FIELD_VALIDATION, "Removed all focus listeners from " + comp); } } }
public void setTableObj(FieldObj tableObj) { /// fieldObj = tableObj; extent = new TempCursorExtent(this, block, tableObj); flatColumns = tableObj.getVisualTableAdaptersArrayList(); nvFlatColumns = tableObj.getNonVisualTableAdaptersArrayList(); Err.pr( SdzNote.MANY_NON_VISUAL_ATTRIBS, "NVFlatColumns set in <" + block.getName() + "> and is size " + nvFlatColumns.size()); // Err.pr( "flatColumns: " + flatColumns); }
public void startTx(String reason) { times++; Object pm = null; if (getEM() != null) { pm = getEM().getActualEM(); } Err.pr( JDONote.RELOAD_PM_KODO_BUG, reason + " in " + this + " with pm: " + pm + " times " + times + " isOnTxn " + isOnTx()); super.startTx(reason); }
/** * When the user clicks on this control it calls this, its own action listener method, which * propogates the event as well as doing the visible changes. */ public void actionPerformed(ActionEvent e) { int shiftToIndex; if (e.getSource() == getLShiftRight()) { shiftToIndex = getSelected() + 1; if (shiftToIndex == labels.length) { shiftToIndex = 0; } } else { // Err.pr( "Clicked on a dynamic label called: <" + e.getActionCommand() + ">"); shiftToIndex = findIndexOfTitle(((NoEdgedButton) e.getSource()).getText()); } if (shiftToIndex != getSelected()) { Err.pr( SdzNote.EXPANDER_IDX, "<" + this.getName() + "> needs change index to <" + shiftToIndex + "> from <" + getSelected() + ">"); ActionListener actionListener = getActionListener(); if (actionListener != null) { JLabel label = getLabel(shiftToIndex); ActionEvent event = new ActionEvent(label, ActionEvent.ACTION_PERFORMED, label.getText()); actionListener.actionPerformed(event); } else { Err.pr("No actionListener on <" + getName() + ">"); } setSelected(shiftToIndex); for (int i = 0; i < changeListeners.size(); i++) { ChangeListener changeListener = changeListeners.get(i); ChangeEvent changeEvent = new ChangeEvent(this); changeListener.stateChanged(changeEvent); } } else { Err.pr( SdzNote.EXPANDER_IDX, this.getName() + " thinks that <" + shiftToIndex + "> is already the current index"); } }
/** * Always called on by a server. Getting an EM takes time. On the client it is always done in its * own special task. * * @param enumIdWombat */ public static CayenneWombatDataStore newInstance(WombatConnectionEnum enumIdWombat) { CayenneWombatDataStore result; Err.pr("Server service: " + enumIdWombat); WombatConnections connections = new WombatConnections(); CayenneSecureConnectionInfo connectionInfo = (CayenneSecureConnectionInfo) connections.get(enumIdWombat); result = new CayenneWombatDataStore(connectionInfo); Err.pr("To try to get an EM"); /* SdzEntityManagerI emI = EntityManagerFactory.createSdzEMI( connectionInfo.getORMType(), result.getConnectionConfigString(), null); */ SdzEntityManagerI emI = CayenneEntityManagerFactory.createSdzEMI( result.getCayenneORMType(), result.getConnection().getConfigStringName(), result.getConnection().getProperties()); Err.pr("em: " + emI); return result; }
/** Rather than using this method, consider finding the button and doing doClick(). */ public void setSelected(int selected) { // Err.pr( "Selecting <" + selected + "> in <" + getName() + "> ID: " + getId()); if (!BeansUtils.isDesignTime()) { // Err.pr( "Not design time, so must be responding to user"); init(getTitles(labels), selected, getExplanation(), getExtras()); /* Don't do this, will be recursive Doh! ((NoEdgedButton)labels[selected]).doClick(); */ } else { Err.pr("Design time, so skipping rebuilding"); } this.selected = selected; }
/** * Get the connection properties depending on which enumIdWombat are connecting to. Also there are * two types of connections. One, the server, is to the actual database. The other type of * connection is a client connection, which connects to the server. From the client's point of * view this server is know as a host. (The host serves the guest/client). If * !fromJDOConnectionServer then we are currently at a client. There is only ever one server for a * client, so the logic in here sets the host property in this case. * * @param connectionInfo */ public CayenneWombatDataStore(CayenneSecureConnectionInfo connectionInfo) { Err.pr("Creating a CayenneWombatDataStore"); boolean client = connectionInfo.getORMType() == ORMTypeEnum.CAYENNE_CLIENT; // boolean client = true; super.setClasses(CayenneWombatData.getInstance(client).getClasses()); Assert.isTrue(connectionInfo.getORMType().isCayenne()); setEstimatedConnectDuration(connectionInfo.getEstimatedConnectDuration()); setEstimatedLookupDataDuration(connectionInfo.getEstimatedLoadLookupDataDuration()); setErrorThrower(Session.getErrorThrower()); setConnectionConfigString(connectionInfo.getConfigStringName()); setCayenneORMType(connectionInfo.getORMType()); setDomainQueries(new CayenneWombatDomainQueries(client)); setName(connectionInfo.getName()); }
ReferenceExtent(IndependentExtent hugeList, HasCombinationExtent ce, Tie tie) { if (hugeList == null) { Err.error("Cannot create ReferenceNodeExtent with a null hugeList"); } this.hugeList = hugeList; times++; Err.pr( SdzNote.CANT_ADD_RS, "hugeList have been set has size " + hugeList.size() + " times " + times); if (ce == null) { Err.error("Cannot create a ReferenceExtent with a null CombinationExtent"); } this.hasCombinationExtent = ce; // ce.addDependent( this, tie); }
/** Setup data so will give a full roster no matter which month, no matter what time */ private void populateFromDemoData() { SdzEntityManagerI pm = dataStore.getEM(); pm.registerPersistentAll(demoDataCayenne.newWorkers); pm.registerPersistentAll(demoDataCayenne.newBMs); pm.registerPersistentAll(demoDataCayenne.newRSs); pm.registerPersistentAll(demoDataCayenne.newUsers); pm.registerPersistentAll( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_DAY_IN_WEEK)); pm.registerPersistentAll( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_FLEXIBILITY)); pm.registerPersistentAll( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_MONTH_IN_YEAR)); pm.registerPersistentAll( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_INTERVAL)); pm.registerPersistentAll( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_FLEXIBILITY)); pm.registerPersistentAll( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_SENIORITY)); pm.registerPersistentAll(demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_SEX)); pm.registerPersistentAll( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_WEEK_IN_MONTH)); pm.registerPersistentAll( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_WHICH_SHIFT)); Err.pr( "Population complete, have added " + demoDataCayenne.newWorkers.size() + " Workers and " + demoDataCayenne.newRSs.size() + " RosterSlots and " + demoDataCayenne.newUsers.size() + " UserDetails and " + demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_SENIORITY).size() + " Seniorities and " + demoDataCayenne.newBMs.size() + " BuddyManagers to the database"); Print.prList( demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_SENIORITY), "seniorities"); }
private static void update(Collection list) { int timesFound = 0; Worker nullWorker = null; for (Iterator iter = list.iterator(); iter.hasNext(); ) { Worker vol = (Worker) iter.next(); if ( // ( // vol.getChristianName() != null && // vol.getChristianName().equals( "Bart") // ) || vol.equals(Worker.NULL)) { timesFound++; if (timesFound > 1) { Err.error("Should only be one NULL volunteer"); } nullWorker = vol; Err.pr("NULL vol have found is " + nullWorker); } } if (nullWorker == null) { Err.pr("Could not find a worker equal to NULL, so creating one"); nullWorker = new Worker(); } nullWorker.setDummy(true); Err.pr( JDONote.APPEARS_CONSTRUCTOR_NOT_CALLED, "Why have to do this - Worker's constructor s/do it"); if (nullWorker.getBelongsToGroup() != null) { Err.pr(JDONote.APPEARS_CONSTRUCTOR_NOT_CALLED, "appears Constructor was called"); } else { Err.pr(JDONote.APPEARS_CONSTRUCTOR_NOT_CALLED, "appears Constructor was NOT called"); } nullWorker.setBelongsToGroup(nullWorker); dataStore.getEM().registerPersistent(nullWorker); Err.pr("MADE A NULL WORKER, " + nullWorker); }
public void startTx() { if (JDONote.RELOAD_PM_KODO_BUG.isVisible()) { Err.pr("Would be nice to provide a reason when JDONote.RELOAD_PM_KODO_BUG.isVisible()"); } super.startTx(); }
/** * Not part of the table model (so doesn't get called when the table is painting). Has proven to * be a good place to set the table up just prior to painting. */ public void blankoutDisplay(OperationEnum currentOperation, int row, String reason) { int idxCurrentRow = block.getIndex(); // OperationEnum currentOperation = oper.getCurrentOperation(); StateEnum currentState = oper.getState(block); Block currentBlock = oper.getCurrentBlock(); if (false /*SdzNote.SET_DISPLAY_ON_TABLE.isVisible()*/) { times++; Err.pr(""); Err.pr("Inside blankoutDisplay for <" + block + "> times: " + times); Err.pr("\tcurrentBlock: " + currentBlock); Err.pr("\tblock that has table: " + block); Err.pr("\tcurrent operation: " + currentOperation); Err.pr("\tcurrent state: " + currentState); Err.pr("\tidxCurrentRow: " + idxCurrentRow); if (times == 39) { Err.debug(); } } if (currentOperation == OperationEnum.INSERT_AFTER_PLACE || currentOperation == OperationEnum.INSERT_AT_PLACE) { if (block == currentBlock) { int index = -99; /* We don't do this for field, so lets not do it for table either if(currentOperation == OperationEnum.INSERT || currentOperation == OperationEnum.INSERT_IGNORE) { index = block.getIndex() + 1; } else */ { index = block.getIndex(); } usersModel.acceptEdit(); usersModel.fireTableRowsInserted(index, index); // Was trying to select the row on the table. Doing at the post operation performed // trigger (see SdzDsgnr for this) actually works, so as there's a workaround // we've left this as a slight note Err.pr( SdzNote.AUTO_SELECT_TABLE_ROW_AFTER_INSERT, "Do we actually need access to the JTable if wanted to do this here?"); // usersModel.fireRowChangedTo(index); Err.pr("Inserting a row s/know to move to it as well..."); Err.pr(SdzNote.SET_DISPLAY_ON_TABLE, "blankoutDisplay, have changed row to " + index); } else { // For example when insert master usersModel.fireTableDataChanged( "blankoutDisplay because of an " + "INSERT on different block to current, because " + reason); } } else if (currentOperation == OperationEnum.REMOVE /* && block == currentBlock*/) { /* * Do not want to fireTableDataChanged(), as this would lead to the * edited data being written ie. setValueAt() being called. */ usersModel.rejectEdit(); if ( /* (currentState.isNavigating() || currentState.isNew()) ||*/ currentState == StateEnum.FROZEN) { // When do this then model will no longer have the extra artificial // inserted row, and fireTableRowsDeleted will work usersModel.fireTableRowsDeleted(idxCurrentRow, idxCurrentRow); } } else if (currentOperation == OperationEnum.EXECUTE_QUERY) { /* * As above */ usersModel.rejectEdit(); usersModel.fireTableDataChanged("blankoutDisplay because of EXECUTE_QUERY because " + reason); } else if ((currentOperation == OperationEnum.NEXT || currentOperation == OperationEnum.PREVIOUS) && currentState.isNavigating()) { usersModel.fireTableDataChanged("blankoutDisplay because of NEXT/PREVIOUS because " + reason); } else if (currentOperation == OperationEnum.REFRESH) { Err.pr( /*SdzNote.SET_DISPLAY_ON_TABLE*/ false, "@@ blankoutDisplay for op " + currentOperation); usersModel.fireTableDataChanged( row, row, "blankoutDisplay for op " + currentOperation + " because " + reason); } else { Err.pr( /*SdzNote.SET_DISPLAY_ON_TABLE*/ false, "@@ blankoutDisplay, default as op was " + currentOperation); usersModel.fireTableDataChanged( "blankoutDisplay because of Un-programmed for op " + currentOperation + " because " + reason); } }
/** * Current reference value is implicitly set. Are careful to insert in same relative order, * although this depends on hugeList being an ordered list (later NavExtent can have an isOrdered * method so can code both ways). */ public void insert(Object obj, int index) { tie.setFieldValue(obj, referenceValue); Err.pr(SdzNote.BG_ADD, "--------------ReferenceExtent.insert()ing " + obj); displayList.add(index, obj); relativePositionInsert(obj, displayList, hugeList); }
public void init( List<String> titles, int selected, String explanation, List<ExpanderControlTransObj> extras) { this.selected = selected; Err.pr(SdzNote.EXPANDER_IDX, "init on <" + getName() + ">, selected <" + selected + ">"); if (SdzNote.EXPANDER_IDX.isVisible() && "chkIntoExisting".equals(getName()) && selected == 0) { Err.pr("Selecting 0 not happening on DB (solution was to write toString())"); } removeAll(); ModernTableLayout modernTableLayout = new ModernTableLayout(); modernTableLayout.insertColumn(0, LEFT_EDGE_WIDTH); modernTableLayout.insertColumn(1, 25 - LEFT_EDGE_WIDTH); modernTableLayout.insertColumn(2, GAP_WIDTH); int count = NUM_LEAD_COLS; for (int i = 0; i < titles.size(); i++) { String title = titles.get(i); long labelWidth; if (sizeIncreasesWhenSelected) { labelWidth = WidgetUtils.calcPixelWidthOfStringOnComponent(title, TYPICAL_BIG_CONTAINER); } else { labelWidth = WidgetUtils.calcPixelWidthOfStringOnComponent(title, TYPICAL_SIZED_CONTAINER); } modernTableLayout.insertColumn(count, labelWidth); count++; IconLabel iconLabel = getIconLabelAt(i, extras); if (iconLabel != null) { Icon icon = iconLabel.getIcon(); if (icon != null) { modernTableLayout.insertColumn(count, icon.getIconWidth() + 7); count++; } else { Err.error("Expect there to always be an icon in an IconLabel"); } } modernTableLayout.insertColumn(count, GAP_WIDTH); count++; } modernTableLayout.insertRow(0, ModernTableLayout.FILL); setLayout(modernTableLayout); NoEdgedButton[] labels = new NoEdgedButton[titles.size()]; lShiftRight = new NoEdgedButton(); add(lShiftRight, "1,0"); count = NUM_LEAD_COLS; for (int i = 0; i < titles.size(); i++) { NoEdgedButton item = new NoEdgedButton(); addMouseListeners(item, mouseListeners); item.setActionListener(this); if (i == selected) { if (sizeIncreasesWhenSelected) { item.setFont(BIG_BOLD_FONT); } else { item.setFont(BOLD_FONT); } if (foregroundChangesWhenSelected) { item.setForeground(PURPLE); } } else { item.setFont(NORMAL_FONT); item.setForeground(null); } item.setName("lExpander control item number " + i); String title = titles.get(i); item.setText(title); item.setHorizontalAlignment(SwingConstants.LEADING); add(item, count + ", 0"); count++; IconLabel iconLabel = getIconLabelAt(i, extras); if (iconLabel != null) { addMouseListeners(iconLabel, mouseListeners); add(iconLabel, count + ", 0"); count++; } count++; labels[i] = item; if (extras != null && extras.size() > i) { if (extras.get(i).getBackground() != null) { labels[i].setOpaque(true); labels[i].setBackground(extras.get(i).getBackground()); } else { // Err.error( "Do we just setBackground() to null and opaque to false?"); labels[i].setOpaque(false); labels[i].setBackground(null); } if (selected == i && foregroundChangesWhenSelected) { /* * Never override the selected foreground being purple if * selected being purple is what has been specified. */ } else { if (extras.get(i).getForeground() != null) { labels[i].setForeground(extras.get(i).getForeground()); } else { labels[i].setForeground(null); } } if (extras.get(i).getToolTipText() != null) { labels[i].setToolTipText(extras.get(i).getToolTipText()); } else { labels[i].setToolTipText(null); } if (iconLabel != null) { if (extras.get(i).getIconToolTipText() != null) { iconLabel.setToolTipText(extras.get(i).getIconToolTipText()); } else { iconLabel.setToolTipText(null); } } } } lShiftRight.setName("lShiftRight"); lShiftRight.setToolTipText(explanation); lShiftRight.setActionListener(this); PortableImageIcon portableImageIcon = PortableImageIcon.createImageIcon( "images/control_end_blue.png", "Change View", PortableImageIcon.STDERR_MSG); if (portableImageIcon != null) { lShiftRight.setIcon(portableImageIcon); } setLShiftRight(lShiftRight); setName("ExpanderControl"); setLabels(labels); setExplanation(explanation); /* setBackgrounds( backgrounds); setForegrounds( foregrounds); setToolTipTexts( toolTipTexts); */ setExtras(extras); }
/** * set param is hardly ever being used, which means things like will be setting the current row * visibly current when in fact it already is visibly current. No big deal! */ public void setDisplay(OperationEnum currentOperation, int row, String reason) { StateEnum currentState = oper.getState(block); Block currentBlock = oper.getCurrentBlock(); // int idxCurrentRow = block.getCursorPosition() - 1; int idxCurrentRow = block.getIndex(); if (currentState.isNew() && currentState.isPrior()) { idxCurrentRow--; } /**/ if (false /*SdzNote.SET_DISPLAY_ON_TABLE.isVisible()*/) { times++; Err.pr(""); Err.pr("Inside setDisplay for <" + block + "> times: " + times); Err.pr("\tCurrent block: " + currentBlock); Err.pr("\tblock that has table: " + block); Err.pr("\tcurrent operation: " + currentOperation); Err.pr("\tcurrent state: " + currentState); Err.pr("\trow to change to: " + idxCurrentRow); if (times == 39) { Err.debug(); } } /**/ if (currentOperation == OperationEnum.REMOVE // && currentState.isNew() // && !block.isChildOf( currentBlock) ) { usersModel.fireTableRowsDeleted(idxCurrentRow, idxCurrentRow); // usersModel.fireRowChangedTo( idxCurrentRow-1); } /* else if(currentOperation == OperationEnum.REMOVE && currentState.isNavigating() && !block.isChildOf( currentBlock)) { // w/out this, in case where deleted first row, // would not have become selected again usersModel.fireRowChangedTo( idxCurrentRow); } */ else if (currentOperation == OperationEnum.EXECUTE_QUERY) { usersModel.fireTableDataChanged( "setDisplay because of " + currentOperation + ", because " + reason); // No evidence yet that need this // usersModel.fireRowChangedTo( idxCurrentRow); } if (currentState.isNew() && (currentOperation == OperationEnum.PREVIOUS || currentOperation == OperationEnum.NEXT)) { usersModel.fireRowChangedTo(idxCurrentRow); } /* else if((currentOperation == OperationEnum.INSERT || currentOperation == OperationEnum.INSERT_PRIOR) && block == currentBlock) { usersModel.fireRowChangedTo( idxCurrentRow); Err.pr( "blankoutDisplay, have changed row to " + idxCurrentRow); } */ else if (currentOperation == OperationEnum.REFRESH) { Err.pr(/*SdzNote.SET_DISPLAY_ON_TABLE*/ false, "@@ setDisplay for op " + currentOperation); usersModel.fireTableDataChanged( row, row, "setDisplay for op " + currentOperation + " because " + reason); } else { Err.pr(SdzNote.SET_DISPLAY_ON_TABLE, "@@ setDisplay, default as op was " + currentOperation); usersModel.fireRowChangedTo(idxCurrentRow); } }